예제 #1
0
        public void Should_Create_Objects_Via_Constructor()
        {
            var testPlant = new BasePlant();

            testPlant.DefineConstructionOf <Car>(new { Make = "Toyota" });
            Assert.AreEqual("Toyota", testPlant.Create <Car>().Make);
        }
예제 #2
0
        public void Should_Override_Default_Constructor_Arguments()
        {
            var testPlant = new BasePlant();

            testPlant.DefineConstructionOf <House>(new { Color = "Red", SquareFoot = 3000 });

            Assert.AreEqual("Blue", testPlant.Create <House>(new { Color = "Blue" }).Color);
        }
예제 #3
0
        public void Should_Send_Constructor_Arguments_In_Correct_Order()
        {
            var testPlant = new BasePlant();

            testPlant.DefineConstructionOf <Book>(new { Publisher = "Tor", Author = "Robert Jordan" });
            Assert.AreEqual("Tor", testPlant.Create <Book>().Publisher);
            Assert.AreEqual("Robert Jordan", testPlant.Create <Book>().Author);
        }
예제 #4
0
        public void Should_Call_AfterBuildCallback_AfterConstructor_Population()
        {
            var testPlant = new BasePlant();
            testPlant.DefineConstructionOf<House>(new { Color = "Red", SquareFoot = 3000 },
            (h) => h.Summary = h.Color + h.SquareFoot);

            Assert.AreEqual("Blue3000", testPlant.Create<House>(new { Color = "Blue" }).Summary);
        }
예제 #5
0
        public void Should_Call_AfterBuildCallback_AfterConstructor_Population()
        {
            var testPlant = new BasePlant();

            testPlant.DefineConstructionOf <House>(new { Color = "Red", SquareFoot = 3000 },
                                                   (h) => h.Summary = h.Color + h.SquareFoot);

            Assert.AreEqual("Blue3000", testPlant.Create <House>(new { Color = "Blue" }).Summary);
        }
예제 #6
0
        public void Should_increment_values_in_a_sequence_with_ctor_construction()
        {
            var testPlant = new BasePlant();

            testPlant.DefineConstructionOf <House>(new
            {
                Color      = new Sequence <string>((i) => "Color" + i),
                SquareFoot = 10
            });
            Assert.AreEqual("Color0", testPlant.Create <House>().Color);
            Assert.AreEqual("Color1", testPlant.Create <House>().Color);
        }
예제 #7
0
 public void Should_Send_Constructor_Arguments_In_Correct_Order()
 {
     var testPlant = new BasePlant();
     testPlant.DefineConstructionOf<Book>(new { Publisher = "Tor", Author = "Robert Jordan" });
     Assert.AreEqual("Tor", testPlant.Create<Book>().Publisher);
     Assert.AreEqual("Robert Jordan", testPlant.Create<Book>().Author);
 }
예제 #8
0
        public void Should_Override_Default_Constructor_Arguments()
        {
            var testPlant = new BasePlant();
            testPlant.DefineConstructionOf<House>(new { Color = "Red", SquareFoot = 3000 });

            Assert.AreEqual("Blue", testPlant.Create<House>(new { Color = "Blue" }).Color);
        }
예제 #9
0
 public void Should_increment_values_in_a_sequence_with_ctor_construction()
 {
     var testPlant = new BasePlant();
     testPlant.DefineConstructionOf<House>(new
     {
         Color = new Sequence<string>(i => "Color" + i),
         SquareFoot = 10
     });
     Assert.AreEqual("Color0", testPlant.Create<House>().Color);
     Assert.AreEqual("Color1", testPlant.Create<House>().Color);
 }
예제 #10
0
 public void Should_Create_Objects_Via_Constructor()
 {
     var testPlant = new BasePlant();
     testPlant.DefineConstructionOf<Car>(new { Make = "Toyota" });
     Assert.AreEqual("Toyota", testPlant.Create<Car>().Make);
 }