Example #1
0
        public async Task SendAddScreeningCommand_returns_AcceptedResult(
            AddNewScreening source,
            IMessageBus messageBusDummy,
            [NoAutoProperties] CommandsController sut)
        {
            // Act
            IActionResult actual = await
                                   sut.SendAddScreeningCommand(source, messageBusDummy);

            // Assert
            actual.Should().BeOfType <AcceptedResult>();
        }
Example #2
0
        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);
        }
Example #3
0
        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);
        }