Ejemplo n.º 1
0
        public void ShouldBeAbleToSpecifyADefaultCustomPropertyNamer()
        {
            BuilderSetup.SetDefaultPropertyNamer(new MockPropertyNamerTests());
            Builder <MyClass> .CreateNew().Build();

            Assert.That(MockPropertyNamerTests.SetValuesOf_obj_CallCount, Is.EqualTo(1));
        }
Ejemplo n.º 2
0
        public void SpecifyingADifferentDefaultPropertyNamer()
        {
            BuilderSetup.SetDefaultPropertyNamer(new RandomValuePropertyNamer(new RandomGenerator(), new ReflectionUtil(), true, DateTime.Now, DateTime.Now.AddDays(10), true));

            var products = Builder <Product> .CreateListOfSize(10).Build();

            Assert.That(products[0].Title, Is.Not.EqualTo("StringOne1"));
            Assert.That(products[9].Title, Is.Not.EqualTo("StringOne10"));
        }
Ejemplo n.º 3
0
        public void Configuration_2()
        {
            var namer = new RandomValuePropertyNamer(new RandomGenerator(),
                                                     new ReflectionUtil(),
                                                     true,
                                                     DateTime.Now,
                                                     DateTime.Now.AddDays(10),
                                                     true);

            BuilderSetup.SetDefaultPropertyNamer(namer);
        }
Ejemplo n.º 4
0
        public void ShouldBeAbleToSpecifyADefaultCustomPropertyNamer()
        {
            try
            {
                BuilderSetup.SetDefaultPropertyNamer(new MockPropertyNamerTests());
                Builder <MyClass> .CreateListOfSize(10).Build();

                Assert.That(MockPropertyNamerTests.SetValuesOfAllInCallCount, Is.EqualTo(1));
            }
            finally
            {
                BuilderSetup.ResetToDefaults();
            }
        }
        private static void CreateSampleData()
        {
            BuilderSetup.SetDefaultPropertyNamer(new MyPropertyNamer(new ReflectionUtil()));
            var artikel = Builder <Article> .CreateListOfSize(27859)
                          .Build();

            using (var db = new ProductsContext())
            {
                int i = 1;
                artikel.ToList().ForEach(
                    a =>
                {
                    int imageNumber = i % 6;
                    a.ImageUrl      = String.Format("images/{0}.jpg", imageNumber);
                    db.Articles.Add(a);
                    i++;
                });

                db.SaveChanges();
            }

            Console.WriteLine("Done!");
        }
 public void ShouldBeAbleToSpecifyADefaultCustomPropertyNamer()
 {
     BuilderSetup builderSetup = new BuilderSetup();
     try
     {
         builderSetup.SetDefaultPropertyNamer(new MockPropertyNamerTests());
         new Builder<MyClass>(builderSetup).CreateListOfSize(10).Build();
         Assert.That(MockPropertyNamerTests.SetValuesOfAllInCallCount, Is.EqualTo(1));
     }
     finally
     {
         builderSetup.ResetToDefaults();
     }
 }
Ejemplo n.º 7
0
        public void SpecifyingADifferentDefaultPropertyNamer()
        {
            var builderSetup = new BuilderSetup();
            builderSetup.SetDefaultPropertyNamer(new RandomValuePropertyNamer(new RandomGenerator(), new ReflectionUtil(), true, DateTime.Now, DateTime.Now.AddDays(10), true,new BuilderSetup()));

            var products = new Builder<Product>(builderSetup).CreateListOfSize(10).Build();

            Assert.That(products[0].Title, Is.Not.EqualTo("StringOne1"));
            Assert.That(products[9].Title, Is.Not.EqualTo("StringOne10"));
        }
 public void ShouldBeAbleToSpecifyADefaultCustomPropertyNamer()
 {
     var builderSetup = new BuilderSetup();
     builderSetup.SetDefaultPropertyNamer(new MockPropertyNamerTests());
     new Builder<MyClass>(builderSetup).CreateNew().Build();
     Assert.That(MockPropertyNamerTests.SetValuesOf_obj_CallCount, Is.EqualTo(1));
 }