当前位置: 首页>>代码示例>>C#>>正文


C# Filler.Setup方法代码示例

本文整理汇总了C#中Filler.Setup方法的典型用法代码示例。如果您正苦于以下问题:C# Filler.Setup方法的具体用法?C# Filler.Setup怎么用?C# Filler.Setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Filler的用法示例。


在下文中一共展示了Filler.Setup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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);
			}
		}
开发者ID:GothikX,项目名称:ObjectFiller.NET,代码行数:33,代码来源:EnumTest.cs

示例2: RecursiveFill_WithFunc_Succeeds

        public void RecursiveFill_WithFunc_Succeeds()
        {
            var filler = new Filler<TestParent>();
            filler.Setup().OnProperty(p => p.Child).Use(() => new TestChild());
            var result = filler.Create();

            Assert.NotNull(result.Child);
        }
开发者ID:blmeyers,项目名称:ObjectFiller.NET,代码行数:8,代码来源:ObjectFillerRecursiveTests.cs

示例3: 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);
        }
开发者ID:blmeyers,项目名称:ObjectFiller.NET,代码行数:8,代码来源:ObjectFillerRecursiveTests.cs

示例4: 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);
        }
开发者ID:Tynamix,项目名称:ObjectFiller.NET,代码行数:9,代码来源:TestIgnoranceOfInheritance.cs

示例5: 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);
        }
开发者ID:GothikX,项目名称:ObjectFiller.NET,代码行数:10,代码来源:LibraryFillingTest.cs

示例6: TestFillLibraryWithDictionary

        public void TestFillLibraryWithDictionary()
        {
            Filler<LibraryConstructorDictionary> lib = new Filler<LibraryConstructorDictionary>();
            lib.Setup()
                .OnType<IBook>().CreateInstanceOf<Book>()
                .OnProperty(x => x.Books).IgnoreIt();

            LibraryConstructorDictionary filledLib = lib.Create();
            Assert.NotNull(filledLib.Books);
        }
开发者ID:blmeyers,项目名称:ObjectFiller.NET,代码行数:10,代码来源:LibraryFillingTest.cs

示例7: 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);
        }
开发者ID:jlikens,项目名称:ObjectFiller.NET,代码行数:10,代码来源:SaveFillerSetupTest.cs

示例8: Test_With_France_High_Values_Settings

        public void Test_With_France_High_Values_Settings()
        {
            Filler<Book> book = new Filler<Book>();
            book.Setup()
                .OnProperty(x => x.ISBN).Use(new Lipsum(LipsumFlavor.LeMasque, 20, 50, 100, 250, 500));

            var b = book.Create();

            Assert.IsNotNull(b);
        }
开发者ID:yellowbrickc,项目名称:ObjectFiller.NET,代码行数:10,代码来源:LoremIpsumPluginTest.cs

示例9: IfIgnoreInheritanceIsSetToFalseTheNameOfTheStudentShouldNotBeNull

        public void IfIgnoreInheritanceIsSetToFalseTheNameOfTheStudentShouldNotBeNull()
        {
            Filler<Student> filler = new Filler<Student>();
            filler.Setup()
                .OnType<IAddress>().CreateInstanceOf<Address>();
            var student = filler.Create();

            Assert.NotNull(student.FirstName);
            Assert.NotNull(student.Class);
        }
开发者ID:Tynamix,项目名称:ObjectFiller.NET,代码行数:10,代码来源:TestIgnoranceOfInheritance.cs

示例10: RandomizerCreatesObjectsBasedOnPreviouseSetups

        public void RandomizerCreatesObjectsBasedOnPreviouseSetups()
        {
            int givenValue = Randomizer<int>.Create();

            var childFiller = new Filler<Child>();
            var childSetup = childFiller.Setup().OnProperty(x => x.IntValue).Use(givenValue).Result;
            
            var child = Randomizer<Child>.Create(childSetup);
            Assert.Equal(givenValue, child.IntValue);
        }
开发者ID:blmeyers,项目名称:ObjectFiller.NET,代码行数:10,代码来源:SetupTests.cs

示例11: Test_With_Many_MinWords_And_Many_MinSentences

        public void Test_With_Many_MinWords_And_Many_MinSentences()
        {
            Filler<Book> book = new Filler<Book>();
            book.Setup()
                .OnProperty(x => x.ISBN).Use(new Lipsum(LipsumFlavor.InDerFremde, 3, 9, minWords: 51));

            var b = book.Create();

            Assert.IsNotNull(b);
        }
开发者ID:yellowbrickc,项目名称:ObjectFiller.NET,代码行数:10,代码来源:LoremIpsumPluginTest.cs

示例12: Test_With_German_Default_Settings

        public void Test_With_German_Default_Settings()
        {
            Filler<Book> book = new Filler<Book>();
            book.Setup()
                .OnProperty(x => x.ISBN).Use(new Lipsum(LipsumFlavor.InDerFremde));

            var b = book.Create();

            Assert.IsNotNull(b);
        }
开发者ID:yellowbrickc,项目名称:ObjectFiller.NET,代码行数:10,代码来源:LoremIpsumPluginTest.cs

示例13: WhenGettingDatesBetweenNowAnd31DaysAgo

        public void WhenGettingDatesBetweenNowAnd31DaysAgo()
        {
            Filler<DateRangeTestClass> filler = new Filler<DateRangeTestClass>();

            filler.Setup().OnType<DateTime>().Use(
                new DateTimeRange(DateTime.Now.AddDays(-31)));

            var d = filler.Create(1000);

            Assert.True(d.All(x => x.Date < DateTime.Now && x.Date > DateTime.Now.AddDays(-31)));
        }
开发者ID:blmeyers,项目名称:ObjectFiller.NET,代码行数:11,代码来源:DateTimeRangeTest.cs

示例14: WhenConstructorWithDateTimeNowWillBeCalledNoExceptionShouldBeThrown

        public void WhenConstructorWithDateTimeNowWillBeCalledNoExceptionShouldBeThrown()
        {
            Filler<DateRangeTestClass> filler = new Filler<DateRangeTestClass>();

            filler.Setup().OnProperty(x => x.Date).Use(new DateTimeRange(DateTime.Now));

            var dateTime = filler.Create();

            Assert.True(dateTime.Date > DateTime.MinValue);
            Assert.True(dateTime.Date < DateTime.MaxValue);
        }
开发者ID:blmeyers,项目名称:ObjectFiller.NET,代码行数:11,代码来源:DateTimeRangeTest.cs

示例15: WhenStartDateIsBiggerThenEndDateTheDatesShouldBeSwitched

        public void WhenStartDateIsBiggerThenEndDateTheDatesShouldBeSwitched()
        {
            Filler<DateRangeTestClass> filler = new Filler<DateRangeTestClass>();

            filler.Setup().OnType<DateTime>().Use(
                new DateTimeRange(DateTime.Now, DateTime.Now.AddDays(-31)));

            var d = filler.Create(1000);

            Assert.True(d.All(x => x.Date < DateTime.Now && x.Date > DateTime.Now.AddDays(-31)));
        }
开发者ID:blmeyers,项目名称:ObjectFiller.NET,代码行数:11,代码来源:DateTimeRangeTest.cs


注:本文中的Filler.Setup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。