public void TestCreateToReadyMultiplePotentialOwners() { IdentityId initiatorId = new IdentityId(); IdentityId potentialOwnerOne = new IdentityId(); IdentityId potentialOwnerTwo = new IdentityId(); IdentityId businessAdminId = new IdentityId(); IPrincipal initiator = new ClaimsPrincipal(initiatorId.GetIdentity()); _mapStorage[potentialOwnerOne.Id] = new Account(potentialOwnerOne, "s-1-2-3-4-5", "auth", AccountType.User); _mapStorage[potentialOwnerTwo.Id] = new Account(potentialOwnerTwo, "s-1-2-3-4-5", "auth", AccountType.User); _mapStorage[businessAdminId.Id] = new Account(businessAdminId, "s-55-2-3-4-5", "auth", AccountType.User); ILoggingService loggingService = SetupLoggerMock(new List<TaskHistoryEvent> { new TaskHistoryEvent{ Event = "Create", OldStatus = TaskStatus.None, NewStatus = TaskStatus.Created, OldPriority = Priority.Normal, NewPriority = Priority.Normal, Comment = "", TimeStamp = DateTime.UtcNow, UserId = initiator.Identity.GetMappedId()} }); Thread.CurrentPrincipal = initiator; Task task = new Task(new TaskId(), TaskStatus.Created, string.Empty, string.Empty, Priority.Normal, false, DateTime.UtcNow, initiator.Identity, null, null, null) { LoggingService = loggingService }; Assert.AreEqual(TaskStatus.Created, task.Status); task.PotentialOwners.Add(potentialOwnerOne.GetIdentity()); task.PotentialOwners.Add(potentialOwnerTwo.GetIdentity()); task.BusinessAdministrators.Add(businessAdminId.GetIdentity()); Assert.IsNotNull(task); Assert.AreEqual(TaskStatus.Created, task.Status); IPrincipal businessAdmin = new ClaimsPrincipal(businessAdminId.GetIdentity()); Thread.CurrentPrincipal = businessAdmin; task.Activate(); Assert.AreEqual(TaskStatus.Ready, task.Status); Assert.IsNull(task.ActualOwner); Assert.IsNotNull(task.History); Assert.AreEqual(2, task.History.Count()); TaskHistoryEvent history = task.History.ElementAt(0); Assert.IsNotNull(history); Assert.AreEqual(TaskStatus.None, history.OldStatus); Assert.AreEqual(TaskStatus.Created, history.NewStatus); Assert.AreEqual(initiator.Identity.GetMappedId(), history.UserId); history = task.History.ElementAt(1); Assert.IsNotNull(history); }