public void GetByUserNameDetailedAsync_ThrowsNotFoundExceptionIfUserDoesNotExist() { _userRepoMock.Setup(r => r.GetByUserNameAsync(It.IsAny <string>(), true)).ReturnsAsync(null as User); UserBl bl = new UserBl(_userRepoMock.Object, _mapper, _puRepoMock.Object); Assert.ThrowsAsync <NotFoundResponseException>(async() => await bl.GetByUserNameAsync(It.IsAny <string>(), true)).Wait(); }
public void GetByUserNameDetailedAsync_ReturnsUser() { _userRepoMock.Setup(r => r.GetByUserNameAsync(It.IsAny <string>(), true)).ReturnsAsync(user1); UserBl bl = new UserBl(_userRepoMock.Object, _mapper, _puRepoMock.Object); var u = bl.GetByUserNameAsync(It.IsAny <string>(), true).Result; _userRepoMock.Verify(r => r.GetByUserNameAsync(It.IsAny <string>(), true)); }