本文整理汇总了C#中DummyClass类的典型用法代码示例。如果您正苦于以下问题:C# DummyClass类的具体用法?C# DummyClass怎么用?C# DummyClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DummyClass类属于命名空间,在下文中一共展示了DummyClass类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EndMemberAssignsInstanceToParentProperty
public void EndMemberAssignsInstanceToParentProperty()
{
var state = new StackingLinkedList<Level>();
var dummyClass = new DummyClass();
var xamlType = WiringContext.TypeContext.GetXamlType(dummyClass.GetType());
state.Push(
new Level
{
Instance = dummyClass,
XamlMember = xamlType.GetMember("Child"),
});
var childClass = new ChildClass();
state.Push(
new Level
{
XamlType = xamlType,
Instance = childClass,
});
var sut = new ObjectAssembler(state, WiringContext, new TopDownValueContext());
sut.Process(X.EndObject());
Assert.AreEqual(1, state.Count);
var expectedInstance = state.CurrentValue.Instance;
Assert.AreSame(expectedInstance, dummyClass);
Assert.AreSame(((DummyClass)expectedInstance).Child, childClass);
}
示例2: Translate
public static string Translate(this string translate, string defaultValue = "*NO TRANSLATION*")
{
var bundleClass = new DummyClass ().Class;
var languageBundle = NSBundle.FromClass (bundleClass);
var translatedString = languageBundle.LocalizedString(translate, defaultValue, "GMImagePicker");
return translatedString;
}
示例3: SetUp
public void SetUp()
{
_dummyClass = new DummyClass();
_dummyClass.PrivateField = _fooValue;
_eventSink = new EventSink();
_invoker = new NuGenInvoker(_dummyClass);
}
示例4: HasFieldsNotEqualToThoseIsObsoleteButWorks
public void HasFieldsNotEqualToThoseIsObsoleteButWorks()
{
var x = new DummyClass();
Check.That(x).HasFieldsNotEqualToThose(new DummyClass(1, 2));
// check with missing fields
Check.That(new DummyClass()).HasFieldsNotEqualToThose(new DummyHeritance(1,2));
}
示例5: HasNotFieldsWithSameValuesWorks
public void HasNotFieldsWithSameValuesWorks()
{
var x = new DummyClass();
Check.That(x).HasNotFieldsWithSameValues(new DummyClass(1, 2));
// check with missing fields
Check.That(new DummyClass()).HasNotFieldsWithSameValues(new DummyHeritance(1,2));
}
示例6: FormValueModelBinding_Enabled
public IActionResult FormValueModelBinding_Enabled(DummyClass dc)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
return Ok("Data:" + dc?.SampleInt);
}
示例7: Setup
public override void Setup()
{
base.Setup();
dummyClass = new DummyClass { Value = 1, Reference = "2" };
dummyStruct = new DummyStruct { Value = 3, Reference = "4" };
classValueWrapper = ReflectionUtility.CreateFieldWrapper(typeof(DummyClass).GetField("Value"));
classReferenceWrapper = ReflectionUtility.CreateFieldWrapper(typeof(DummyClass).GetField("Reference"));
structValueWrapper = ReflectionUtility.CreateFieldWrapper(typeof(DummyStruct).GetField("Value"));
structReferenceWrapper = ReflectionUtility.CreateFieldWrapper(typeof(DummyStruct).GetField("Reference"));
}
示例8: IsEqualFailsIfFieldsDifferent
public void IsEqualFailsIfFieldsDifferent()
{
var x = new DummyClass();
Check.ThatCode(() =>
{
Check.That(x).HasFieldsWithSameValues(new DummyClass(1, 2));
})
.Throws<FluentCheckException>()
.WithMessage(Environment.NewLine+ "The checked value's field 'x' does not have the expected value." + Environment.NewLine + "The checked value:" + Environment.NewLine + "\t[2]" + Environment.NewLine + "The expected value:" + Environment.NewLine + "\t[1]");
}
示例9: XmlSerializer_CachesSerializerForType
public void XmlSerializer_CachesSerializerForType()
{
// Arrange
var input = new DummyClass { SampleInt = 10 };
var formatter = new TestXmlSerializerOutputFormatter();
var context = GetOutputFormatterContext(input, typeof(DummyClass));
// Act
formatter.CanWriteResult(context, MediaTypeHeaderValue.Parse("application/xml"));
formatter.CanWriteResult(context, MediaTypeHeaderValue.Parse("application/xml"));
// Assert
Assert.Equal(1, formatter.createSerializerCalledCount);
}
示例10: LoadWithRootInstance
public void LoadWithRootInstance()
{
var dummy = new DummyClass
{
AnotherProperty = "Other value",
SampleProperty = "Will be overwritten"
};
var loader = new XamlXmlLoader(new ObjectAssembler(WiringContext, new ObjectAssemblerSettings { RootInstance = dummy }), WiringContext);
var actual = loader.Load("<DummyClass xmlns=\"root\" SampleProperty=\"Value\" />");
Assert.IsInstanceOfType(actual, dummy.GetType());
Assert.AreEqual(((DummyClass)actual).SampleProperty, "Value");
Assert.AreEqual(((DummyClass)actual).AnotherProperty, "Other value");
}
示例11: LoadWithRootInstance
public void LoadWithRootInstance()
{
var dummy = new DummyClass
{
AnotherProperty = "Other value",
SampleProperty = "Will be overwritten"
};
var loader = new XmlLoader(new DummyParserFactory(RuntimeTypeSource));
var actual = loader.FromString("<DummyClass xmlns=\"root\" SampleProperty=\"Value\" />", dummy);
Assert.IsType(dummy.GetType(), actual);
Assert.Equal("Value", ((DummyClass)actual).SampleProperty);
Assert.Equal("Other value", ((DummyClass)actual).AnotherProperty);
}
示例12: LoadWithRootInstance
public void LoadWithRootInstance()
{
var dummy = new DummyClass
{
AnotherProperty = "Other value",
SampleProperty = "Will be overwritten"
};
var loader = new XamlLoader(new DummyXamlParserFactory(WiringContext));
var actual = loader.Load("<DummyClass xmlns=\"root\" SampleProperty=\"Value\" />", dummy);
Assert.IsInstanceOfType(actual, dummy.GetType());
Assert.AreEqual("Value", ((DummyClass)actual).SampleProperty);
Assert.AreEqual("Other value", ((DummyClass)actual).AnotherProperty);
}
示例13: GetAllPropertiesTest
public void GetAllPropertiesTest()
{
DummyClass dummyClass = new DummyClass();
PropertyInfo[] properties = EntitiyUtilities.GetAllProperties(dummyClass);
Assert.AreEqual(3, properties.Count(), "The number of properties did not equal the expected amount.");
bool isIntPropertyThere = properties.Any(i => i.Name == "SomeNumber");
Assert.IsTrue(isIntPropertyThere, "The value property (int) was not handled correctly.");
bool isStringPropertyThere = properties.Any(i => i.Name == "SomeString");
Assert.IsTrue(isStringPropertyThere, "The reference property (string) was not handled correctly.");
bool isComplexPropertyThere = properties.Any(i => i.Name == "SomeComplex");
Assert.IsTrue(isComplexPropertyThere, "The complex property (List<int>) was not handled correctly.");
}
示例14: GivenConfiguredInstance_StartMemberSetsTheMember
public void GivenConfiguredInstance_StartMemberSetsTheMember()
{
var state = new StackingLinkedList<Level>();
var dummyClass = new DummyClass();
state.Push(
new Level
{
Instance = dummyClass,
});
var xamlMember = WiringContext.TypeContext.GetXamlType(dummyClass.GetType()).GetMember("Items");
var sut = new ObjectAssembler(state, WiringContext, new TopDownValueContext());
sut.Process(X.StartMember<DummyClass>(d => d.Items));
Assert.AreEqual(1, state.Count);
Assert.AreEqual(state.CurrentValue.XamlMember, xamlMember);
}
示例15: GenerateExpectedDummyObject
public static List<DummyClass> GenerateExpectedDummyObject(int rows)
{
var rtnVal = new List<DummyClass>();
for (var i = 1; i < rows + 1; i++)
{
var row = new DummyClass
{
PropertyInt = i,
PropertyBool = (i % 2) == 1,
PropertyLong = i,
PropertyString = i.ToString(CultureInfo.InvariantCulture),
PropertyFloat = i + 0.01F,
PropertyDouble = i + 0.01D
};
rtnVal.Add(row);
}
return rtnVal;
}