private static void CheckIntegrity(ActivityTemplateDO activityTemplate)
        {
            Assert.IsNotNull(activityTemplate.Terminal);
            Assert.AreEqual(activityTemplate.Terminal.Id, activityTemplate.TerminalId);

            AreEqual(activityTemplate.Terminal, ObjectFactory.GetInstance <ITerminal>().GetByKey(activityTemplate.TerminalId));
        }
        public async Task ActivityController_Save_WithActionNotExisting_NewActionShouldBeCreated()
        {
            SubplanDO subplan;

            using (var uow = ObjectFactory.GetInstance <IUnitOfWork>())
            {
                var plan = FixtureData.TestPlan1();

                uow.PlanRepository.Add(plan);

                subplan = FixtureData.TestSubPlanDO1();
                plan.ChildNodes.Add(subplan);

                var activityTemplate   = FixtureData.TestActivityTemplateDTOV2();
                var activityTemplateDO = new ActivityTemplateDO
                {
                    Name     = activityTemplate.Name,
                    Version  = activityTemplate.Version,
                    Terminal = new TerminalDO
                    {
                        Name               = activityTemplate.TerminalName,
                        Version            = activityTemplate.TerminalVersion,
                        TerminalStatus     = TerminalStatus.Active,
                        Label              = "dummy",
                        ParticipationState = ParticipationState.Approved,
                        OperationalState   = OperationalState.Active,
                        Endpoint           = "http://localhost:11111"
                    }
                };

                uow.ActivityTemplateRepository.Add(activityTemplateDO);

                //Arrange
                //Add one test action
                var activity = FixtureData.TestActivity1();
                subplan.ChildNodes.Add(activity);
                uow.SaveChanges();
            }
            //Act
            var actualAction = CreateActivityWithId(FixtureData.GetTestGuidById(2));

            actualAction.ParentPlanNodeId = subplan.Id;

            var controller = ObjectFactory.GetInstance <ActivitiesController>();
            var result     = (OkNegotiatedContentResult <ActivityDTO>) await controller.Save(actualAction);

            var savedAction = result.Content;

            using (var uow = ObjectFactory.GetInstance <IUnitOfWork>())
            {
                //Assert
                Assert.IsNotNull(uow.PlanRepository);
                Assert.AreEqual(2, uow.PlanRepository.GetActivityQueryUncached().Count());

                //Still there is only one action as the update happened.
                var expectedAction = uow.PlanRepository.GetById <ActivityDO>(actualAction.Id);
                Assert.IsNotNull(expectedAction);
                Assert.AreEqual(actualAction.Id, expectedAction.Id);
            }
        }
Beispiel #3
0
        public void CanGetOAuthToken()
        {
            var terminalDO = CreateAndAddTerminalDO();

            using (var uow = ObjectFactory.GetInstance <IUnitOfWork>())
            {
                var activityTemplateDO = new ActivityTemplateDO("test_name", "test_label", "1", "test_description", terminalDO.Id);
                uow.ActivityTemplateRepository.Add(activityTemplateDO);
                uow.SaveChanges();
            }

            var externalAuthenticationDTO = new ExternalAuthenticationDTO()
            {
                RequestQueryString = "?id"
            };

            var result = _authorization.GetOAuthToken(terminalDO, externalAuthenticationDTO);

            //Assert
            Mock <IRestfulServiceClient> restClientMock = Mock.Get(ObjectFactory.GetInstance <IRestfulServiceClient>());

            //verify that the post call is made
            restClientMock.Verify(
                client => client.PostAsync <ExternalAuthenticationDTO>(new Uri(terminalDO.Endpoint + "/authentication/token"),
                                                                       externalAuthenticationDTO, It.IsAny <string>(), It.IsAny <Dictionary <string, string> >()), Times.Exactly(1));

            restClientMock.VerifyAll();
        }
Beispiel #4
0
//
        public static List <PlanNodeDO> TestActivityListParentActivityID12()
        {
            List <ActionListDO> actionLists = new List <ActionListDO>();
//
            var activityTempate = new ActivityTemplateDO()
            {
                Id       = GetTestGuidById(1),
                Version  = "1",
                Terminal = FixtureData.TerminalFive(),
                Name     = "Monitor_DocuSign"
            };
            ActionListDO al_1 = new ActionListDO()
            {
                ParentActivityId = GetTestGuidById(12)
            };
            ActivityDO a_23 = new ActivityDO()
            {
                Id = GetTestGuidById(23),
                ActivityTemplate   = activityTempate,
                ActivityTemplateId = activityTempate.Id,
                CrateStorage       = ""
            };

            al_1.Activities.Add(a_23);

            actionLists.Add(al_1);
            return(new List <PlanNodeDO>()
            {
                a_23
            });
        }
Beispiel #5
0
        private ActivityTemplateDO Clone(ActivityTemplateDO source)
        {
            var newTemplate = new ActivityTemplateDO();

            CopyPropertiesHelper.CopyProperties(source, newTemplate, false);
            newTemplate.Terminal = _terminal.GetByKey(source.TerminalId);

            if (source.Categories != null)
            {
                newTemplate.Categories = new List <ActivityCategorySetDO>();
                foreach (var acs in source.Categories)
                {
                    var newActivityCategory = new ActivityCategoryDO();
                    var activityCategory    = _activityCategory.GetById(acs.ActivityCategoryId);
                    CopyPropertiesHelper.CopyProperties(activityCategory, newActivityCategory, false);

                    newTemplate.Categories.Add(new ActivityCategorySetDO()
                    {
                        ActivityTemplateId = newTemplate.Id,
                        ActivityTemplate   = newTemplate,
                        ActivityCategoryId = newActivityCategory.Id,
                        ActivityCategory   = newActivityCategory
                    });
                }
            }

            return(newTemplate);
        }
        private ActivityTemplateDO[] GenerateSeedData()
        {
            using (var uow = ObjectFactory.GetInstance <IUnitOfWork>())
            {
                var terminals = GenerateTerminals(5).ToArray();

                foreach (var terminal in terminals)
                {
                    uow.TerminalRepository.Add(terminal);
                }

                var webServices = new ActivityCategoryDO[5];

                for (int i = 1; i <= 5; i++)
                {
                    webServices[i - 1] = CreateWebService(i);
                    uow.ActivityCategoryRepository.Add(webServices[i - 1]);
                }

                uow.SaveChanges();

                var templates = new ActivityTemplateDO[20];

                for (int i = 1; i <= 20; i++)
                {
                    templates[i - 1] = CreateActivityTemplate(FixtureData.GetTestGuidById(i), terminals[i % 5], webServices[i % 5]);
                    uow.ActivityTemplateRepository.Add(templates[i - 1]);
                }

                uow.SaveChanges();

                return(templates);
            }
        }
Beispiel #7
0
        public void TestAddAuthenticationCrate()
        {
            var userDO     = CreateAndAddUserDO();
            var terminalDO = CreateAndAddTerminalDO();

            terminalDO.AuthenticationType = AuthenticationType.Internal;

            var activityDTO = new ActivityDTO();

            using (var uow = ObjectFactory.GetInstance <IUnitOfWork>())
            {
                var activityTemplateDO = new ActivityTemplateDO("test_name", "test_label", "1", "test_description", terminalDO.Id);
                uow.ActivityTemplateRepository.Add(activityTemplateDO);
                uow.SaveChanges();
            }


            _authorization.AddAuthenticationCrate(activityDTO, AuthenticationType.Internal);
            Assert.IsTrue(IsCratePresents(activityDTO, AuthenticationMode.InternalMode));

            _authorization.AddAuthenticationCrate(activityDTO, AuthenticationType.External);
            Assert.IsTrue(IsCratePresents(activityDTO, AuthenticationMode.ExternalMode));

            _authorization.AddAuthenticationCrate(activityDTO, AuthenticationType.InternalWithDomain);
            Assert.IsTrue(IsCratePresents(activityDTO, AuthenticationMode.InternalModeWithDomain));
        }
        private ActivityTemplateDO CreateActivityTemplate(Guid id, TerminalDO terminal, ActivityCategoryDO webService, string prefix = "")
        {
            var result = new ActivityTemplateDO
            {
                Id = id,
                ActivityTemplateState = 1,
                MinPaneWidth          = 330,
                Description           = prefix + "des" + id,
                Name  = "name" + id,
                Label = prefix + "label" + id,
                NeedsAuthentication = true,
                Tags       = prefix + "tags" + id,
                TerminalId = terminal.Id,
                Terminal   = terminal,
                Type       = ActivityType.Standard,
                Version    = "1"
            };

            result.Categories = new List <ActivityCategorySetDO>()
            {
                new ActivityCategorySetDO()
                {
                    ActivityCategory = webService,
                    ActivityTemplate = result
                }
            };

            return(result);
        }
        public async Task TestAuthenticate()
        {
            var tokenDO = CreateAndAddTokenDO();

            var activityTemplateDO = new ActivityTemplateDO("test_name", "test_label", "1", "test_description", tokenDO.TerminalID);

            activityTemplateDO.Id       = FixtureData.GetTestGuidById(1);
            activityTemplateDO.Terminal = ObjectFactory.GetInstance <ITerminal>().GetByKey(tokenDO.TerminalID);
            activityTemplateDO.Terminal.AuthenticationType = AuthenticationType.Internal;

            var activityDO = FixtureData.TestActivity1();

            activityDO.ActivityTemplate = activityTemplateDO;
            // activityDO.AuthorizationToken = tokenDO;

            using (var uow = ObjectFactory.GetInstance <IUnitOfWork>())
            {
                uow.PlanRepository.Add(new PlanDO()
                {
                    Name       = "name",
                    PlanState  = PlanState.Executing,
                    ChildNodes = { activityDO }
                });

                //uow.ActivityRepository.Add(activityDO);
                uow.ActivityTemplateRepository.Add(activityTemplateDO);
                uow.SaveChanges();
            }

            var credentialsDTO = new CredentialsDTO()
            {
                Password = "******",
                Username = "******",
                Domain   = "Domain",
                Terminal = Mapper.Map <TerminalSummaryDTO>(activityTemplateDO.Terminal)
            };

            var result = _authenticationController.Authenticate(credentialsDTO);

            //Assert
            Mock <IRestfulServiceClient> restClientMock = Mock.Get(
                ObjectFactory.GetInstance <IRestfulServiceClient>()
                );

            //verify that the post call is made
            restClientMock.Verify(
                client => client.PostAsync <CredentialsDTO>(
                    new Uri(activityTemplateDO.Terminal.Endpoint + "/authentication/token"),
                    It.Is <CredentialsDTO>(it => it.Username == credentialsDTO.Username &&
                                           it.Password == credentialsDTO.Password &&
                                           it.Domain == credentialsDTO.Domain), It.IsAny <string>(), It.IsAny <Dictionary <string, string> >()
                    ),
                Times.Exactly(1)
                );


            restClientMock.VerifyAll();
        }
Beispiel #10
0
        public bool TryGetByKey(Guid activityTemplateId, out ActivityTemplateDO activityTemplate)
        {
            Initialize();

            lock (_activityTemplates)
            {
                return(_activityTemplates.TryGetValue(activityTemplateId, out activityTemplate));
            }
        }
Beispiel #11
0
        private TerminalDTO GetTerminal(ActivityTemplateDO t)
        {
            if (t?.Terminal == null)
            {
                return(null);
            }

            return(Mapper.Map <TerminalDTO>(t.Terminal));
        }
        public static ActivityTemplateDO TestActivityTemplate2()
        {
            ActivityTemplateDO activityTemplateDo = new ActivityTemplateDO
            {
                Id      = GetTestGuidById(1),
                Version = "v4"
            };

            return(activityTemplateDo);
        }
        public static ActivityTemplateDO GetFileListTestActivityTemplateDO()
        {
            ActivityTemplateDO activityTemplateDO = Fixture.Build <ActivityTemplateDO>()
                                                    .With(x => x.Id)
                                                    .With(x => x.Name, "Get File List")
                                                    .With(x => x.Version, "1")
                                                    .OmitAutoProperties()
                                                    .Create();

            return(activityTemplateDO);
        }
        public static ActivityTemplateDO TestActivityTemplateDO2()
        {
            var curActivityDO = new ActivityTemplateDO
            {
                Id       = GetTestGuidById(1),
                Name     = "Write to SQL",
                Terminal = TerminalFour(),
                Version  = "1"
            };

            return(curActivityDO);
        }
        public static ActivityTemplateDO TestActivityTemplateV2()
        {
            var curActionTemplate = new ActivityTemplateDO
            {
                Id       = GetTestGuidById(1),
                Name     = "terminal_azure_sql_server",
                Terminal = TerminalThree(),
                Version  = "1"
            };

            return(curActionTemplate);
        }
        public static ActivityTemplateDO TestActivityTemplateDO1()
        {
            var curActivityDO = new ActivityTemplateDO
            {
                Id       = GetTestGuidById(1),
                Name     = "Type1",
                Terminal = TerminalTwo(),
                Version  = "1"
            };

            return(curActivityDO);
        }
        public static ActivityTemplateDO TestActivityTemplateDO4()
        {
            var curActivityDO = new ActivityTemplateDO
            {
                Name     = "Extract_Data_From_Envelopes",
                Label    = "Extract Data From Envelopes",
                Terminal = TerminalSeven(),
                Version  = "1"
            };

            return(curActivityDO);
        }
        public static ActivityTemplateDO TestActivityTemplate1()
        {
            ActivityTemplateDO activityTemplateDo = new ActivityTemplateDO
            {
                Id       = GetTestGuidById(1),
                Name     = "Write to Sql Server",
                Terminal = TerminalOne(),
                Version  = "v3"
            };

            return(activityTemplateDo);
        }
        public static ActivityTemplateDO TestActivityTemplateDO3()
        {
            var curActivityDO = new ActivityTemplateDO
            {
                Id       = GetTestGuidById(1),
                Name     = "Mail_Merge_Into_DocuSign",
                Label    = "Mail Merge Into DocuSign",
                Terminal = TerminalSeven(),
                Version  = "1"
            };

            return(curActivityDO);
        }
Beispiel #20
0
        public void CanGetOAuthInitiationURL()
        {
            var tokenDO = CreateAndAddTokenDO();

            var activityTemplateDO = new ActivityTemplateDO(
                "test_name", "test_label", "1", "test_description", tokenDO.TerminalID
                );

            activityTemplateDO.Id = FixtureData.GetTestGuidById(1);
            var activityDO = FixtureData.TestActivity1();

            activityDO.ActivityTemplate   = activityTemplateDO;
            activityDO.AuthorizationToken = tokenDO;

            using (var uow = ObjectFactory.GetInstance <IUnitOfWork>())
            {
                uow.TerminalRepository.GetByKey(tokenDO.TerminalID).AuthenticationType = AuthenticationType.Internal;
                uow.ActivityTemplateRepository.Add(activityTemplateDO);
                uow.PlanRepository.Add(new PlanDO()
                {
                    Name       = "name",
                    PlanState  = PlanState.Executing,
                    ChildNodes = { activityDO }
                });
                uow.SaveChanges();
            }

            TerminalDO terminal;

            using (var uow = ObjectFactory.GetInstance <IUnitOfWork>())
            {
                var user = uow.UserRepository.GetByKey(tokenDO.UserID);
                terminal = uow.TerminalRepository.GetByKey(tokenDO.TerminalID);
                var result = _authorization.GetOAuthInitiationURL(user, terminal);
            }
            //Assert
            Mock <IRestfulServiceClient> restClientMock = Mock.Get(ObjectFactory.GetInstance <IRestfulServiceClient>());

            //verify that the post call is made

            restClientMock.Verify(
                client => client.PostAsync(
                    new Uri(terminal.Endpoint + "/authentication/request_url"), It.IsAny <string>(), It.IsAny <Dictionary <string, string> >()
                    ),
                Times.Exactly(1)
                );

            restClientMock.VerifyAll();
        }
 private static bool AreEqual(ActivityTemplateDO a, ActivityTemplateDO b, bool skipId = false)
 {
     return(a.NeedsAuthentication == b.NeedsAuthentication &&
            a.ActivityTemplateState == b.ActivityTemplateState &&
            a.Description == b.Description &&
            (skipId || a.Id == b.Id) &&
            a.Label == b.Label &&
            a.MinPaneWidth == b.MinPaneWidth &&
            a.Name == b.Name &&
            a.Tags == b.Tags &&
            (skipId || a.TerminalId == b.Terminal.Id) &&
            AreEqual(a.Terminal, b.Terminal, skipId) &&
            a.Type == b.Type &&
            a.Version == b.Version &&
            AreEqual(a.Categories, b.Categories, skipId));
 }
Beispiel #22
0
        public void ValidateAuthenticationNeededIsTrue()
        {
            var userDO = CreateAndAddUserDO();

            var terminalDO = CreateAndAddTerminalDO(AuthenticationType.Internal);

            var activityDO  = FixtureData.TestActivity1();
            var activityDTO = new ActivityDTO();

            using (var uow = ObjectFactory.GetInstance <IUnitOfWork>())
            {
                var activityTemplateDO = new ActivityTemplateDO(
                    "test_name",
                    "test_label",
                    "1",
                    "test_description",
                    terminalDO.Id
                    );

                activityTemplateDO.Id = FixtureData.GetTestGuidById(1);
                activityTemplateDO.NeedsAuthentication = true;

                uow.ActivityTemplateRepository.Add(activityTemplateDO);

                activityDO.ActivityTemplate = activityTemplateDO;
                uow.PlanRepository.Add(new PlanDO()
                {
                    Name       = "name",
                    PlanState  = PlanState.Executing,
                    ChildNodes = { activityDO }
                });

                uow.SaveChanges();

                activityDTO.Id = activityDO.Id;
                activityDTO.ActivityTemplate = Mapper.Map <ActivityTemplateSummaryDTO>(activityTemplateDO);
            }
            using (var uow = ObjectFactory.GetInstance <IUnitOfWork>())
            {
                var testResult = _authorization.ValidateAuthenticationNeeded(uow, userDO.Id, activityDTO);

                Assert.IsTrue(testResult);
            }
        }
Beispiel #23
0
        private List <ActivityCategorySetDO> ApplyActivityCategories(
            IUnitOfWork uow,
            ActivityTemplateDO activityTemplate,
            List <ActivityCategoryDO> activityCategories)
        {
            // Remove previously registered ActivityCategorySets.
            var existingActivityCategorySets = uow.ActivityCategorySetRepository
                                               .GetQuery()
                                               .Where(x => x.ActivityTemplateId == activityTemplate.Id)
                                               .ToList();

            foreach (var activityCategorySet in existingActivityCategorySets)
            {
                uow.ActivityCategorySetRepository.Remove(activityCategorySet);
            }

            // Add new activityCategorySets.
            var activityCategorySets = new List <ActivityCategorySetDO>();

            foreach (var activityCategory in activityCategories)
            {
                var registeredActivityCategory = _activityCategory.RegisterOrUpdate(activityCategory);

                var activityCategorySet = new ActivityCategorySetDO()
                {
                    Id = Guid.NewGuid(),
                    ActivityTemplateId = activityTemplate.Id,
                    ActivityCategoryId = registeredActivityCategory.Id
                };

                activityCategorySets.Add(activityCategorySet);
                uow.ActivityCategorySetRepository.Add(activityCategorySet);
            }

            uow.SaveChanges();

            return(activityCategorySets);
        }
Beispiel #24
0
        public void RegisterOrUpdate(ActivityTemplateDO activityTemplateDo)
        {
            if (activityTemplateDo == null)
            {
                return;
            }

            // validate values
            if (string.IsNullOrWhiteSpace(activityTemplateDo.Name))
            {
                throw new ArgumentOutOfRangeException("ActivityTemplate.Name can't be empty");
            }

            if (string.IsNullOrWhiteSpace(activityTemplateDo.Label))
            {
                throw new ArgumentOutOfRangeException("ActivityTemplate.Label can't be empty");
            }

            if (string.IsNullOrWhiteSpace(activityTemplateDo.Version))
            {
                throw new ArgumentOutOfRangeException("ActivityTemplate.Version can't be empty");
            }

            int tempVersion;

            if (!int.TryParse(activityTemplateDo.Version, out tempVersion))
            {
                throw new ArgumentOutOfRangeException($"ActivityTemplate.Version is not a valid integer value: {activityTemplateDo.Version}");
            }

            // we are going to change activityTemplateDo. It is not good to corrupt method's input parameters.
            // make a copy
            var clone = new ActivityTemplateDO();

            CopyPropertiesHelper.CopyProperties(activityTemplateDo, clone, true);

            clone.Terminal = activityTemplateDo.Terminal;

            // Create list of activity categories for current ActivityTemplate.
            var activityCategories = new List <ActivityCategoryDO>();

            if (activityTemplateDo.Categories != null)
            {
                foreach (var acs in activityTemplateDo.Categories)
                {
                    activityCategories.Add(acs.ActivityCategory);
                }
            }

            activityTemplateDo          = clone;
            activityTemplateDo.Terminal = null; // otherwise we can add dupliacte terminals into the DB

            if (!IsATandTCacheDisabled)
            {
                Initialize();
            }

            lock (_activityTemplates)
            {
                using (var uow = ObjectFactory.GetInstance <IUnitOfWork>())
                {
                    // Try to extract existing ActivityTemplate.
                    var activity = uow.ActivityTemplateRepository.GetQuery()
                                   // .Include(x => x.WebService)
                                   .FirstOrDefault(t => t.Name == activityTemplateDo.Name &&
                                                   t.TerminalId == activityTemplateDo.TerminalId &&
                                                   t.Version == activityTemplateDo.Version);

                    // We're creating new ActivityTemplate.
                    if (activity == null)
                    {
                        if (activityTemplateDo.Id == Guid.Empty)
                        {
                            throw new ApplicationException("ActivityTemplate Id not specified");
                        }

                        activity = activityTemplateDo;
                        activityTemplateDo.Categories = null;

                        uow.ActivityTemplateRepository.Add(activityTemplateDo);
                        uow.SaveChanges();

                        activityTemplateDo.Categories = ApplyActivityCategories(uow, activityTemplateDo, activityCategories);
                    }
                    // We're updating existing ActivityTemplate.
                    else
                    {
                        // TODO: FR-4943, this breaks DEV's activity registration, commented out for now.
                        // if (activity.Id != activityTemplateDo.Id)
                        // {
                        //     throw new InvalidOperationException($"Existent activity with same Name ({activity.Name}) and Version ({activity.Version}) that we passed "
                        //     + $"has different Id. (ExistentId = {activity.Id}. Passed Id = {activityTemplateDo.Id}. Changing of activity template Id is not possible. If you need to have another Id please update the version number or create new activity template");
                        // }

                        // This is for updating activity template
                        CopyPropertiesHelper.CopyProperties(activityTemplateDo, activity, false, x => x.Name != "Id");
                        activity.ActivityTemplateState = ActivityTemplateState.Active;

                        uow.SaveChanges();

                        activity.Categories = ApplyActivityCategories(uow, activity, activityCategories);
                    }

                    _activityTemplates[activity.Id] = Clone(activity);
                }
            }
        }
Beispiel #25
0
        public void CanPrepareAuthToken()
        {
            var tokenDO = CreateAndAddTokenDO();


            var activityDTO = new ActivityDTO();

            using (var uow = ObjectFactory.GetInstance <IUnitOfWork>())
            {
                var activityTemplateDO = new ActivityTemplateDO(
                    "test_name",
                    "test_label",
                    "1",
                    "test_description",
                    tokenDO.TerminalID
                    );

                uow.TerminalRepository.GetByKey(tokenDO.TerminalID).AuthenticationType = AuthenticationType.Internal;
                activityTemplateDO.NeedsAuthentication = true;
                uow.ActivityTemplateRepository.Add(activityTemplateDO);
                uow.SaveChanges();

                var planDO = new PlanDO()
                {
                    Id          = FixtureData.GetTestGuidById(23),
                    Description = "HealthDemo Integration Test",
                    Name        = "StandardEventTesting",
                    PlanState   = PlanState.Executing,
                    Fr8Account  = uow.UserRepository.GetByKey(tokenDO.UserID)
                };
                uow.PlanRepository.Add(planDO);
                uow.SaveChanges();

                var activityDO = new ActivityDO()
                {
                    ParentPlanNode   = planDO,
                    ParentPlanNodeId = planDO.Id,
                    Id = FixtureData.GetTestGuidById(1),
                    ActivityTemplateId   = activityTemplateDO.Id,
                    ActivityTemplate     = activityTemplateDO,
                    AuthorizationTokenId = tokenDO.Id,
                    AuthorizationToken   = tokenDO,
                    Ordering             = 1
                };

                planDO.ChildNodes.Add(activityDO);

                // uow.ActivityRepository.Add(activityDO);
                uow.SaveChanges();

                activityDTO.Id = activityDO.Id;
                activityDTO.ActivityTemplate = Mapper.Map <ActivityTemplateSummaryDTO>(activityTemplateDO);
            }

            using (var uow = ObjectFactory.GetInstance <IUnitOfWork>())
            {
                _authorization.PrepareAuthToken(uow, activityDTO);
            }

            Assert.AreEqual(Token, activityDTO.AuthToken.Token);
        }