public AccountHandler(IAccountRepository accountRepository, IUserRepository userRepository)
 {
     _accountRepository                     = accountRepository;
     _userRepository                        = userRepository;
     _mapper                                = new AccountMapper();
     _createAccountCommandValidator         = new CreateAccountCommandValidator();
     _addUserToAccountCommandValidator      = new AddUserToAccountCommandValidator();
     _removeUserFromAccountCommandValidator = new RemoveUserFromAccountCommandValidator();
 }
        public void Arrange()
        {
            _createAccountCommand = new CreateAccountCommand
            {
                OrganisationType            = OrganisationType.CompaniesHouse,
                ExternalUserId              = "123ADF",
                OrganisationReferenceNumber = "ABV123",
                OrganisationName            = "Test Company",
                PayeReference      = "980/EEE",
                OrganisationStatus = "active"
            };

            _employerSchemesRepository = new Mock <IEmployerSchemesRepository>();
            _employerSchemesRepository.Setup(x => x.GetSchemeByRef(_createAccountCommand.PayeReference)).ReturnsAsync(null);
            _createCommandValidator = new CreateAccountCommandValidator(_employerSchemesRepository.Object);
        }
Ejemplo n.º 3
0
        public void IsValid_ShouldBeFalse_WhenCreateAccountCommandIsNotValid()
        {
            var commandWithNullAccount = new CreateAccountCommand
            {
                MemberId      = 0,
                MemberAccount = null
            };
            var memberNewAccountDto = new MemberNewAccountDto();

            memberNewAccountDto.Name = "";
            var commandWithEmptyAccountName = new CreateAccountCommand
            {
                MemberId      = 1,
                MemberAccount = memberNewAccountDto
            };
            var validator = new CreateAccountCommandValidator();
            var result    = validator.Validate(commandWithNullAccount);
            var resultForEmptyAccountName = validator.Validate(commandWithEmptyAccountName);

            result.IsValid.ShouldBe(false);
            resultForEmptyAccountName.IsValid.ShouldBe(false);
        }
Ejemplo n.º 4
0
 public CreateAccountCommandValidatorShould()
 {
     validator = new CreateAccountCommandValidator();
 }