main
1using System.Reflection;
2using developwithpassion.bdd.contexts;
3using Gorilla.Commons.Testing;
4
5namespace MoMoney.Presentation.Winforms.Databinding
6{
7 [Concern(typeof (PropertyBinder<,>))]
8 public abstract class behaves_like_a_property_binder :
9 concerns_for<IPropertyBinder<IAnInterface, string>, PropertyBinder<IAnInterface, string>>
10 {
11 public override IPropertyBinder<IAnInterface, string> create_sut()
12 {
13 return new PropertyBinder<IAnInterface, string>(property, target);
14 }
15
16 context c = () =>
17 {
18 target = new AnImplementation {FirstName = "malik"};
19 property = typeof (IAnInterface).GetProperty("FirstName");
20 };
21
22 static protected IAnInterface target;
23 static protected PropertyInfo property;
24 }
25
26 [Concern(typeof (PropertyBinder<,>))]
27 public class when_changing_the_value_of_correctly_bound_property : behaves_like_a_property_binder
28 {
29 it should_update_the_value_of_the_property_of_the_target_of_the_binder =
30 () => target.FirstName.should_be_equal_to(first_name);
31
32 because b = () => sut.change_value_of_property_to(first_name);
33
34 const string first_name = "mo";
35 }
36
37 [Concern(typeof (PropertyBinder<,>))]
38 public class when_retrieving_the_current_value_of_a_bound_property : behaves_like_a_property_binder
39 {
40 it should_return_the_correct_value = () => result.should_be_equal_to("malik");
41
42 because b = () => { result = sut.current_value(); };
43
44 static string result;
45 }
46
47 public class PropertyBinderSpecs
48 {
49 }
50}