public void configurations_can_be_bound_to_one_another_using_binding_container() { var cfg = new DestinationConfigurationContainer(null, configFactory); cfg.Map(typeof(ViewModelComponent)).From(typeof(EventComponent)); cfg.Map(typeof(ComplexViewModel)).From(typeof(ComplexEvent)); var binding = cfg.ToBinding(); binding.Bind(); binding.Assert(); var source = new ComplexEvent() { Name = "RootName", Component = new EventComponent() { Name = "ComponentName" } }; var dest = new ComplexViewModel(); var command = binding.CreateCommand(typeof(ComplexEvent), typeof(ComplexViewModel)); command.Map(source, dest); dest.Name.should_be_equal_to("RootName"); dest.Component.should_not_be_null(); dest.Component.Name.should_be_equal_to("ComponentName"); }
public void it_should_map_nested_components() { container.Map(typeof (ViewModelComponent)).From(typeof (EventComponent)); container.Map(typeof (ComplexViewModel)).From(typeof (ComplexEvent)); var bindable = container.ToBinding(); bindable.Bind(); bindable.Assert(); var source = new ComplexEvent(){Name = "RootName", Component = new EventComponent() {Name = "ComponentName"}}; var dest = new ComplexViewModel(); var executable = bindable.CreateCommand(typeof (ComplexEvent), typeof (ComplexViewModel)); executable.Map(source, dest); dest.Name.should_be_equal_to("RootName"); dest.Component.should_not_be_null(); dest.Component.Name.should_be_equal_to("ComponentName"); }
public void it_should_map_nested_components() { container.Map(typeof(ViewModelComponent)).From(typeof(EventComponent)); container.Map(typeof(ComplexViewModel)).From(typeof(ComplexEvent)); var bindable = container.ToBinding(); bindable.Bind(); bindable.Assert(); var source = new ComplexEvent() { Name = "RootName", Component = new EventComponent() { Name = "ComponentName" } }; var dest = new ComplexViewModel(); var executable = bindable.CreateCommand(typeof(ComplexEvent), typeof(ComplexViewModel)); executable.Map(source, dest); dest.Name.should_be_equal_to("RootName"); dest.Component.should_not_be_null(); dest.Component.Name.should_be_equal_to("ComponentName"); }