public async void HandleAsync_WithNonInternalUser_ThrowSecurityException(AuthorizationBuilder.UserType userType) { // Arrange var authorization = AuthorizationBuilder.CreateFromUserType(userType); var emailService = A.Fake<IWeeeEmailService>(); SendTestEmailHandler handler = new SendTestEmailHandler(authorization, emailService); // Act Func<Task<bool>> action = () => handler.HandleAsync(A.Dummy<SendTestEmail>()); // Assert await Assert.ThrowsAsync<SecurityException>(action); }
public async void HandleAsync_WithNonInternalUser_ThrowSecurityException(AuthorizationBuilder.UserType userType) { // Arrange var authorization = AuthorizationBuilder.CreateFromUserType(userType); var emailService = A.Fake <IWeeeEmailService>(); SendTestEmailHandler handler = new SendTestEmailHandler(authorization, emailService); // Act Func <Task <bool> > action = () => handler.HandleAsync(A.Dummy <SendTestEmail>()); // Assert await Assert.ThrowsAsync <SecurityException>(action); }
public async void HandleAsync_SendEmailToSpecifiedAddress() { // Arrange var authorization = A.Fake<IWeeeAuthorization>(); var emailService = A.Fake<IWeeeEmailService>(); SendTestEmailHandler handler = new SendTestEmailHandler(authorization, emailService); // Act await handler.HandleAsync(new SendTestEmail("[email protected]")); // Assert A.CallTo(() => emailService.SendTestEmail("[email protected]")) .MustHaveHappened(); }
public async void HandleAsync_SendEmailToSpecifiedAddress() { // Arrange var authorization = A.Fake <IWeeeAuthorization>(); var emailService = A.Fake <IWeeeEmailService>(); SendTestEmailHandler handler = new SendTestEmailHandler(authorization, emailService); // Act await handler.HandleAsync(new SendTestEmail("[email protected]")); // Assert A.CallTo(() => emailService.SendTestEmail("[email protected]")) .MustHaveHappened(); }