本文整理汇总了C#中Filler.Create方法的典型用法代码示例。如果您正苦于以下问题:C# Filler.Create方法的具体用法?C# Filler.Create怎么用?C# Filler.Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Filler
的用法示例。
在下文中一共展示了Filler.Create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test_With_LoremIpsum_Seed_Settings
public void Test_With_LoremIpsum_Seed_Settings()
{
Filler<Book> book = new Filler<Book>();
book.Setup()
.OnProperty(x => x.ISBN).Use(new Lipsum(LipsumFlavor.LoremIpsum, seed: 1234));
var b = book.Create();
var b1 = book.Create();
Assert.IsNotNull(b);
Assert.IsNotNull(b1);
Assert.AreEqual(b.ISBN, b1.ISBN);
}
示例2: Must_support_enums_out_of_the_box
public void Must_support_enums_out_of_the_box()
{
var filler = new Filler<MyClass>();
filler.Setup()
.OnProperty(x => x.Manual).Use(() => ManualSetupEnum.B)
.OnProperty(x => x.Ignored).IgnoreIt();
for (int n = 0; n < 1000; n++)
{
var c = filler.Create();
Assert.IsTrue(
c.Standard == StandardEnum.A ||
c.Standard == StandardEnum.B ||
c.Standard == StandardEnum.C);
Assert.IsTrue(
c.Numbered == NumberedEnum.A ||
c.Numbered == NumberedEnum.B ||
c.Numbered == NumberedEnum.C);
Assert.IsTrue(
c.Flags == FlagsEnum.A ||
c.Flags == FlagsEnum.B ||
c.Flags == FlagsEnum.C);
Assert.IsTrue((int)c.Nasty == 0);
Assert.IsTrue(c.Manual == ManualSetupEnum.B);
Assert.IsTrue((int)c.Ignored == 0);
}
}
示例3: WhenClassWithCopyConstructorIsCreatedNoExceptionShallBeThrown
public void WhenClassWithCopyConstructorIsCreatedNoExceptionShallBeThrown()
{
var f = new Filler<ClassWithCopyConstructorAndNormalConstructor>();
var cc = f.Create();
Assert.NotNull(cc);
}
示例4: Ensure_that_double_does_not_return_infinity
public void Ensure_that_double_does_not_return_infinity()
{
var filler = new Filler<MyClass>();
var myClass = filler.Create();
Assert.False(double.IsInfinity(myClass._double));
Assert.False(float.IsInfinity(myClass._float));
}
示例5: RecursiveFill_WithIgnoredProperties_Succeeds
public void RecursiveFill_WithIgnoredProperties_Succeeds()
{
var filler = new Filler<TestParent>();
filler.Setup().OnProperty(p => p.Child).IgnoreIt();
var result = filler.Create();
Assert.NotNull(result);
}
示例6: CreateMultipleInstances
public void CreateMultipleInstances()
{
Filler<LibraryFillingTest.Person> filler = new Filler<LibraryFillingTest.Person>();
IEnumerable<LibraryFillingTest.Person> pList = filler.Create(10);
Assert.NotNull(pList);
Assert.Equal(10, pList.Count());
}
示例7: ParentShallGetFilledWithourError
public void ParentShallGetFilledWithourError()
{
Filler<Parent> filler = new Filler<Parent>();
var filledObject = filler.Create();
Assert.NotNull(filledObject);
Assert.NotNull(filledObject.MakeTheError);
Assert.False(string.IsNullOrWhiteSpace(filledObject.Child.MakeTheError));
}
示例8: AHashsetShouldBeGenerated
public void AHashsetShouldBeGenerated()
{
Filler<HashSet<string>> filler = new Filler<HashSet<string>>();
var hashset = filler.Create();
Assert.NotNull(hashset);
Assert.True(hashset.Any());
}
示例9: IfIgnoreInheritanceIsSetToTrueTheNameOfTheStudentShouldBeNull
public void IfIgnoreInheritanceIsSetToTrueTheNameOfTheStudentShouldBeNull()
{
Filler<Student> filler = new Filler<Student>();
filler.Setup().IgnoreInheritance();
var student = filler.Create();
Assert.Null(student.FirstName);
Assert.NotNull(student.Class);
}
示例10: Clone
public void Clone()
{
var pFiller = new Filler<Identity>();
var test = pFiller.Create();
var clone = test.Clone();
var compareLogic = new CompareLogic();
var result = compareLogic.Compare(test, clone);
Assert.True(result.AreEqual, result.DifferencesString);
}
示例11: Must_be_able_to_handle_inheritance_and_sealed
public void Must_be_able_to_handle_inheritance_and_sealed()
{
var filler = new Filler<InheritedClass>();
var obj = filler.Create();
Assert.NotEqual(0, obj.NormalNumber);
Assert.NotEqual(0, obj.OverrideNormalNumber);
Assert.NotEqual(0, obj.SealedOverrideNormalNumber);
}
示例12: UseSavedFillerDefaultSetup
public void UseSavedFillerDefaultSetup()
{
Filler<Person> filler = new Filler<Person>();
filler.Setup(_fillerSetup);
Person p = filler.Create();
Assert.IsTrue(p.Age < 35 && p.Age >= 18);
Assert.IsTrue(p.Address.HouseNumber < 100 && p.Age >= 1);
}
示例13: FillNullableEnum
public void FillNullableEnum()
{
var filler = new Filler<ClassWithNullableEnum>();
var c = filler.Create();
Assert.IsTrue(
c.NullableEnum == StandardEnum.A ||
c.NullableEnum == StandardEnum.B ||
c.NullableEnum == StandardEnum.C);
}
示例14: Ensure_that_each_primitive_datatype_is_mapped_by_default
public void Ensure_that_each_primitive_datatype_is_mapped_by_default()
{
var filler = new Filler<MyClass>();
var myClasses = filler.Create(100).ToArray();
foreach (var myClass in myClasses)
{
Assert.NotEqual(default(Guid), myClass._Guid);
Assert.NotEqual(default(decimal), myClass._Decimal);
}
}
示例15: TestFillLibraryWithPocoOfABook
public void TestFillLibraryWithPocoOfABook()
{
Filler<LibraryConstructorPoco> lib = new Filler<LibraryConstructorPoco>();
lib.Setup()
.OnProperty(x => x.Books).IgnoreIt();
LibraryConstructorPoco filledLib = lib.Create();
Assert.IsNotNull(filledLib.Books);
Assert.AreEqual(1, filledLib.Books.Count);
}