public async Task GivenValidRequest_WhenTheUserDoesNotExist_ThrowsApiExceptionForNotFound() { // Arrange var getProfileRequest = new GetProfileQuery("aUserThatDoesNotExist"); // Act var request = new GetProfileQueryQueryHandler(Mapper, Context, CurrentUserContext); await Should.ThrowAsync <ConduitApiException>(async() => { await request.Handle(getProfileRequest, CancellationToken.None); }); }
public async Task GivenValidRequest_WhenTheUserExists_ReturnsProfileViewModel() { // Arrange var getProfileRequest = new GetProfileQuery("joey.mckenzie"); // Act var request = new GetProfileQueryQueryHandler(Mapper, Context, CurrentUserContext); var response = await request.Handle(getProfileRequest, CancellationToken.None); // Assert response.ShouldNotBeNull(); response.ShouldBeOfType <ProfileViewModel>(); response.Profile.ShouldNotBeNull(); response.Profile.ShouldBeOfType <ProfileDto>(); response.Profile.Username.ShouldBe("joey.mckenzie"); response.Profile.Following.ShouldBe(true); }