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


C# Customer.UpdateModificationContext方法代码示例

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


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

示例1: TestGetStringValue

        public void TestGetStringValue()
        {
            var customer = new Customer();
            var propertyInfo = GetCustomerProperty("PersonalManager");

            Assert.IsNotNull(propertyInfo);
            Assert.AreEqual("Bob", propertyInfo.GetStringValue(customer));

            var createdProperty = GetCustomerProperty("Created");
            var createdByProperty = GetCustomerProperty("CreatedBy");

            Assert.IsNotNull(createdProperty);
            Assert.IsNull(createdProperty.GetStringValue(customer));
            Assert.IsNull(createdByProperty.GetStringValue(customer));

            customer.UpdateModificationContext(DateTime.Now, UnitTestHelper.TEST_USER);
            Assert.AreEqual(customer.Created.ToString(), createdProperty.GetStringValue(customer));
            Assert.AreEqual(customer.CreatedBy, createdByProperty.GetStringValue(customer));
            Assert.AreEqual(UnitTestHelper.TEST_USER, createdByProperty.GetStringValue(customer));

            var baseTypeProperty = typeof(Type).GetProperty("BaseType", BindingFlags.Public | BindingFlags.Instance);
            Assert.IsNotNull(baseTypeProperty);
            Assert.AreEqual(typeof(DomainObjectBase).ToString(), baseTypeProperty.GetStringValue(typeof(Customer)));
        }
开发者ID:eithery,项目名称:core,代码行数:24,代码来源:PropertyInfoExtensionsTest.cs

示例2: TestUpdateModificationContext_BlankArg

        public void TestUpdateModificationContext_BlankArg()
        {
            var customer = new Customer();

            Assert.Throws<ArgumentException>(() => customer.UpdateModificationContext(DateTime.Now, null));
            Assert.Throws<ArgumentException>(() => customer.UpdateModificationContext(DateTime.Now, String.Empty));
            Assert.Throws<ArgumentException>(() => customer.UpdateModificationContext(DateTime.Now, UnitTestHelper.BLANK_STRING));
        }
开发者ID:eithery,项目名称:core,代码行数:8,代码来源:DomainObjectBaseTest.cs

示例3: TestUpdateModificationContext

        public void TestUpdateModificationContext()
        {
            var customer = new Customer();

            Assert.IsTrue(customer.IsNew);
            Assert.IsNull(customer.Created);
            Assert.IsNull(customer.CreatedBy);
            Assert.IsNull(customer.Modified);
            Assert.IsNull(customer.ModifiedBy);
            Assert.AreEqual(0, customer.Version);

            var updated = DateTime.Now;
            customer.UpdateModificationContext(updated, UnitTestHelper.TEST_USER);

            Assert.IsFalse(customer.IsNew);
            Assert.AreEqual(updated, customer.Created);
            Assert.AreEqual(UnitTestHelper.TEST_USER, customer.CreatedBy);
            Assert.AreEqual(updated, customer.Modified);
            Assert.AreEqual(UnitTestHelper.TEST_USER, customer.ModifiedBy);
            Assert.AreEqual(1, customer.Version);

            var futureUpdated = new DateTime(2050, 03, 24, 14, 32, 45);
            const string ANOTHER_TEST_USER = "bparker";
            customer.UpdateModificationContext(futureUpdated, ANOTHER_TEST_USER);

            Assert.IsFalse(customer.IsNew);
            Assert.AreEqual(updated, customer.Created);
            Assert.AreEqual(UnitTestHelper.TEST_USER, customer.CreatedBy);
            Assert.AreEqual(futureUpdated, customer.Modified);
            Assert.AreEqual(ANOTHER_TEST_USER, customer.ModifiedBy);
            Assert.AreEqual(2, customer.Version);
        }
开发者ID:eithery,项目名称:core,代码行数:32,代码来源:DomainObjectBaseTest.cs


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