Ejemplo n.º 1
0
        private BindingScenario(ScenarioDefinition definition)
        {
            var context = new BindingContext(definition.RequestData, definition.Services, this);

            context.ForObject(definition.Model, () => definition.Actions.Each(x => x(context)));

            Model    = definition.Model;
            Problems = context.Problems;
        }
Ejemplo n.º 2
0
        private BindingScenario(ScenarioDefinition definition)
        {
            var context = new BindingContext(definition.RequestData, definition.Services, definition.Logger);

            context.ForObject(definition.Model, () => definition.Actions.Each(x => x(context)));

            Model    = definition.Model;
            Problems = context.Problems;

            History = definition.History;

            if (definition.History.AllReports.Count() == 1)
            {
                Report = definition.History.AllReports.Single();
            }
        }
Ejemplo n.º 3
0
        public void use_binding_attribute()
        {
            var context = new BindingContext(new InMemoryRequestData(), null, new NulloBindingLogger());

            var binder = new AttributePropertyBinder();
            var target = new FakeTarget();

            var property1 = ReflectionHelper.GetProperty<FakeTarget>(x => x.Color1);
            var property2 = ReflectionHelper.GetProperty<FakeTarget>(x => x.Color2);
            context.ForObject(target, () =>
            {
                binder.Bind(property1, context);
                binder.Bind(property2, context);
            });

            target.Color1.ShouldEqual("red");
            target.Color2.ShouldEqual("green");
        }