当前位置: 首页>>代码示例>>C#>>正文


C# Property.HasChanged方法代码示例

本文整理汇总了C#中Property.HasChanged方法的典型用法代码示例。如果您正苦于以下问题:C# Property.HasChanged方法的具体用法?C# Property.HasChanged怎么用?C# Property.HasChanged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Property的用法示例。


在下文中一共展示了Property.HasChanged方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HasChangedShouldBeTrue

        public void HasChangedShouldBeTrue()
        {
            // arrange
            var property = new Property<int>();

            // act
            property.Value = 1;

            // assert
            Assert.IsTrue(property.HasChanged());
            Assert.AreEqual(0, property.InitialValue);
            Assert.AreEqual(1, property.Value);
        }
开发者ID:rangab,项目名称:Magento-RestApi,代码行数:13,代码来源:PropertyTests.cs

示例2: ForIntShouldHaveDefaults

        public void ForIntShouldHaveDefaults()
        {
            // arrange
            Property<int> property = null;

            // act
            property = new Property<int>();

            // assert
            Assert.Equal(0, property.InitialValue);
            Assert.Equal(0, property.Value);
            Assert.False(property.HasChanged());
        }
开发者ID:lbonazzi,项目名称:Magento-RestApi,代码行数:13,代码来源:PropertyTests.cs

示例3: ForStringShouldHaveDefaults

        public void ForStringShouldHaveDefaults()
        {
            // arrange
            Property<string> property = null;

            // act
            property = new Property<string>();

            // assert
            Assert.Equal(null, property.InitialValue);
            Assert.Equal(null, property.Value);
            Assert.False(property.HasChanged());
        }
开发者ID:lbonazzi,项目名称:Magento-RestApi,代码行数:13,代码来源:PropertyTests.cs

示例4: HasChangedShouldBeFalseAfterInitialValueIsSet

        public void HasChangedShouldBeFalseAfterInitialValueIsSet()
        {
            // arrange
            var property = new Property<int>();

            // act
            property.Value = 1;
            property.SetValueAsInitial();

            // assert
            Assert.IsFalse(property.HasChanged());
            Assert.AreEqual(1, property.InitialValue);
            Assert.AreEqual(1, property.Value);
        }
开发者ID:rangab,项目名称:Magento-RestApi,代码行数:14,代码来源:PropertyTests.cs

示例5: HasChangedShouldBeTrueAfterInitialValueIsSetAndChanged

        public void HasChangedShouldBeTrueAfterInitialValueIsSetAndChanged()
        {
            // arrange
            var property = new Property<int>();

            // act
            property.Value = 1;
            property.SetValueAsInitial();
            property.Value = 2;

            // assert
            Assert.True(property.HasChanged());
            Assert.Equal(1, property.InitialValue);
            Assert.Equal(2, property.Value);
        }
开发者ID:lbonazzi,项目名称:Magento-RestApi,代码行数:15,代码来源:PropertyTests.cs

示例6: HasChangedShouldBeTrueAfterInitialValueIsSetAndOtherItemIsAdded

        public void HasChangedShouldBeTrueAfterInitialValueIsSetAndOtherItemIsAdded()
        {
            // arrange
            var property = new Property<List<int>>();

            // act
            property.Value = new List<int> { 1 };
            property.SetValueAsInitial();
            property.Value = new List<int> { 2 };

            // assert
            Assert.IsTrue(property.HasChanged());
            Assert.AreEqual(1, property.InitialValue.Count);
            Assert.AreEqual(1, property.Value.Count);
        }
开发者ID:rangab,项目名称:Magento-RestApi,代码行数:15,代码来源:PropertyTests.cs

示例7: HasChangedShouldBeFalseAfterInitialValueIsSet

        public void HasChangedShouldBeFalseAfterInitialValueIsSet()
        {
            // arrange
            var property = new Property<List<int>>();

            // act
            property.Value = new List<int>();
            property.SetValueAsInitial();

            // assert
            Assert.False(property.HasChanged());
            Assert.Equal(0, property.InitialValue.Count);
            Assert.Equal(0, property.Value.Count);
        }
开发者ID:lbonazzi,项目名称:Magento-RestApi,代码行数:14,代码来源:PropertyTests.cs

示例8: HasChangedShouldBeTrueAfterInitialValueIsSetAndItemIsChanged

        public void HasChangedShouldBeTrueAfterInitialValueIsSetAndItemIsChanged()
        {
            // arrange
            var property = new Property<List<int>>();

            // act
            property.Value = new List<int> { 1 };
            property.SetValueAsInitial();
            property.Value[0] = 2;

            // assert
            Assert.True(property.HasChanged());
            Assert.Equal(1, property.InitialValue.Count);
            Assert.Equal(1, property.InitialValue[0]);
            Assert.Equal(1, property.Value.Count);
            Assert.Equal(2, property.Value[0]);
        }
开发者ID:lbonazzi,项目名称:Magento-RestApi,代码行数:17,代码来源:PropertyTests.cs

示例9: HasChangedShouldBeTrueAfterInitialValueIsSetAndItemIsChanged

        public void HasChangedShouldBeTrueAfterInitialValueIsSetAndItemIsChanged()
        {
            // arrange
            var property = new Property<Dictionary<string, string>>();

            // act
            property.Value = new Dictionary<string, string> { { "key", "value" } };
            property.SetValueAsInitial();
            property.Value["key"] = "another_value";

            // assert
            Assert.True(property.HasChanged());
            Assert.Equal(1, property.InitialValue.Count);
            Assert.Equal(1, property.Value.Count);
        }
开发者ID:runin2k1,项目名称:Magento-RestApi,代码行数:15,代码来源:PropertyTests.cs

示例10: HasChangedShouldBeFalseAfterInitialValueIsSetAndSameItemIsAdded

        public void HasChangedShouldBeFalseAfterInitialValueIsSetAndSameItemIsAdded()
        {
            // arrange
            var property = new Property<Dictionary<string, string>>();

            // act
            property.Value = new Dictionary<string, string> { { "key", "value" } };
            property.SetValueAsInitial();
            property.Value = new Dictionary<string, string> { { "key", "value" } };

            // assert
            Assert.False(property.HasChanged());
            Assert.Equal(1, property.InitialValue.Count);
            Assert.Equal(1, property.Value.Count);
        }
开发者ID:runin2k1,项目名称:Magento-RestApi,代码行数:15,代码来源:PropertyTests.cs

示例11: HasChangedShouldBeFalseAfterSetToNull

        public void HasChangedShouldBeFalseAfterSetToNull()
        {
            // arrange
            var property = new Property<Dictionary<string, string>>();
            property.Value = new Dictionary<string, string>();
            property.SetValueAsInitial();

            // act
            property.Value = null;

            // assert
            Assert.False(property.HasChanged());
        }
开发者ID:runin2k1,项目名称:Magento-RestApi,代码行数:13,代码来源:PropertyTests.cs

示例12: HasChangedShouldBeFalseAfterInitialValueIsSet

        public void HasChangedShouldBeFalseAfterInitialValueIsSet()
        {
            // arrange
            var property = new Property<Dictionary<string, string>>();

            // act
            property.Value = new Dictionary<string, string>();
            property.SetValueAsInitial();

            // assert
            Assert.False(property.HasChanged());
            Assert.Equal(0, property.InitialValue.Count);
            Assert.Equal(0, property.Value.Count);
        }
开发者ID:runin2k1,项目名称:Magento-RestApi,代码行数:14,代码来源:PropertyTests.cs

示例13: HasChangedShouldBeTrue

        public void HasChangedShouldBeTrue()
        {
            // arrange
            var property = new Property<Dictionary<string, string>>();

            // act
            property.Value = new Dictionary<string, string>();

            // assert
            Assert.True(property.HasChanged());
            Assert.Null(property.InitialValue);
            Assert.Equal(0, property.Value.Count);
        }
开发者ID:runin2k1,项目名称:Magento-RestApi,代码行数:13,代码来源:PropertyTests.cs


注:本文中的Property.HasChanged方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。