Exemplo n.º 1
0
        public void MakeSideBySideBookinForSameSpace()
        {
            // Arrange
            var booking_repository = new InMemoryBookingRepository();
            var response_handler   = new MakeBookingResponseHandler();
            var validator          = new BookingValidator();
            var booking_a          = new Booking {
                Id = 4, Name = "FirstName1 LastName1", Start = new DateTime(2018, 1, 1, 10, 0, 0), End = new DateTime(2018, 1, 1, 11, 0, 0), Space = new Space {
                    Name = "Boardroom"
                }
            };
            var booking_b = new Booking {
                Id = 5, Name = "FirstName1 LastName1", Start = new DateTime(2018, 1, 1, 11, 0, 0), End = new DateTime(2018, 1, 1, 12, 0, 0), Space = new Space {
                    Name = "Boardroom"
                }
            };

            var make_booking_interaction = new MakeBookingInteractor(response_handler, booking_repository, validator);

            make_booking_interaction.Booking = booking_a;

            // Act / Assert
            make_booking_interaction.Execute();

            Assert.IsTrue(response_handler.WasSuccessful);

            make_booking_interaction.Booking = booking_b;

            make_booking_interaction.Execute();

            Assert.IsTrue(response_handler.WasSuccessful);
        }
Exemplo n.º 2
0
        public void MakeANullBooking()
        {
            // Arrange
            var booking_repository       = new InMemoryBookingRepository();
            var response_handler         = new MakeBookingResponseHandler();
            var validator                = new BookingValidator();
            var make_booking_interaction = new MakeBookingInteractor(response_handler, booking_repository, validator);

            // Act
            make_booking_interaction.Execute();

            // Assert
            Assert.IsTrue(make_booking_interaction.Booking == null);
            Assert.IsTrue(response_handler.Exception != null);
            Assert.IsTrue(response_handler.Exception.GetType() == typeof(ArgumentException));
        }
Exemplo n.º 3
0
        public void MakeABookingWithoutAName()
        {
            // Arrange
            var booking_repository       = new InMemoryBookingRepository();
            var response_handler         = new MakeBookingResponseHandler();
            var validator                = new BookingValidator();
            var make_booking_interaction = new MakeBookingInteractor(response_handler, booking_repository, validator);

            make_booking_interaction.Booking = new Booking {
                Start = new DateTime(2018, 1, 1, 10, 0, 0), End = new DateTime(2018, 1, 1, 11, 0, 0), Space = new Space {
                    Name = "Boardroom"
                }
            };

            // Act
            make_booking_interaction.Execute();

            // Assert
            Assert.IsFalse(response_handler.WasSuccessful);
        }