public async Task FetchChallengeParticipantsAsync_ShouldBeNoContentResult() { // Arrange TestMock.ParticipantQuery.Setup(queries => queries.FetchChallengeParticipantsAsync(It.IsAny <ChallengeId>())) .ReturnsAsync(Array.Empty <Participant>()) .Verifiable(); var controller = new ChallengeParticipantsController(TestMock.ParticipantQuery.Object, TestMapper); // Act var result = await controller.FetchChallengeParticipantsAsync(new ChallengeId()); // Assert result.Should().BeOfType <NoContentResult>(); TestMock.ParticipantQuery.Verify(participantQuery => participantQuery.FetchChallengeParticipantsAsync(It.IsAny <ChallengeId>()), Times.Once); }
public async Task FetchChallengeParticipantsAsync_ShouldBeOkObjectResult() { // Arrange var challengeFaker = TestData.FakerFactory.CreateChallengeFaker(25392992, Game.LeagueOfLegends); var challenge = challengeFaker.FakeChallenge(); TestMock.ParticipantQuery.Setup(participantQuery => participantQuery.FetchChallengeParticipantsAsync(It.IsAny <ChallengeId>())) .ReturnsAsync(challenge.Participants) .Verifiable(); var controller = new ChallengeParticipantsController(TestMock.ParticipantQuery.Object, TestMapper); // Act var result = await controller.FetchChallengeParticipantsAsync(new ChallengeId()); // Assert result.Should().BeOfType <OkObjectResult>(); TestMock.ParticipantQuery.Verify(participantQuery => participantQuery.FetchChallengeParticipantsAsync(It.IsAny <ChallengeId>()), Times.Once); }