public void Handle_NotFoundCategory_ShouldThrowArgException() { // Arrange var handler = new ChangeIssueStatusCommandHandler(GetCategoryRepository().Object, GetMapper()); var request = new ChangeIssueStatusCommand { CategoryId = 2, IssueName = "Clean up room" }; // Act var del = new AsyncTestDelegate(() => handler.Handle(request, CancellationToken.None)); // Assert Assert.ThrowsAsync <System.ArgumentException>(del); }
public async Task Handle_ExistingIssue_ShouldSaveChangedIssue() { // Arrange var categoryRepositoryMock = GetCategoryRepository(); var handler = new ChangeIssueStatusCommandHandler(categoryRepositoryMock.Object, GetMapper()); var request = new ChangeIssueStatusCommand { CategoryId = 1, IssueName = "Clean up room" }; // Act var actual = await handler.Handle(request, CancellationToken.None); // Assert categoryRepositoryMock.Verify(x => x.SaveCategory(It.IsAny <Category>()), Times.Once); Assert.IsTrue(actual.IsCompleted); }