예제 #1
0
        public void Should_Release_ParkingSpace_And_Then_Be_Available()
        {
            var parkingSpace = new ParkingSpace(ParkingSpaceType.Car);

            parkingSpace.Occupy(2);
            parkingSpace.Release();

            Assert.True(parkingSpace.IsAvailable());
        }
예제 #2
0
        public void Should_Calculate_Time_Spent_On_ParkingSpace()
        {
            var parkingSpace = new ParkingSpace(ParkingSpaceType.Car);

            parkingSpace.Occupy(2);
            Thread.Sleep(2000); //2seg
            parkingSpace.Release();

            var expected = (double)2000 / 60000; //ms to min

            Assert.Equal(expected.ToString("0.##"),
                         parkingSpace.CalculateTimeSpent().ToString("0.##"));
        }