public async Task SendCreateTheaterCommand_sets_location_correctly( CreateNewTheater content, InProcessMessageLogger messageBusSpy, [NoAutoProperties] CommandsController sut) { // Act IActionResult result = await sut.SendCreateTheaterCommand(content, messageBusSpy); // Assert var accepted = (AcceptedResult)result; IEnumerable <Envelope> log = messageBusSpy.Log; Guid theaterId = log.Single().Message.As <CreateTheater>().TheaterId; accepted.Location.Should().Be($"api/queries/Theaters/{theaterId}"); }
public async Task SendCreateMovieCommand_sends_command_correctly( CreateNewMovie source, InProcessMessageLogger messageBusSpy, [NoAutoProperties] CommandsController sut) { // Act await sut.SendCreateMovieCommand(source, messageBusSpy); // Assert IEnumerable <Envelope> log = messageBusSpy.Log; log.Should().ContainSingle(); log.Single().Message.Should().BeOfType <CreateMovie>(); var actual = (CreateMovie)log.Single().Message; actual.MovieId.Should().NotBeEmpty(); actual.Should().BeEquivalentTo(new { source.Title }); }
public async Task SendAddScreeningCommand_sends_command_correctly( AddNewScreening source, InProcessMessageLogger messageBusSpy, [NoAutoProperties] CommandsController sut) { // Act await sut.SendAddScreeningCommand(source, messageBusSpy); // Assert IEnumerable <Envelope> log = messageBusSpy.Log; log.Should().ContainSingle(); log.Single().Message.Should().BeOfType <AddScreening>(); var actual = (AddScreening)log.Single().Message; actual.MovieId.Should().NotBeEmpty(); actual.Should().BeEquivalentTo(source); }
public async Task SendAddScreeningCommand_sets_location_correctly( AddNewScreening source, InProcessMessageLogger messageBusSpy, [NoAutoProperties] CommandsController sut) { // Act dynamic result = await sut.SendAddScreeningCommand(source, messageBusSpy); // Assert Guid movieId = source.MovieId; IEnumerable <Envelope> log = messageBusSpy.Log; dynamic message = log.Single().Message; Guid screeningId = message.ScreeningId; string actual = result.Location; string uri = $"api/queries/Movies/{movieId}/Screenings/{screeningId}"; actual.Should().Be(uri); }
public async Task SendCreateTheaterCommand_sends_command_correctly( CreateNewTheater source, InProcessMessageLogger messageBusSpy, [NoAutoProperties] CommandsController sut) { // Act await sut.SendCreateTheaterCommand(source, messageBusSpy); // Assert IEnumerable <Envelope> log = messageBusSpy.Log; log.Should().ContainSingle(); log.Single().Message.Should().BeOfType <CreateTheater>(); var actual = (CreateTheater)log.Single().Message; actual.TheaterId.Should().NotBeEmpty(); actual.Should().BeEquivalentTo(new { source.Name, source.SeatRowCount, source.SeatColumnCount, }); }