本文整理汇总了C#中System.Threading.Task.Nominate方法的典型用法代码示例。如果您正苦于以下问题:C# Task.Nominate方法的具体用法?C# Task.Nominate怎么用?C# Task.Nominate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Threading.Task
的用法示例。
在下文中一共展示了Task.Nominate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestNominateIndividual
public void TestNominateIndividual()
{
IdentityId potentialOwner = new IdentityId();
IdentityId businessAdministrator = new IdentityId();
_mapStorage[potentialOwner.Id] = new Account(potentialOwner, "s-1-2-3-4-5", "auth", AccountType.User);
ILoggingService loggingService = SetupLoggerMock(new List<TaskHistoryEvent>());
Task task = new Task(
new TaskId(), TaskStatus.Created, string.Empty,
string.Empty, Priority.Normal, false,
DateTime.UtcNow, new IdentityId().GetIdentity(),
DateTime.UtcNow, null, null)
{
LoggingService = loggingService
};
IPrincipal actualOwner = new ClaimsPrincipal(businessAdministrator.GetIdentity());
Thread.CurrentPrincipal = actualOwner;
task.BusinessAdministrators.Add(businessAdministrator.GetIdentity());
task.Nominate(potentialOwner.GetIdentity());
Assert.AreEqual(TaskStatus.Reserved, task.Status);
Assert.IsNotNull(task.ActualOwner);
Assert.AreEqual(potentialOwner, task.ActualOwner.GetMappedId());
Assert.IsTrue(task.PotentialOwners.Contains(potentialOwner.GetIdentity()));
Assert.IsNotNull(task.History);
Assert.AreEqual(1, task.History.Count());
TaskHistoryEvent history = task.History.ElementAt(0);
Assert.IsNotNull(history);
Assert.AreEqual(TaskStatus.Created, history.OldStatus);
Assert.AreEqual(TaskStatus.Reserved, history.NewStatus);
Assert.AreEqual(businessAdministrator, history.UserId);
Assert.AreEqual(null,history.StartOwner);
Assert.AreEqual(potentialOwner, history.EndOwner);
}