public void TestDelegateActualOwner()
        {
            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.InProgress, 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.Delegate(potentialOwner.GetIdentity(), Priority.High);
            Assert.AreEqual(TaskStatus.Reserved, task.Status);
            Assert.IsNotNull(task.ActualOwner);
            Assert.AreEqual(potentialOwner, task.ActualOwner.GetMappedId());
            Assert.AreEqual(Priority.High, task.Priority);

            Assert.IsNotNull(task.History);
            Assert.AreEqual(1, task.History.Count());
            TaskHistoryEvent history = task.History.ElementAt(0);
            Assert.IsNotNull(history);
            Assert.AreEqual(TaskStatus.InProgress, history.OldStatus);
            Assert.AreEqual(TaskStatus.Reserved, history.NewStatus);
            Assert.AreEqual(Priority.Normal,history.OldPriority);
            Assert.AreEqual(Priority.High, history.NewPriority);
            Assert.AreEqual(actualId, history.UserId);
        }