public async Task HandleAsync_ShouldCreateRequest() { // Arrange var repositoryMock = new Mock <IRepository>(); var sut = new CreateUseCase(repositoryMock.Object); // Act await sut.HandleAsync(new CreateRequest()); // Assert repositoryMock.Verify(x => x.CreateAsync(It.IsAny <Aggregate>()), Times.Once); }
public async Task Test_Create() { var repositoryMock = new Mock <IRepository>(); repositoryMock .Setup(repo => repo.CreateAsync(It.IsAny <Aggregate>())) .Returns(Task.CompletedTask); var useCase = new CreateUseCase(repositoryMock.Object); await useCase.HandleAsync(new CreateRequest()); repositoryMock.VerifyAll(); }