コード例 #1
0
            public void WhenExistingLegacyRawValueExists_ThenAutomaticallyUpgradesToBindingValue()
            {
                var value = "Foo";
                var property = new BoundProperty("Name", () => value, s => value = s);

                Assert.Equal("Foo", property.Settings.Value);
                Assert.True(value.Trim().StartsWith("{"));
            }
コード例 #2
0
            public void WhenChangingSettingsValue_ThenAutomaticallySerializesValue()
            {
                var value = "";
                var property = new BoundProperty("Name", () => value, s => value = s);

                property.Settings.Value = "Hello";

                Assert.NotEqual("", value);
            }
コード例 #3
0
            public void WhenReassigningSettings_ThenSavesNewValue()
            {
                var value = "";
                var property = new BoundProperty("Name", () => value, s => value = s);
                var settings = property.Settings;

                property.Settings = new PropertyBindingSettings { Name = "Name", Value = "Hello" };

                Assert.NotEqual("", value);
            }
コード例 #4
0
            public void WhenReassigningSettings_ThenDetachesChangesFromOlder()
            {
                var value = "";
                var property = new BoundProperty("Name", () => value, s => value = s);
                var settings = property.Settings;

                property.Settings = new PropertyBindingSettings { Name = "Name", Value = "Hello" };

                settings.Value = "Foo";

                Assert.False(value.Contains("Foo"));
            }
コード例 #5
0
 public void InitializeContext()
 {
     this.property = new BoundProperty("Property",
             () => this.Property,
             s => this.Property = s);
 }
コード例 #6
0
            public void WhenValueIsEmpty_ThenSettingsInitializedEmpty()
            {
                var property = new BoundProperty("Name", () => "", s => { });

                Assert.Equal("", property.Settings.Value);
            }
コード例 #7
0
            public void WhenInitializingSettings_ThenHasPropertyName()
            {
                var property = new BoundProperty("Name", () => "", s => { });

                Assert.Equal("Name", property.Settings.Name);
            }