public void Demonstrating()
 {
     var repository = new DomainGenerator().With(0, 42).With<SomethingtoGenerate>();
     var something = new SomethingtoGenerate {MyProperty = 0};
     repository.ModifyThis(something).Change(s => s.MyProperty);
     5.Times(() => Assert.Equal(42, something.MyProperty));
 }
Exemple #2
0
        public void NoChangePossible_Throws()
        {
            var repository = new DomainGenerator().With(true);

            var something = repository.One <WithBoolProperty>();

            Assert.Throws <HeyITriedFiftyTimesButCouldNotGetADifferentValue>(
                () => repository.ModifyThis(something).Change(e => e.MyPropery));
        }
        public void Demonstrating()
        {
            var repository = new DomainGenerator().With(0, 42).With <SomethingtoGenerate>();
            var something  = new SomethingtoGenerate {
                MyProperty = 0
            };

            repository.ModifyThis(something).Change(s => s.MyProperty);
            5.Times(() => Assert.Equal(42, something.MyProperty));
        }
        public void Reusing_InnerGenerators()
        {
            var repository =
                new DomainGenerator()
                    .With(666)
                    .With<SomethingtoGenerate>(g => g.For(s => s.MyProperty, 42));

            var something = new SomethingtoGenerate { MyProperty = 0 };
            repository.ModifyThis(something).Change(s => s.MyProperty);
            Assert.Equal(42, something.MyProperty);
        }
        public void ReusingConventions()
        {
            var repository =
                new DomainGenerator()
                    .With(mi => true, () => new[] {0, 42}.PickOne())
                    .With<SomethingtoGenerate>();

            var something = new SomethingtoGenerate { MyProperty = 0 };
            repository.ModifyThis(something).Change(s => s.MyProperty);
            Assert.Equal(42, something.MyProperty);
        }
        public void ReusingConventions()
        {
            var repository =
                new DomainGenerator()
                .With(mi => true, () => new[] { 0, 42 }.PickOne())
                .With <SomethingtoGenerate>();

            var something = new SomethingtoGenerate {
                MyProperty = 0
            };

            repository.ModifyThis(something).Change(s => s.MyProperty);
            Assert.Equal(42, something.MyProperty);
        }
        public void Reusing_InnerGenerators()
        {
            var repository =
                new DomainGenerator()
                .With(666)
                .With <SomethingtoGenerate>(g => g.For(s => s.MyProperty, 42));

            var something = new SomethingtoGenerate {
                MyProperty = 0
            };

            repository.ModifyThis(something).Change(s => s.MyProperty);
            Assert.Equal(42, something.MyProperty);
        }