コード例 #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
ファイル: BasePlantTest.cs プロジェクト: sy-vv/plant
        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
ファイル: BasePlantTest.cs プロジェクト: jbrechtel/plant
 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
ファイル: BasePlantTest.cs プロジェクト: jbrechtel/plant
        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
ファイル: BasePlantTest.cs プロジェクト: jbrechtel/plant
 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
ファイル: BasePlantTest.cs プロジェクト: jbrechtel/plant
 public void Should_Create_Objects_Via_Constructor()
 {
     var testPlant = new BasePlant();
     testPlant.DefineConstructionOf<Car>(new { Make = "Toyota" });
     Assert.AreEqual("Toyota", testPlant.Create<Car>().Make);
 }