public void TestReservedForwardActualOwner() { IdentityId potentialOwner = new IdentityId(); IdentityId actualId = 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.Reserved, string.Empty, string.Empty, Priority.Normal, false, DateTime.UtcNow, new IdentityId().GetIdentity(), DateTime.UtcNow, null, actualId.GetIdentity()) { LoggingService = loggingService }; IPrincipal actualOwner = new ClaimsPrincipal(actualId.GetIdentity()); Thread.CurrentPrincipal = actualOwner; task.Forward(potentialOwner.GetIdentity()); Assert.AreEqual(TaskStatus.Ready, task.Status); Assert.IsNotNull(task.ActualOwner); Assert.AreEqual(potentialOwner, task.ActualOwner.GetMappedId()); Assert.IsNotNull(task.History); Assert.AreEqual(1, task.History.Count()); TaskHistoryEvent history = task.History.ElementAt(0); Assert.IsNotNull(history); Assert.AreEqual(TaskStatus.Reserved, history.OldStatus); Assert.AreEqual(TaskStatus.Ready, history.NewStatus); Assert.AreEqual(actualId, history.UserId); Assert.AreEqual(actualId, history.StartOwner); Assert.AreEqual(potentialOwner, history.EndOwner); }