Example #1
0
        public void GivenInvalidParameterName_WhenCallingAction_ShouldGetBadRequest(string showName, string seatNumber)
        {
            // ARRANGE
            var controller = new CinemaController(_bookingServiceMock.Object, _cinemaShowServiceMock.Object, _seatServiceMock.Object);

            // ACT
            var response = controller.BookCinemaShow(showName, seatNumber) as ObjectResult;

            // ASSERT
            response.Should().NotBeNull();
            response.StatusCode.Should().Be(400);
        }
Example #2
0
        public void GivenBookingAShow_WhenNotAbleToBookAShow_ShouldGetBadRequest()
        {
            // ARRANGE
            _bookingServiceMock.Setup(s => s.BookSeat(It.IsAny <string>(), It.IsAny <string>())).Returns(() => false);
            var controller = new CinemaController(_bookingServiceMock.Object, _cinemaShowServiceMock.Object, _seatServiceMock.Object);

            // ACT
            var response = controller.BookCinemaShow(_fixture.Create <string>(), _fixture.Create <string>()) as ObjectResult;

            // ASSERT
            response.Should().NotBeNull();
            response.StatusCode.Should().Be(400);
        }
Example #3
0
        public void GivenBookingAShow_WhenCallingActionExceptionOccurs_ShouldGetConflict()
        {
            // ARRANGE
            _bookingServiceMock.Setup(s => s.BookSeat(It.IsAny <string>(), It.IsAny <string>())).Returns(() => throw new Exception());
            var controller = new CinemaController(_bookingServiceMock.Object, _cinemaShowServiceMock.Object, _seatServiceMock.Object);

            // ACT
            var response = controller.BookCinemaShow(_fixture.Create <string>(), _fixture.Create <string>()) as ObjectResult;

            // ASSERT
            response.Should().NotBeNull();
            response.StatusCode.Should().Be(409);
        }