Commit d8a25e4
Changed files (3)
product
Gorilla.Commons.Windows.Forms
product/Gorilla.Commons.Windows.Forms/Databinding/CreateSpecs.cs
@@ -0,0 +1,34 @@
+using System.Windows.Forms;
+using developwithpassion.bdd.contexts;
+using Gorilla.Commons.Testing;
+
+namespace Gorilla.Commons.Windows.Forms.Databinding
+{
+ public class CreateSpecs
+ {
+ }
+
+ public abstract class when_a_text_control_is_bound_to_an_item : concerns
+ {
+ context c = () =>
+ {
+ textbox = new TextBox();
+ item = new TestItem {name = "k"};
+ textbox.bind_to(item, x => x.name);
+ };
+
+ static protected TextBox textbox;
+ static protected TestItem item;
+ }
+
+ public class when_the_value_of_a_text_control_changes : when_a_text_control_is_bound_to_an_item
+ {
+ it should_update_the_value_of_the_property_on_the_item = () => item.name.should_be_equal_to("mo");
+ because b = () => { textbox.Text = "mo"; };
+ }
+
+ public class TestItem
+ {
+ public string name { get; set; }
+ }
+}
\ No newline at end of file
product/Gorilla.Commons.Windows.Forms/Databinding/TextPropertyBinding.cs
@@ -1,4 +1,3 @@
-using System;
using System.Windows.Forms;
using Gorilla.Commons.Utility.Extensions;
@@ -6,7 +5,7 @@ namespace Gorilla.Commons.Windows.Forms.Databinding
{
public class TextPropertyBinding<TypeToBindTo, PropertyType> : IPropertyBinding<PropertyType>
{
- private readonly IPropertyBinder<TypeToBindTo, PropertyType> binder;
+ readonly IPropertyBinder<TypeToBindTo, PropertyType> binder;
public TextPropertyBinding(Control control, IPropertyBinder<TypeToBindTo, PropertyType> binder)
{
product/Gorilla.Commons.Windows.Forms/Gorilla.Commons.Windows.Forms.csproj
@@ -65,6 +65,7 @@
<Compile Include="Databinding\ComboBoxPropertyBinding.cs" />
<Compile Include="Databinding\ControlBindingExtensions.cs" />
<Compile Include="Databinding\Create.cs" />
+ <Compile Include="Databinding\CreateSpecs.cs" />
<Compile Include="Databinding\DateTimePickerPropertyBinding.cs" />
<Compile Include="Databinding\DateTimePropertyBindingSpecs.cs" />
<Compile Include="Databinding\IPropertyBinding.cs" />