main
1using System;
2using System.Linq.Expressions;
3using developwithpassion.bdd.contexts;
4using Gorilla.Commons.Testing;
5
6namespace MoMoney.Presentation.Winforms.Helpers
7{
8 public class RebindTextBoxCommandSpecs
9 {
10 }
11
12 [Concern(typeof (RebindTextBoxCommand<>))]
13 public class when_the_text_in_a_textbox_changes :
14 concerns_for<ITextBoxCommand<string>, RebindTextBoxCommand<string>>
15 {
16 context c = () =>
17 {
18 textbox = an<IBindableTextBox<string>>();
19 binder = x => "";
20 };
21
22 public override ITextBoxCommand<string> create_sut()
23 {
24 return new RebindTextBoxCommand<string>(binder);
25 }
26
27 static protected IBindableTextBox<string> textbox;
28 static protected Expression<Func<string, string>> binder;
29 }
30
31 [Concern(typeof (RebindTextBoxCommand<>))]
32 public class when_rebinding_an_item_to_a_textbox : when_the_text_in_a_textbox_changes
33 {
34 it should_bind_the_text_control_to_the_new_item = () => textbox.was_told_to(x => x.bind_to("kat"));
35
36 context c = () =>
37 {
38 binder = x => "kat";
39 when_the(textbox).is_told_to(x => x.text()).it_will_return("kitty");
40 };
41
42 because b = () => sut.run(textbox);
43 }
44}