main
1using System;
2using System.Windows.Forms;
3using developwithpassion.bdd.contexts;
4using Gorilla.Commons.Testing;
5
6namespace MoMoney.Presentation.Winforms.Databinding
7{
8 [Concern(typeof (Create))]
9 public class when_a_new_date_is_selected_by_a_date_time_picker_that_is_bound_to_a_property : concerns
10 {
11 it should_update_the_value_of_the_property =
12 () => thing_to_bind_to.birth_day.should_be_equal_to(november_nineteenth);
13
14 context c = () =>
15 {
16 date_time_picker = new DateTimePicker {Value = DateTime.Now};
17 thing_to_bind_to = new TestDTO {birth_day = DateTime.Now};
18
19 Create.binding_for(thing_to_bind_to)
20 .bind_to_property(x => x.birth_day)
21 .bound_to_control(date_time_picker);
22 };
23
24 because b = () => { date_time_picker.Value = november_nineteenth; };
25
26 static DateTimePicker date_time_picker;
27 static TestDTO thing_to_bind_to;
28 static readonly DateTime november_nineteenth = new DateTime(2006, 11, 19);
29 }
30
31 public class TestDTO
32 {
33 public DateTime birth_day { get; set; }
34 }
35
36 public class DateTimePropertyBindingSpecs
37 {
38 }
39}