Example #1
0
        public async Task EnterParkingLot_Execute_ShouldEnterParkingLot()
        {
            //Arrrange
            var parkingLotRepositoryMemory = new ParkingLotRepositoryMemory();
            var enterParkingLot            = new EnterParkingLot(parkingLotRepositoryMemory);
            var getParkingLot = new GetParkingLot(parkingLotRepositoryMemory);

            //Act & Assert
            var parkingLotBeforeEnter = await getParkingLot.Execute("shopping");

            Assert.Equal(0, parkingLotBeforeEnter.OccupiedSpaces);
            await enterParkingLot.Execute("shopping", "MMM-0001", DateTime.Now);

            var parkingLotAfterEnter = await getParkingLot.Execute("shopping");

            Assert.Equal(1, parkingLotAfterEnter.OccupiedSpaces);
        }
Example #2
0
        public async Task EnterParkingLot_Execute_ShouldBeClosed()
        {
            //Arrange
            var parkingLotRepositoryMemory = new ParkingLotRepositoryMemory();
            var enterParkingLot            = new EnterParkingLot(parkingLotRepositoryMemory);
            var getParkingLot = new GetParkingLot(parkingLotRepositoryMemory);

            //Act & Assert
            var parkingLot = await getParkingLot.Execute("shopping");

            Assert.True(!parkingLot.IsOpen(new DateTime(2021, 04, 17, 23, 0, 0)));
        }
Example #3
0
        public async Task EnterParkingLot_Execute_ShouldBeFull()
        {
            //Arrange
            var parkingLotRepositoryMemory = new ParkingLotRepositoryMemory();
            var enterParkingLot            = new EnterParkingLot(parkingLotRepositoryMemory);
            var getParkingLot = new GetParkingLot(parkingLotRepositoryMemory);


            //Act & Assert
            //await enterParkingLot.Execute("shopping", "MMM-0001", DateTime.Now);
            //await enterParkingLot.Execute("shopping", "MMM-0002", DateTime.Now);
            //await enterParkingLot.Execute("shopping", "MMM-0003", DateTime.Now);
            //await enterParkingLot.Execute("shopping", "MMM-0004", DateTime.Now);
            //await enterParkingLot.Execute("shopping", "MMM-0005", DateTime.Now);
            //await enterParkingLot.Execute("shopping", "MMM-0006", DateTime.Now);
            var parkingLot = await getParkingLot.Execute("shopping");

            Assert.True(!parkingLot.IsFull());
        }