本文整理汇总了C#中User.ReinstateFromDelete方法的典型用法代码示例。如果您正苦于以下问题:C# User.ReinstateFromDelete方法的具体用法?C# User.ReinstateFromDelete怎么用?C# User.ReinstateFromDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类User
的用法示例。
在下文中一共展示了User.ReinstateFromDelete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: When_Delete_Then_should_set_correct_properties
public void When_Delete_Then_should_set_correct_properties()
{
// Given
var user = new User { Id = Guid.NewGuid() };
var userDeleting = new UserForAuditing();
user.Delete(userDeleting);
// When
user.ReinstateFromDelete(userDeleting);
// Then
Assert.That(user.Deleted, Is.False);
Assert.That(user.LastModifiedBy, Is.EqualTo(userDeleting));
Assert.That(user.LastModifiedOn.Value.ToShortDateString(), Is.EqualTo(DateTime.Now.ToShortDateString()));
}
示例2: Given_user_and_employee_deleted_When_ReinstateFromDelete_Then_employee_should_be_restored
public void Given_user_and_employee_deleted_When_ReinstateFromDelete_Then_employee_should_be_restored()
{
// Given
var user = new User
{
Id = Guid.NewGuid()
,
Employee = new Employee() { Deleted = true }
,
Deleted = true
};
var userDeleting = new UserForAuditing();
// When
user.ReinstateFromDelete(userDeleting);
// Then
Assert.That(user.Employee.Deleted, Is.False);
Assert.That(user.Employee.LastModifiedBy, Is.EqualTo(userDeleting));
Assert.That(user.Employee.LastModifiedOn.Value.ToShortDateString(), Is.EqualTo(DateTime.Now.ToShortDateString()));
}
示例3: ReinstateUser
private void ReinstateUser(User userToReinstate, Guid? actioningUserId)
{
if (userToReinstate != null && userToReinstate.Deleted)
{
var actioningUser = actioningUserId.HasValue ? _auditedUserRepository.GetById(actioningUserId.Value) : _auditedUserRepository.GetSystemUser();
userToReinstate.ReinstateFromDelete(actioningUser);
_userRepository.SaveOrUpdate(userToReinstate);
_bus.Send(new ReinstateUser { UserId = userToReinstate.Id, ActioningUserId = actioningUser.Id });
if (userToReinstate.IsRegistered == false)
{
_bus.Send(new UpdateUserRegistration
{
UserId = userToReinstate.Id,
ActioningUserId = actioningUser.Id,
SecurityAnswer =
String.IsNullOrEmpty(userToReinstate.Employee.MainContactDetails.Telephone1)
? userToReinstate.Employee.MainContactDetails.Telephone2
: userToReinstate.Employee.MainContactDetails.Telephone1,
Email = userToReinstate.Employee.MainContactDetails.Email
});
}
}
}