public void When_binding_an_object_to_a_form_with_custom_control_registrations() { var binder = new Binder(); var form = new MySampleForm(); var strategy = new TestBindaStrategy(); binder.AddRegistration(strategy, form.Title); binder.AddRegistration(typeof(TextBox), "Text"); var post = NeededObjectsFactory.CreatePost(); binder.Bind(post, form); Assert.IsTrue(strategy.WasSet); }
public void When_binding_a_form_to_an_object_with_custom_control_registrations() { var binder = new Binder(); var form = NeededObjectsFactory.CreateForm(); var strategy = new TestBindaStrategy(); binder.AddRegistration(strategy, form.Title); strategy.GetValue = "Good Title"; binder.AddRegistration(typeof(TextBox), "Text"); form.Title.Text = "Bad Title"; var post = new Post(); binder.Bind(form, post); Assert.That(post.Title, Is.EqualTo(strategy.GetValue)); }