public async Task <IActionResult> FindTheater( [FromRoute] Guid theaterId, [FromServices] TheaterReadModelFacade readModelFacade) { TheaterDto theater = await readModelFacade.FindTheater(theaterId); return(theater == null?NotFound() : (IActionResult)Ok(theater)); }
public async Task given_theater_not_found_then_FindTheater_returns_NotFoundResult( Guid theaterId, InMemoryTheaterRepository readerStub, [NoAutoProperties] QueriesController sut) { var facade = new TheaterReadModelFacade(readerStub); IActionResult actual = await sut.FindTheater(theaterId, facade); actual.Should().BeOfType <NotFoundResult>(); }
public async Task given_theater_found_then_FindTheater_returns_OkObjectResult( Theater theater, InMemoryTheaterRepository readerStub, [NoAutoProperties] QueriesController sut) { readerStub.Data[theater.Id] = theater; var facade = new TheaterReadModelFacade(readerStub); IActionResult actual = await sut.FindTheater(theater.Id, facade); actual.Should().BeOfType <OkObjectResult>(); }
public async Task GetAllTheaters_returns_transfer_objects_as_content( Theater[] theaters, InMemoryTheaterRepository readerStub, [NoAutoProperties] QueriesController sut) { theaters.ForEach(t => readerStub.Data[t.Id] = t); var facade = new TheaterReadModelFacade(readerStub); var actual = (OkObjectResult)await sut.GetAllTheaters(facade); actual.Value.Should().BeEquivalentTo(await facade.GetAllTheaters()); }
public async Task GetAllTheaters_returns_OkObjectResult( Theater[] theaters, InMemoryTheaterRepository readerStub, [NoAutoProperties] QueriesController sut) { theaters.ForEach(t => readerStub.Data[t.Id] = t); var facade = new TheaterReadModelFacade(readerStub); IActionResult actual = await sut.GetAllTheaters(facade); actual.Should().BeOfType <OkObjectResult>(); }
public async Task given_theater_found_then_FindTheater_returns_transfer_object_as_content( Theater theater, InMemoryTheaterRepository readerStub, [NoAutoProperties] QueriesController sut) { readerStub.Data[theater.Id] = theater; var facade = new TheaterReadModelFacade(readerStub); IActionResult result = await sut.FindTheater(theater.Id, facade); object actual = result.As <OkObjectResult>().Value; actual.Should().BeOfType <TheaterDto>(); actual.Should().BeEquivalentTo(new { theater.Id, theater.Name, theater.SeatRowCount, theater.SeatColumnCount, }); }
public async Task <IActionResult> GetAllTheaters( [FromServices] TheaterReadModelFacade readModelFacade) { return(Ok(await readModelFacade.GetAllTheaters())); }