本文整理汇总了C#中Feature类的典型用法代码示例。如果您正苦于以下问题:C# Feature类的具体用法?C# Feature怎么用?C# Feature使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Feature类属于命名空间,在下文中一共展示了Feature类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Features_IsEnabled_ReturnsTrue_WhenPathIsMoreComplexThanFeatureInRegistry
public void Features_IsEnabled_ReturnsTrue_WhenPathIsMoreComplexThanFeatureInRegistry()
{
// test feature a/b/c where value in registry is just a (signifying all features registered)
var feature = new Feature("a");
var attribute = new FeatureAttribute("a", "b", "c");
Assert.True(Features.IsEnabled(SetupRegistry(feature), new[] { "a", "b", "c" }));
}
示例2: Scenario
public Scenario(Feature feature)
{
Steps = new List<Step>();
Components = new List<Component>();
Container = feature.Container.Scope();
Props = new Dictionary<string, object>();
}
示例3: GenericHandler
public GenericHandler(string contentType, EndpointAttributes handlerAttributes, Feature usesFeature)
{
this.HandlerContentType = contentType;
this.ContentTypeAttribute = ContentType.GetEndpointAttributes(contentType);
this.HandlerAttributes = handlerAttributes;
this.usesFeature = usesFeature;
}
示例4: SetPropertyValue
public void SetPropertyValue()
{
var ft = new Feature(Exp.SomeFeature);
ft = ft.Set(Exp.SomeProperty, 10);
Assert.Equal(10, ft.Get(Exp.SomeProperty));
}
示例5: ExceptionsScreen_OnLoaded
private void ExceptionsScreen_OnLoaded(object sender, RoutedEventArgs e)
{
var core = AppContextObsolete.AppContext;
var feature = new Feature(@"Exceptions", @"Load");
try
{
var s = Stopwatch.StartNew();
try
{
FeatureManager.CreateSchema(core.DbContextCreator);
}
catch { }
core.FeatureManager.Load(core.DbContextCreator);
core.FeatureManager.Write(feature, string.Empty);
this.ViewModel.Load(
ExceptionsDataProvider.GetTimePeriods,
ExceptionsDataProvider.GetVersions,
ExceptionsDataProvider.GetExceptions,
ExceptionsDataProvider.GetExceptionsCounts);
s.Stop();
Debug.WriteLine(s.ElapsedMilliseconds);
}
catch (Exception ex)
{
core.Log(ex.ToString(), LogLevel.Error);
core.FeatureManager.Write(feature, ex);
}
}
示例6: ShouldRecordInstrumentationForIsEnabled
public void ShouldRecordInstrumentationForIsEnabled([Values(true,false)] Boolean enabled)
{
var instrumenter = new MockInstrumenter();
var feature = new Feature("Name", new MemoryAdapter(), instrumenter);
if (enabled)
{
feature.Enable();
} else
{
feature.Disable();
}
instrumenter.Events.Clear();
feature.IsEnabled();
var expectedPayload = new InstrumentationPayload {
FeatureName = "Name",
Operation = "enabled?",
Thing = null,
Result = enabled
};
var expectedEvent = new MockInstrumenter.Event {
Type = InstrumentationType.FeatureOperation,
Payload = expectedPayload,
};
Assert.That(instrumenter.Events, Has.Member(expectedEvent));
}
示例7: CheckFeatureSupport
/// <summary>
/// Check if this device is supporting a feature.
/// </summary>
/// <param name="feature">The feature to check.</param>
/// <returns>
/// Returns true if this device supports this feature, otherwise false.
/// </returns>
public bool CheckFeatureSupport(Feature feature)
{
unsafe
{
switch (feature)
{
case Feature.Doubles:
{
FeatureDataDoubles support;
if (CheckFeatureSupport(Feature.Doubles, new IntPtr(&support), Utilities.SizeOf<FeatureDataDoubles>()).Failure)
return false;
return support.DoublePrecisionFloatShaderOps;
}
case Feature.D3D10XHardwareOptions:
{
FeatureDataD3D10XHardwareOptions support;
if (CheckFeatureSupport(Feature.D3D10XHardwareOptions, new IntPtr(&support), Utilities.SizeOf<FeatureDataD3D10XHardwareOptions>()).Failure)
return false;
return support.ComputeShadersPlusRawAndStructuredBuffersViaShader4X;
}
default:
throw new SharpDXException("Unsupported Feature. Use specialized CheckXXX methods");
}
}
}
示例8: PopupUserControl
public PopupUserControl(Feature feature)
{
InitializeComponent();
string speed = feature.ColumnValues["Speed"];
string name = feature.ColumnValues["VehicleName"];
string latitude = feature.ColumnValues["Latitude"];
string dateTime = feature.ColumnValues["DateTime"];
string longitude = feature.ColumnValues["Longitude"];
txtName.Text = name;
double x, y;
if (double.TryParse(longitude, out x) && double.TryParse(latitude, out y))
{
ManagedProj4Projection proj4 = new ManagedProj4Projection();
proj4.InternalProjectionParametersString = Proj4Projection.GetDecimalDegreesParametersString();
proj4.ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString();
proj4.Open();
Vertex vertex = proj4.ConvertToInternalProjection(x, y);
txtLongitude.Text = vertex.X.ToString("N6", CultureInfo.InvariantCulture);
txtLatitude.Text = vertex.Y.ToString("N6", CultureInfo.InvariantCulture);
proj4.Close();
}
else
{
txtLongitude.Text = longitude;
txtLatitude.Text = latitude;
}
txtSpeed.Text = speed + " mph";
txtTime.Text = dateTime;
}
示例9: Should_set_tags_for_feature_event
public void Should_set_tags_for_feature_event()
{
var feature = new Feature("featureTitle");
feature.AddTags(new[] { "tag1", "tag2" });
sut.OnFeatureStartedEvent(feature);
CollectionAssert.AreEqual(new[] { "tag1", "tag2" }, featureContext.Tags);
}
示例10: convertFeatureToWkb_Click
private void convertFeatureToWkb_Click(object sender, RoutedEventArgs e)
{
Feature feature = new Feature(wktTextBox.Text);
byte[] wellKnownBinary = feature.GetWellKnownBinary();
wkbResultTextBox.Text = Convert.ToBase64String(wellKnownBinary);
}
示例11: convertWkbToFeature_Click
private void convertWkbToFeature_Click(object sender, RoutedEventArgs e)
{
byte[] wellKnownBinary = Convert.FromBase64String(wkbTextBox.Text);
Feature feature = new Feature(wellKnownBinary);
wktResultTextBox.Text = feature.GetWellKnownText();
}
示例12: Should_add_table_steps_to_scenario
public void Should_add_table_steps_to_scenario()
{
var gherkinEvents = MockRepository.GenerateStub<IGherkinParserEvents>();
var stepBuilder = new StepBuilder(gherkinEvents);
var feature = new Feature("title");
var scenario = new Scenario("title", "source", feature);
gherkinEvents.Raise(_ => _.FeatureEvent += null, this, new EventArgs<Feature>(feature));
gherkinEvents.Raise(_ => _.ScenarioEvent += null, this, new EventArgs<Scenario>(scenario));
gherkinEvents.Raise(_ => _.StepEvent += null, this, new EventArgs<StringStep>(new StringStep("step 1", "source")));
gherkinEvents.Raise(_ => _.StepEvent += null, this, new EventArgs<StringStep>(new StringStep("step 2", "source")));
gherkinEvents.Raise(_ => _.TableEvent += null, this,
new EventArgs<IList<IList<Token>>>(new List<IList<Token>>
{
new List<Token>
{
new Token("A", new LineInFile(1)),
new Token("B", new LineInFile(1))
},
new List<Token>
{
new Token("1", new LineInFile(2)),
new Token("2", new LineInFile(2))
},
}));
gherkinEvents.Raise(_ => _.EofEvent += null, this, new EventArgs());
Assert.That(scenario.Steps.Count(), Is.EqualTo(2));
Assert.That(scenario.Steps.ToList()[0], Is.TypeOf<StringStep>());
Assert.That(scenario.Steps.ToList()[1], Is.TypeOf<StringTableStep>());
}
示例13: FeaturesAreNotSame
public void FeaturesAreNotSame()
{
var feature1 = new Feature<Point>
{
Geometry = new Point { X = 50.342, Y = -2, SpatialReference = SpatialReference.WGS84 }
};
var feature2 = new Feature<Point>
{
Geometry = new Point { X = 50.342, Y = -30.331, SpatialReference = SpatialReference.WGS84 }
};
var feature3 = new Feature<Point>
{
Geometry = new Point { X = 50.342, Y = -30.331, SpatialReference = SpatialReference.WGS84 }
};
feature3.Attributes.Add("random", "rtcxbvbx");
feature3.Attributes.Add("something", 45445);
var feature4 = new Feature<Point>
{
Geometry = new Point { X = 50.342, Y = -30.331, SpatialReference = SpatialReference.WGS84 }
};
feature4.Attributes.Add("random", "rtcxbvbx");
feature4.Attributes.Add("something", 4);
Assert.NotEqual(feature1, feature2);
Assert.NotEqual(feature3, feature4);
Assert.NotEqual(feature1, feature3);
Assert.NotEqual(feature1, feature4);
Assert.NotEqual(feature2, feature3);
Assert.NotEqual(feature2, feature4);
}
示例14: Main
public static void Main(string[] args)
{
var binaries = new Feature("MyApp Binaries", "Application binaries");
var docs = new Feature("MyApp Documentation");
var tuts = new Feature("MyApp Tutorial");
docs.Add(tuts);
binaries.Add(docs);
var project =
new Project("MyProduct",
new Dir(@"%ProgramFiles%\My Company\My Product",
new File(binaries, @"Files\Bin\MyApp.exe"),
new Dir(@"Docs\Manual",
new File(docs, @"Files\Docs\Manual.txt"),
new File(tuts, @"Files\Docs\Tutorial.txt"))));
project.GUID = new Guid("6f330b47-2577-43ad-9095-1861ba25889b");
project.UI = WUI.WixUI_FeatureTree;
project.DefaultFeature = binaries; //this line is optional
project.PreserveTempFiles = true;
project.BuildMsi();
}
示例15: SetUp
public void SetUp()
{
FlipperActor = MockActor("User:5");
StatsdClient = MockRepository.GenerateStub<IStatsd>();
Instrumenter = new StatsdInstrumenter(StatsdClient);
Feature = new Feature("Name", new MemoryAdapter(), Instrumenter);
}