Beispiel #1
0
        public async Task SendCreateMovieCommand_returns_AcceptedResult(
            CreateNewMovie content,
            InProcessMessageLogger messageBusDummy,
            [NoAutoProperties] CommandsController sut)
        {
            // Act
            IActionResult actual = await
                                   sut.SendCreateMovieCommand(content, messageBusDummy);

            // Assert
            actual.Should().BeOfType <AcceptedResult>();
        }
Beispiel #2
0
        public async Task SendCreateMovieCommand_sets_location_correctly(
            CreateNewMovie content,
            InProcessMessageLogger messageBusSpy,
            [NoAutoProperties] CommandsController sut)
        {
            // Act
            IActionResult result = await
                                   sut.SendCreateMovieCommand(content, messageBusSpy);

            // Assert
            var accepted = (AcceptedResult)result;
            IEnumerable <Envelope> log = messageBusSpy.Log;
            Guid movieId = log.Single().Message.As <CreateMovie>().MovieId;

            accepted.Location.Should().Be($"api/queries/Movies/{movieId}");
        }
Beispiel #3
0
        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 });
        }