public void simple_creation_of_properties_with_only_constants()
        {
            var step = new ConcreteBuild<SetterTarget>();
            step.Set(x => x.Color, "Red");
            step.Set(x => x.Direction, "North");

            var target = step.Build<SetterTarget>(new FakeBuildSession());

            target.Color.ShouldBe("Red");
            target.Direction.ShouldBe("North");
        }
        public void simple_creation_of_properties_with_only_constants()
        {
            var step = new ConcreteBuild<SetterTarget>();
            step.Set(x => x.Color, "Red");
            step.Set(x => x.Direction, "North");

            var builder = (Func<IContext, SetterTarget>) step.ToDelegate();
            SetterTarget target = builder(new FakeContext());

            target.Color.ShouldEqual("Red");
            target.Direction.ShouldEqual("North");
        }
Exemplo n.º 3
0
        public void simple_creation_of_fields_with_only_constants()
        {
            var step = new ConcreteBuild <FieldTarget>();

            step.Set(x => x.Color, "Red");
            step.Set(x => x.Direction, "North");

            var target = step.Build <FieldTarget>(new FakeBuildSession());

            target.Color.ShouldBe("Red");
            target.Direction.ShouldBe("North");
        }
Exemplo n.º 4
0
        public void simple_creation_of_fields_with_only_constants()
        {
            var step = new ConcreteBuild <FieldTarget>();

            step.Set(x => x.Color, "Red");
            step.Set(x => x.Direction, "North");

            var         builder = (Func <IContext, FieldTarget>)step.ToDelegate();
            FieldTarget target  = builder(new FakeContext());

            target.Color.ShouldEqual("Red");
            target.Direction.ShouldEqual("North");
        }
        public void with_all_constants()
        {
            var build = new ConcreteBuild<MixedTarget>();
            build.Constructor.Add(Constant.For("Jeremy"));
            build.Constructor.Add(Constant.For("Red"));

            build.Set(x => x.Direction, "South");
            build.Set(x => x.Description, "Something");

            var target = build.Build<MixedTarget>(new FakeBuildSession());

            target.Name.ShouldEqual("Jeremy");
            target.Color.ShouldEqual("Red");
            target.Direction.ShouldEqual("South");
            target.Description.ShouldEqual("Something");
        }
        public void SetUp()
        {
            var build = new ConcreteBuild<Game>();
            build.Constructor.Add(new ConcreteBuild<SportsTeam>()
                .ConstructorArgs("San Diego", "Chargers"));

            build.Constructor.Add(new ConcreteBuild<SportsTeam>()
                .ConstructorArgs("Kansas City", "Chiefs"));

            build.Set(x => x.Stadium, "Qualcomm Stadium");

            build.Set(x => x.Referee, new ConcreteBuild<Referee>().ConstructorArgs("John", "Smith"));

            var session = new FakeBuildSession();
            game = build.Build(session, session).As<Game>();
        }
Exemplo n.º 7
0
        public void with_all_constants()
        {
            var build = new ConcreteBuild <MixedTarget>();

            build.Constructor.Add(Constant.For("Jeremy"));
            build.Constructor.Add(Constant.For("Red"));

            build.Set(x => x.Direction, "South");
            build.Set(x => x.Description, "Something");

            var target = build.Build <MixedTarget>(new FakeBuildSession());

            target.Name.ShouldEqual("Jeremy");
            target.Color.ShouldEqual("Red");
            target.Direction.ShouldEqual("South");
            target.Description.ShouldEqual("Something");
        }
        public void SetUp()
        {
            var build = new ConcreteBuild <Game>();

            build.Constructor.Add(new ConcreteBuild <SportsTeam>()
                                  .ConstructorArgs("San Diego", "Chargers"));

            build.Constructor.Add(new ConcreteBuild <SportsTeam>()
                                  .ConstructorArgs("Kansas City", "Chiefs"));

            build.Set(x => x.Stadium, "Qualcomm Stadium");

            build.Set(x => x.Referee, new ConcreteBuild <Referee>().ConstructorArgs("John", "Smith"));

            var session = new FakeBuildSession();

            game = build.Build(session, session).As <Game>();
        }
        public void with_all_constants()
        {
            var build = new ConcreteBuild<MixedTarget>();
            build.Constructor.Add(Constant.For("Jeremy"));
            build.Constructor.Add(Constant.For("Red"));

            build.Set(x => x.Direction, "South");
            build.Set(x => x.Description, "Something");

            var builder = build.ToDelegate().As<Func<IContext, MixedTarget>>();

            var target = builder(new FakeContext());

            target.Name.ShouldEqual("Jeremy");
            target.Color.ShouldEqual("Red");
            target.Direction.ShouldEqual("South");
            target.Description.ShouldEqual("Something");
        }
Exemplo n.º 10
0
        public void with_all_constants()
        {
            var build = new ConcreteBuild <MixedTarget>();

            build.Constructor.Add(Constant.For("Jeremy"));
            build.Constructor.Add(Constant.For("Red"));

            build.Set(x => x.Direction, "South");
            build.Set(x => x.Description, "Something");

            var builder = build.ToDelegate().As <Func <IContext, MixedTarget> >();

            var target = builder(new FakeContext());

            target.Name.ShouldEqual("Jeremy");
            target.Color.ShouldEqual("Red");
            target.Direction.ShouldEqual("South");
            target.Description.ShouldEqual("Something");
        }