Ejemplo n.º 1
0
        public void Reserve_RequiresValidIdentifier()
        {
            var spaceRepositoryTestDouble = new SpaceRepositoryTestDouble();
            var reservationService        = new ReservationService(spaceRepositoryTestDouble);

            Assert.Throws <ArgumentException>(() => reservationService.Reserve(0));
        }
Ejemplo n.º 2
0
        public void Reserve_ReservesExistingSpaceCorrectly_AndReturnsTrue()
        {
            var       spaceRepositoryTestDouble = new SpaceRepositoryTestDouble();
            var       reservationService        = new ReservationService(spaceRepositoryTestDouble);
            const int identifier = 89;

            spaceRepositoryTestDouble.Spaces.Add(identifier, new Space()
            {
                Identifier = identifier,
                Location   = 7,
                IsReserved = false
            });
            var result = reservationService.Reserve(identifier);

            Assert.True(spaceRepositoryTestDouble.Spaces[identifier].IsReserved);
            Assert.True(result);
        }