public void SetupsCanBeCreatedWithFactoryMethod()
        {
            var childSetup = FillerSetup.Create <Child>().OnProperty(x => x.IntValue).Use(42).Result;

            var child = Randomizer <Child> .Create(childSetup);

            Assert.AreEqual(42, child.IntValue);
        }
        public void SetupsCanBeCreatedWithFactoryMethodBasedOnExistingSetupManager()
        {
            var childSetup = FillerSetup.Create <Child>().OnProperty(x => x.IntValue).Use(42).Result;

            childSetup = FillerSetup.Create <Child>(childSetup).OnProperty(x => x.StringValue).Use("Juchu").Result;

            var child = Randomizer <Child> .Create(childSetup);

            Assert.AreEqual(42, child.IntValue);
            Assert.AreEqual("Juchu", child.StringValue);
        }
Exemple #3
0
        public void RandomizerCreatesAListOfItemBasedOnASetup()
        {
            int amount = 5;

            var setup = FillerSetup.Create <Address>().OnType <int>().Use(1).Result;

            IEnumerable <Address> result = Randomizer <Address> .Create(setup, amount);

            Assert.Equal(amount, result.Count());
            Assert.True(result.Count(x => x.HouseNumber == 1) == amount);
        }
        public void GetFillerSetup()
        {
            Filler <Person> filler = new Filler <Person>();

            _fillerSetup = filler.Setup()
                           .OnType <IAddress>().CreateInstanceOf <Address>()
                           .OnProperty(x => x.Age).Use(new IntRange(18, 35))
                           .OnProperty(x => x.FirstName).Use(new RealNames(NameStyle.FirstName))
                           .OnProperty(x => x.LastName).Use(new RealNames(NameStyle.LastName))
                           .SetupFor <Address>()
                           .OnProperty(x => x.HouseNumber).Use(new IntRange(1, 100))
                           .Result;
        }