public void ShouldThrowExceptionAndNotSaveGivenEmailAlreadyExists() { userRepositoryMock.Setup(repo => repo.IsUserIdExistsAsync(It.IsAny <Guid>())) .ReturnsAsync(false); userRepositoryMock.Setup(repo => repo.IsEmailExistsAsync(It.IsAny <string>())) .ReturnsAsync(true); var exception = Assert.ThrowsAsync <BusinessValidationException> (async() => await userService.CreateAsync(mockUser)); Assert.That(exception.Message, Is.EqualTo("Email already exists")); userRepositoryMock.Verify(repo => repo.CreateAsync(mockUser), Times.Never); }