public AuthorizationContextProviderTestsFixture SetInvalidHashAccountLegalEntityPublicHashedId()
        {
            AccountLegalEntityPublicHashedIdRouteValue = "AAA";

            Params[RouteDataKeys.EmployerAccountLegalEntityPublicHashedId] = AccountLegalEntityPublicHashedIdRouteValue;

            AccountLegalEntityPublicHashingService.Setup(h => h.DecodeValue(AccountLegalEntityPublicHashedIdRouteValue)).Throws <Exception>();

            return(this);
        }
        public AuthorizationContextProviderTestsFixture SetValidAccountLegalEntityPublicHashedId()
        {
            AccountLegalEntityPublicHashedIdRouteValue = "ABC123";
            AccountLegalEntityId = 123;

            Params[RouteDataKeys.EmployerAccountLegalEntityPublicHashedId] = AccountLegalEntityPublicHashedIdRouteValue;

            AccountLegalEntityPublicHashingService.Setup(h => h.DecodeValue(AccountLegalEntityPublicHashedIdRouteValue)).Returns(AccountLegalEntityId);

            return(this);
        }
        public override void Arrange()
        {
            base.Arrange();

            _owner = new MembershipView
            {
                AccountId = 1234,
                UserId    = 9876,
                Email     = "*****@*****.**",
                FirstName = "Bob",
                LastName  = "Green",
                UserRef   = Guid.Parse(Command.ExternalUserId),
                Role      = Role.Owner,
            };

            _agreementView = new EmployerAgreementView
            {
                Id                       = 123,
                AccountId                = _owner.AccountId,
                SignedDate               = DateTime.Now,
                SignedByName             = $"{_owner.FirstName} {_owner.LastName}",
                LegalEntityId            = 5246,
                LegalEntityName          = "Test Corp",
                LegalEntityCode          = "3476782638",
                LegalEntitySource        = OrganisationType.CompaniesHouse,
                LegalEntityAddress       = "123 test street",
                LegalEntityInceptionDate = DateTime.Now,
                AccountLegalEntityId     = 830
            };

            MembershipRepository.Setup(x => x.GetCaller(Command.HashedAccountId, Command.ExternalUserId)).ReturnsAsync(_owner);

            AccountRepository.Setup(x => x.CreateLegalEntityWithAgreement(It.Is <CreateLegalEntityWithAgreementParams>(createParams => createParams.AccountId == _owner.AccountId))).ReturnsAsync(_agreementView);

            HashingService.Setup(hs => hs.HashValue(It.IsAny <long>())).Returns <long>(value => $"*{value}*");
            HashingService.Setup(hs => hs.DecodeValue(Command.HashedAccountId)).Returns(_owner.AccountId);

            AccountLegalEntityPublicHashingService.Setup(x => x.HashValue(_agreementView.AccountLegalEntityId)).Returns(ExpectedAccountLegalEntityPublicHashString);
        }