public async Task GetUsers_WhenUsersDoNotExist_ShouldReturnEmptyCollection() { // Arrange var service = new UserHandlerV1(this._mockLogger.Object); // Act GetUsersResponse response = await service.GetUsers(new Empty(), TestServerCallContext.Create()); // Asserts response.Users.Should().BeEmpty(); }
public async Task GetUserById_WhenUserDoesNotExist_ShouldThrowRpcException() { // Arrange var service = new UserHandlerV1(this._mockLogger.Object); string userId = Guid.NewGuid().ToString(); var request = new GetUserByIdRequest { Uuid = userId }; // Act RpcException thrownException = await Assert.ThrowsAsync <RpcException>(() => service.GetUserById(request, TestServerCallContext.Create())); // Assert thrownException.Status.StatusCode.Should().Be(StatusCode.NotFound); thrownException.Status.Detail.Should().Be($"User with id {userId} was not found"); }