Exemplo n.º 1
0
        public async Task Return_Null_If_No_Current_Round_Found(GetRoundById query, [Frozen] Mock <IRoundRepository> repoMock, RoundQueryHandler sut, Fixture fixture)
        {
            //Arrange
            repoMock.Setup(x => x.GetCurrentRound(query.GameId))
            .ReturnsAsync((Persistence.Model.Round)null);

            //Act
            var result = await sut.Handle(query, CancellationToken.None);

            //Assert
            result.ShouldBeNull();
        }
Exemplo n.º 2
0
        public async Task Get_Current_Round(GetCurrentRound query, [Frozen] Mock <IRoundRepository> repoMock, RoundQueryHandler sut, Fixture fixture)
        {
            //Arrange
            var round = fixture.Build <Persistence.Model.Round>()
                        .With(x => x.Id, query.GameId)
                        .Create();

            repoMock.Setup(x => x.GetCurrentRound(query.GameId)).ReturnsAsync(round);

            //Act
            var result = await sut.Handle(query, CancellationToken.None);

            //Assert
            result.ShouldNotBeNull();
            result.ShouldBeOfType <Round>();
            result.GameId.ShouldBe(query.GameId);
        }