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");
        }
Beispiel #2
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 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");
        }
Beispiel #4
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");
        }