public void AccountIdIsLessThan1(long accountId) { var command = new UnsubscribeNotificationCommand { UserRef = "ABBA123", AccountId = accountId }; var result = _sut.Validate(command); result.IsValid().Should().BeFalse(); }
public void CommandIsValid() { var command = new UnsubscribeNotificationCommand { UserRef = "ABBA123", AccountId = 123456 }; var result = _sut.Validate(command); result.IsValid().Should().BeTrue(); }
public void ThenUserIdIsNull(string userId) { var command = new UnsubscribeNotificationCommand { UserRef = userId, AccountId = 123456 }; var result = _sut.Validate(command); result.IsValid().Should().BeFalse(); }
public void SetUp() { _command = new UnsubscribeNotificationCommand { UserRef = "ABBA12", AccountId = 123456 }; _mockValidator = new Mock <IValidator <UnsubscribeNotificationCommand> >(); _notiApi = new Mock <INotificationsApi>(); _userRepo = new Mock <IUserRepository>(); _accountRepository = new Mock <IAccountRepository>(); _userRepo.Setup(m => m.GetUserByRef(_command.UserRef)) .ReturnsAsync(new User { FirstName = "First name", LastName = "Last name", Email = "*****@*****.**", Id = 99L, UserRef = _command.UserRef }); _accountRepository.Setup(m => m.GetUserAccountSettings(_command.UserRef)) .ReturnsAsync(new List <UserNotificationSetting> { new UserNotificationSetting { AccountId = _command.AccountId, HashedAccountId = "ABBA12", Id = 123456L, Name = "Account Name", ReceiveNotifications = true } }); _sut = new UnsubscribeNotificationHandler( _mockValidator.Object, _notiApi.Object, _userRepo.Object, _accountRepository.Object, Mock.Of <ILog>()); }