Пример #1
0
        public async Task SendCreateTheaterCommand_returns_AcceptedResult(
            CreateNewTheater content,
            InProcessMessageLogger messageBusDummy,
            [NoAutoProperties] CommandsController sut)
        {
            // Act
            IActionResult actual = await
                                   sut.SendCreateTheaterCommand(content, messageBusDummy);

            // Assert
            actual.Should().BeOfType <AcceptedResult>();
        }
Пример #2
0
        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}");
        }
Пример #3
0
        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,
            });
        }