Esempio n. 1
0
        public void ReturnsBookingConfirmationNumber()
        {
            string confirmationNumber = Guid.NewGuid().ToString();

            confNumGenMock.Setup(gen => gen.Generate()).Returns(confirmationNumber);
            var result = sut.Book(new Vessel(10), new Cargo(5));

            Assert.Equal(confirmationNumber, result.Value);
        }
Esempio n. 2
0
        public void OverbookingPolicyRejects()
        {
            string confirmationNumber = Guid.NewGuid().ToString();

            confNumGenMock.Setup(gen => gen.Generate()).Returns(confirmationNumber);
            var bookingPolicy = new OverbookingPolicy();

            sut = new BookingManager(confNumGenMock.Object, bookingPolicy);
            var vessel = new Vessel(10);
            var actual = sut.Book(vessel, new Cargo(12));

            Assert.IsType <VesselAtCapacity>(actual.Error);
        }
Esempio n. 3
0
        public void OverbookingPolicyAccepts()
        {
            string confirmationNumber = Guid.NewGuid().ToString();

            confNumGenMock.Setup(gen => gen.Generate()).Returns(confirmationNumber);
            var bookingPolicy = new OverbookingPolicy();

            sut = new BookingManager(confNumGenMock.Object, bookingPolicy);
            var vessel = new Vessel(10);
            var actual = sut.Book(vessel, new Cargo(11));

            Assert.Equal(confirmationNumber, actual.Value);
        }