本文整理汇总了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)));
}
示例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));
}
示例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);
}