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); }
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); }
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); }