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);
        }
Esempio n. 2
0
		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);
			}
		}
        public void WhenClassWithCopyConstructorIsCreatedNoExceptionShallBeThrown()
        {
            var f = new Filler<ClassWithCopyConstructorAndNormalConstructor>();
            var cc = f.Create();

            Assert.NotNull(cc);
        }
        public void RecursiveFill_WithIgnoredProperties_Succeeds()
        {
            var filler = new Filler<TestParent>();
            filler.Setup().OnProperty(p => p.Child).IgnoreIt();
            var result = filler.Create();

            Assert.NotNull(result);
        }
        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));
        }
        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());
        }
Esempio n. 7
0
 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);
 }
        public void IfIgnoreInheritanceIsSetToTrueTheNameOfTheStudentShouldBeNull()
        {
            Filler<Student> filler = new Filler<Student>();
            filler.Setup().IgnoreInheritance();
            var student = filler.Create();

            Assert.Null(student.FirstName);
            Assert.NotNull(student.Class);
        }
        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));
        }
        public void AHashsetShouldBeGenerated()
        {
            Filler<HashSet<string>> filler = new Filler<HashSet<string>>();

            var hashset = filler.Create();

            Assert.NotNull(hashset);
            Assert.True(hashset.Any());
        }
        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);
        }
        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);
        }
        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);
        }
 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);
     }
 }
        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);
        }
Esempio n. 16
0
        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);
        }
        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);
        }
        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);
        }
        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);
        }
        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);
        }
        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)));
        }
        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)));
        }
        public void FillAllAddressProperties()
        {
            Filler<Address> addressFiller = new Filler<Address>();
            Address a = addressFiller.Create();

            Assert.IsNotNull(a.City);
            Assert.IsNotNull(a.Country);
            Assert.AreNotEqual(0, a.HouseNumber);
            Assert.IsNotNull(a.PostalCode);
            Assert.IsNotNull(a.Street);
        }
        public void TestFillLibraryWithListOfIBooks()
        {
            Filler<LibraryConstructorList> lib = new Filler<LibraryConstructorList>();
            lib.Setup()
                .OnProperty(x => x.Books).IgnoreIt()
                .OnType<IBook>().CreateInstanceOf<Book>();

            LibraryConstructorList filledLib = lib.Create();

            Assert.IsNotNull(filledLib.Books);
        }
Esempio n. 25
0
 public void Clone()
 {
     var pFiller = new Filler<Constraint>();
     var test = pFiller.Create();
     var clone = test.Clone();
     var config = new ComparisonConfig();
     config.MembersToIgnore.Add("Table"); //table should never be cloned
     var compareLogic = new CompareLogic(config);
     var result = compareLogic.Compare(test, clone);
     Assert.True(result.AreEqual, result.DifferencesString);
 }
        public void Must_be_able_to_handle_arrays()
        {
            var filler = new Filler<WithArrays>();

            //.For<int[]>();
            var obj = filler.Create();

            Assert.IsNotNull(obj.Ints);
            Assert.IsNotNull(obj.Strings);
            Assert.IsNotNull(obj.Interfaces);
        }
        public void Test_With_English_Min_Values_Settings()
        {
            Filler<Book> book = new Filler<Book>();
            book.Setup()
                .OnProperty(x => x.ISBN).Use(new Lipsum(LipsumFlavor.ChildHarold, 1, 1, 1, 1, 1));

            var b = book.Create();

            b.ISBN = b.ISBN.Replace("\r\n\r\n", string.Empty);
            Assert.IsNotNull(b);
            Assert.AreEqual(1, b.ISBN.Split('\n').Length);
        }
        public PersonSelectionDesignViewModel()
        {
            var filler = new Filler<Person>();

            filler.Setup()
                    .OnProperty(x => x.FirstName)
                    .Use(new RealNames(NameStyle.FirstName))
                    .OnProperty(x => x.LastName)
                    .Use(new RealNames(NameStyle.LastName));

            this.AvailablePersons = filler.Create(5);
        }
Esempio n. 29
0
        public void ExplicitSetupShallJustFillPropertiesWhichAreSetUpAndNoInstanceShallCreateForSubTypesIfNotSetup()
        {
            Filler<Parent> filler = new Filler<Parent>();
            filler.Setup(true)
               .OnProperty(x => x.SomeId).Use(new IntRange(1, 20));

            var parent = filler.Create();

            Assert.NotNull(parent);
            Assert.Null(parent.Child);
            Assert.NotNull(parent.SomeId);
        }
        public void TestRealNameFirstNameOnly()
        {
            Filler<LibraryFillingTest.Person> filler = new Filler<LibraryFillingTest.Person>();
            filler.Setup()
                .OnProperty(x => x.Name).Use(new RealNames(RealNameStyle.FirstNameOnly));

            LibraryFillingTest.Person p = filler.Create();

            Assert.IsNotNull(p);
            Assert.IsNotNull(p.Name);
            Assert.IsFalse(p.Name.Contains(" "));
        }
Esempio n. 31
0
        public void Test_With_English_Min_Values_Settings()
        {
            Filler <Book> book = new Filler <Book>();

            book.Setup()
            .OnProperty(x => x.ISBN).Use(new Lipsum(LipsumFlavor.ChildHarold, 1, 1, 1, 1, 1));

            var b = book.Create();

            b.ISBN = b.ISBN.Replace("\r\n\r\n", string.Empty);
            Assert.IsNotNull(b);
            Assert.AreEqual(1, b.ISBN.Split('\n').Length);
        }
Esempio n. 32
0
        public void TestIntRangePlugin()
        {
            var filler = new Filler <CollectionizerPoco>();

            filler.Setup()
            .OnProperty(x => x.IntRange)
            .Use(new Collectionizer <int, IntRange>(new IntRange(10, 15), 3, 10));

            var collection = filler.Create();

            Assert.True(collection.IntRange.Count >= 3 && collection.IntRange.Count() <= 10);
            Assert.True(collection.IntRange.All(x => x >= 10 && x <= 15));
        }
Esempio n. 33
0
        public void GenerateTestDataForASortedList()
        {
            Filler <SortedList <int, string> > filler = new Filler <SortedList <int, string> >();

            filler.Setup().OnType <int>().Use(Enumerable.Range(1, 1000));
            var result = filler.Create(10).ToList();

            Assert.AreEqual(10, result.Count);
            foreach (var sortedList in result)
            {
                Assert.IsTrue(sortedList.Any());
            }
        }
        public void Must_be_able_to_handle_arrays()
        {
            var filler = new Filler <WithArrays>();

            //.For<int[]>();
            var obj = filler.Create();

            Assert.NotNull(obj.Ints);
            Assert.NotNull(obj.Strings);
            Assert.NotNull(obj.JaggedStrings);
            Assert.NotNull(obj.ThreeJaggedDimensional);
            Assert.NotNull(obj.ThreeJaggedPoco);
        }
        public void FluentTest()
        {
            Filler <Person> pFiller = new Filler <Person>();

            pFiller.Setup()
            .OnProperty(x => x.Age).Use(() => 18)
            .OnType <IAddress>().CreateInstanceOf <Address>();

            Person p = pFiller.Create();

            Assert.IsNotNull(p);
            Assert.AreEqual(18, p.Age);
        }
Esempio n. 36
0
        public void Clone()
        {
            var pFiller = new Filler <Column>();

            pFiller.Setup()
            .OnType <Identity>().Use(() => new 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);
        }
Esempio n. 37
0
        public void CloneNewName()
        {
            var pFiller      = new Filler <Column>();
            var test         = pFiller.Create();
            var clone        = test.Clone(true);
            var compareLogic = new CompareLogic();

            compareLogic.Config.MembersToIgnore.Add("Name");
            var result = compareLogic.Compare(test, clone);

            Assert.True(result.AreEqual, result.DifferencesString);
            Assert.NotEqual(test.Default.Name, clone.Default.Name);
        }
Esempio n. 38
0
        public void TestMnemonicStringPlugin()
        {
            var filler = new Filler <CollectionizerPoco>();

            filler.Setup()
            .OnProperty(x => x.MnemonicStrings)
            .Use(new Collectionizer <string, MnemonicString>(new MnemonicString(1, 20, 25), 3, 10));

            var collection = filler.Create();

            Assert.True(collection.MnemonicStrings.Count() >= 3 && collection.MnemonicStrings.Count() <= 10);
            Assert.True(collection.MnemonicStrings.All(x => x.Length >= 20 && x.Length <= 25));
        }
        public void TestNameListStringRandomizer()
        {
            Filler <Person> pFiller = new Filler <Person>();

            pFiller.Setup().OnType <IAddress>().CreateInstanceOf <Address>()
            .OnProperty(p => p.FirstName).Use(new RealNames(NameStyle.FirstName))
            .OnProperty(p => p.LastName).Use(new RealNames(NameStyle.LastName));

            Person filledPerson = pFiller.Create();

            Assert.IsNotNull(filledPerson.FirstName);
            Assert.IsNotNull(filledPerson.LastName);
        }
        public void TestRealNameFirstNameOnly()
        {
            Filler <LibraryFillingTest.Person> filler = new Filler <LibraryFillingTest.Person>();

            filler.Setup()
            .OnProperty(x => x.Name).Use(new RealNames(NameStyle.FirstName));

            LibraryFillingTest.Person p = filler.Create();

            Assert.NotNull(p);
            Assert.NotNull(p.Name);
            Assert.False(p.Name.Contains(" "));
        }
Esempio n. 41
0
        public void Clone()
        {
            var pFiller = new Filler <Constraint>();
            var test    = pFiller.Create();
            var clone   = test.Clone();
            var config  = new ComparisonConfig();

            config.MembersToIgnore.Add("Table"); //table should never be cloned
            var compareLogic = new CompareLogic(config);
            var result       = compareLogic.Compare(test, clone);

            Assert.True(result.AreEqual, result.DifferencesString);
        }
Esempio n. 42
0
        public void TestCityNames()
        {
            var filler = new Filler <CollectionizerPoco>();

            filler.Setup()
            .OnProperty(x => x.ArrayList)
            .Use(new Collectionizer <string, MnemonicString>(new MnemonicString(1, 20, 25), 3, 10));

            var arrayList = filler.Create();

            Assert.True(arrayList.ArrayList.Count >= 3 && arrayList.ArrayList.Count <= 10);
            Assert.True(arrayList.ArrayList.ToArray().Cast <string>().All(x => x.Length >= 20 && x.Length <= 25));
        }
Esempio n. 43
0
        public void TestFillLibraryWithSimpleTypes()
        {
            Filler <LibraryConstructorWithSimple> lib = new Filler <LibraryConstructorWithSimple>();

            lib.Setup()
            .OnProperty(x => x.Books).IgnoreIt();
            LibraryConstructorWithSimple filledLib = lib.Create();

            Assert.IsNull(filledLib.Books);
            Assert.IsNotNull(filledLib);
            Assert.IsNotNull(filledLib.City);
            Assert.IsNotNull(filledLib.Name);
        }
Esempio n. 44
0
        private Entity[] GetArray()
        {
            Filler <Entity> of = new Filler <Entity>();

            List <Entity> entities = new List <Entity>();

            entities.Add(of.Create());
            entities.Add(of.Create());
            entities.Add(of.Create());
            entities.Add(of.Create());
            entities.Add(of.Create());
            entities.Add(of.Create());
            entities.Add(of.Create());
            entities.Add(of.Create());
            entities.Add(of.Create());


            return(entities.ToArray());
        }
Esempio n. 45
0
        public void TestIgnoreAllOfComplexType()
        {
            Filler <Person> pFiller = new Filler <Person>();

            pFiller.Setup()
            .OnType <IAddress>().CreateInstanceOf <Address>()
            .OnType <Address>().IgnoreIt()
            .OnType <IAddress>().IgnoreIt();

            Person p = pFiller.Create();

            Assert.NotNull(p);
            Assert.Null(p.Address);
        }
Esempio n. 46
0
        public void TestFillPerson()
        {
            Filler <Person> pFiller = new Filler <Person>();

            pFiller.Setup()
            .OnType <IAddress>().CreateInstanceOf <Address>();

            Person filledPerson = pFiller.Create();

            Assert.NotNull(filledPerson.Address);
            Assert.NotNull(filledPerson.Addresses);
            Assert.NotNull(filledPerson.StringToIAddress);
            Assert.NotNull(filledPerson.SureNames);
        }
Esempio n. 47
0
        public void TestSetupForTypeWithoutOverrideSettings()
        {
            Filler <Person> pFiller = new Filler <Person>();

            pFiller.Setup()
            .OnType <IAddress>().CreateInstanceOf <Address>()
            .OnType <int>().Use(() => 1)
            .SetupFor <Address>();

            Person p = pFiller.Create();

            Assert.Equal(1, p.Age);
            Assert.Equal(1, p.Address.HouseNumber);
        }
        public void TestFillLibraryWithDictionaryAndPoco()
        {
            Filler <LibraryConstructorDictionary> lib = new Filler <LibraryConstructorDictionary>();

            lib.Setup()
            .OnProperty(x => x.Books).IgnoreIt()
            .OnProperty(x => x.Name).IgnoreIt();


            LibraryConstructorDictionary filledLib = lib.Create();

            Assert.NotNull(filledLib.Books);
            Assert.NotNull(filledLib.Name);
        }
Esempio n. 49
0
        public void RegExMatchingStringGenerationTest()
        {
            var assertRegEx = @"^([a-z0-9\.\-]+)@([a-z0-9\-]+)((\.([a-z]){2,3})+)$";

            var testPersonFiller = new Filler <TestPersonModel>();

            testPersonFiller.Setup()
            .OnProperty(t => t.Email).Use(new ReverseRegEx(assertRegEx));

            var result = testPersonFiller.Create(1000);

            result.Should().HaveCount(1000);
            result.Should().OnlyContain(t => Regex.IsMatch(t.Email, assertRegEx));
        }
        public void TestFillLibraryWithConfiguredPocoOfABook()
        {
            Filler <LibraryConstructorPoco> lib = new Filler <LibraryConstructorPoco>();

            lib.Setup()
            .OnProperty(x => x.Books).IgnoreIt()
            .SetupFor <Book>()
            .OnProperty(x => x.Name).Use(() => "ABook");


            var l = lib.Create();

            Assert.Equal("ABook", ((Book)l.Books.ToList()[0]).Name);
        }
Esempio n. 51
0
        public void TestRealNameLastNameFirstName()
        {
            Filler <LibraryFillingTest.Person> filler = new Filler <LibraryFillingTest.Person>();

            filler.Setup()
            .OnProperty(x => x.Name).Use(new RealNames(NameStyle.LastNameFirstName));

            LibraryFillingTest.Person p = filler.Create();

            Assert.IsNotNull(p);
            Assert.IsNotNull(p.Name);
            Assert.IsTrue(p.Name.Contains(" "));
            Assert.AreEqual(2, p.Name.Split(' ').Length);
        }
Esempio n. 52
0
        public async Task WhenExportCalled_GeneratesExcelFile()
        {
            var sut    = CreateSut(out var repository);
            var filler = new Filler <SentinelEntry>();

            repository.ListAsync(Arg.Any <SentinelEntriesIncludingTestsSpecification>())
            .Returns(Task.FromResult((IReadOnlyList <SentinelEntry>)filler.Create(10)));

            var action = await sut.DownloadExcel().ConfigureAwait(true);

            var fileResult = action.Should().BeOfType <FileContentResult>().Subject;

            fileResult.ContentType.Should().Be("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
        }
        public void WhenStartDateAndEndDateIsSetItShouldFindOnlyDatesInBetweenThisTwoDates()
        {
            var startDate = new DateTime(2000, 11, 10);
            var endDate   = new DateTime(2006, 1, 30);

            Filler <DateRangeTestClass> filler = new Filler <DateRangeTestClass>();

            filler.Setup().OnType <DateTime>().Use(new DateTimeRange(startDate, endDate));

            var d = filler.Create(1000);

            d.ToList().ForEach(x => Console.WriteLine(x.Date));
            Assert.IsTrue(d.All(x => x.Date <endDate && x.Date> startDate));
        }
        public void UseSavedFillerSetupWithExtensions()
        {
            var             dateNow = DateTime.Now;
            Filler <Person> filler  = new Filler <Person>();

            filler.Setup(GetFillerSetup())
            .OnProperty(x => x.Birthdate).Use(() => dateNow);

            Person p = filler.Create();

            Assert.IsTrue(p.Age < 35 && p.Age >= 18);
            Assert.IsTrue(p.Address.HouseNumber < 100 && p.Age >= 1);
            Assert.AreEqual(p.Birthdate, dateNow);
        }
Esempio n. 55
0
        public void SetupCityAndCountryPropertyWithConstantValue()
        {
            Filler <Address> addressFiller = new Filler <Address>();

            addressFiller.Setup()
            .OnProperty(ad => ad.City, ad => ad.Country).Use(() => "CityCountry");
            Address a = addressFiller.Create();

            Assert.Equal("CityCountry", a.City);
            Assert.NotNull(a.Country);
            Assert.NotEqual(0, a.HouseNumber);
            Assert.NotNull(a.PostalCode);
            Assert.NotNull(a.Street);
        }
Esempio n. 56
0
        public void IgnoreCountryAndCity()
        {
            Filler <Address> addressFiller = new Filler <Address>();

            addressFiller.Setup()
            .OnProperty(x => x.Country, x => x.City).IgnoreIt();
            Address a = addressFiller.Create();

            Assert.Null(a.City);
            Assert.Null(a.Country);
            Assert.NotEqual(0, a.HouseNumber);
            Assert.NotNull(a.PostalCode);
            Assert.NotNull(a.Street);
        }
        public void TestIgnoreAllUnknownTypesWithOutException()
        {
            Filler <EntityCollection> filler = new Filler <EntityCollection>();

            filler.Setup().IgnoreAllUnknownTypes();
            var entity = filler.Create();

            Assert.IsNull(entity.EntityArray);
            Assert.IsNotNull(entity);
            Assert.IsNotNull(entity.EntityList);
            Assert.IsNotNull(entity.EntityICollection);
            Assert.IsNotNull(entity.EntityIEnumerable);
            Assert.IsNotNull(entity.EntityIList);
        }
        public void TestFillLibraryWithListOfBooks()
        {
            Filler <LibraryConstructorList> lib = new Filler <LibraryConstructorList>();

            lib.Setup()
            .OnProperty(x => x.Books).IgnoreIt()
            .OnProperty(x => x.Name).IgnoreIt();

            LibraryConstructorList filledLib = lib.Create();

            Assert.NotNull(filledLib);
            Assert.NotNull(filledLib.Books);
            Assert.NotNull(filledLib.Name);
        }
Esempio n. 59
0
        public async Task WhenProtectKeyIsNegative_QueriesAllEntries()
        {
            var sut            = CreateSut(out var repository, out var userService);
            var expectedResult = _filler.Create(2);

            repository.ListAllAsync()
            .Returns(Task.FromResult((IReadOnlyList <RemoteAccount>)expectedResult));

            var action = await sut.HandleAsync().ConfigureAwait(true);

            action.Result.Should().BeOfType <OkObjectResult>();
            action.Result.As <OkObjectResult>().Value.Should().Be(expectedResult);
            await userService.Received(1).GetRolesViaGraphApi(expectedResult).ConfigureAwait(true);
        }
        public void UseSavedFillerSetupWithOverrides()
        {
            Filler <Person> filler = new Filler <Person>();

            filler.Setup(GetFillerSetup())
            .OnProperty(x => x.Age).Use(() => 1000)
            .SetupFor <Address>()
            .OnProperty(x => x.HouseNumber).Use(() => 9999);

            Person p = filler.Create();

            Assert.AreEqual(p.Age, 1000);
            Assert.AreEqual(p.Address.HouseNumber, 9999);
        }