public async Task ObterPartidaPorTimeIdAsync_PartidaServico_RetornarListaComPartidasDeTimeEspecificado() { var timeId = _memoryDb.Times.First().Id; var partidas = await _partidaServico .ObterPartidaPorTimeIdAsync(timeId); partidas.Should() .HaveCount(3) .And.SatisfyRespectively( p1 => { p1.PrimeiroTimeId.Should().Be(_memoryDb.Times.First().Id); p1.SegundoTimeId.Should().Be(_memoryDb.Times.Last().Id); p1.QuadraFutebolId.Should().Be(_memoryDb.Quadras.Last().Id); p1.HorasPartida.Should().Be(1); p1.DataPartida.Should().Be(new DateTime(2020, 10, 20, 21, 0, 0)); p1.StatusPartida.Should().Be(StatusPartida.Confirmada); }, p2 => { p2.PrimeiroTimeId.Should().Be(_memoryDb.Times.ToList()[1].Id); p2.SegundoTimeId.Should().Be(_memoryDb.Times.First().Id); p2.QuadraFutebolId.Should().Be(_memoryDb.Quadras.ToList()[1].Id); p2.HorasPartida.Should().Be(1); p2.DataPartida.Should().Be(new DateTime(2020, 10, 19, 18, 0, 0)); p2.StatusPartida.Should().Be(StatusPartida.AguardandoConfirmacao); }, p3 => { p3.PrimeiroTimeId.Should().Be(_memoryDb.Times.First().Id); p3.SegundoTimeId.Should().Be(_memoryDb.Times.ToList()[1].Id); p3.QuadraFutebolId.Should().Be(_memoryDb.Quadras.First().Id); p3.HorasPartida.Should().Be(1); p3.DataPartida.Should().Be(new DateTime(2020, 10, 16, 20, 0, 0)); p3.StatusPartida.Should().Be(StatusPartida.Finalizada); }); }
public async Task <IEnumerable <PartidaModel> > Handle(ObterPartidasPorTimeIdQuery request, CancellationToken cancellationToken) { return(await _partidaServico .ObterPartidaPorTimeIdAsync(request.TimeId)); }