예제 #1
0
        public async Task GetUsersById_WhenUSerNotFound_ReturnsUSerNotFoundResponse()
        {
            var userId = Guid.NewGuid();

            _mockUserManger.Setup(e => e.FindByIdAsync(userId.ToString()))
            .ReturnsAsync((User)null);
            var mappedUser = Fixture.Create <UserDto>();

            mockUserMapper.Setup(e => e.MapToModel(It.IsAny <User>()))
            .Returns(mappedUser);

            var response = await sut.GetUsersById(userId);

            response.IsSuccess.Should().BeFalse();
            response.ResponseException !.ErrorCode.Should().Be(ErrorCode.UserNotFound);
            response.ResponseException.ErrorMessage.Should().Be(ErrorCode.UserNotFound.GetDescription());
        }