Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }