Ejemplo n.º 1
0
        public void EnterStation_2Planes()
        {
            //Arrange

            var s1 = new LogicStation()
            {
                WaitingTime   = TimeSpan.FromSeconds(4),
                StationNumber = 1
            };

            var plane1 = new Plane()
            {
                Route        = new MockRoute(),
                FlightNumber = "0"
            };

            var plane2 = new Plane()
            {
                Route        = new MockRoute(),
                FlightNumber = "1"
            };

            //Act

            s1.EnterStation(plane1);
            Thread.Sleep(50);

            s1.EnterStation(plane2);
            Thread.Sleep(50);

            //Assert


            testStationService.IsCurrentPlane(s1, "0");
            testStationService.IsExistInWaitingLine(s1, "1");

            Thread.Sleep(TimeSpan.FromSeconds(4.1));
            testStationService.IsCurrentPlane(s1, "1");
            testStationService.IsWaitingLineEmpty(s1);

            Thread.Sleep(TimeSpan.FromSeconds(4.1));
            Assert.IsFalse(testStationService.HasCurrentPlane(s1));
        }
Ejemplo n.º 2
0
        public void EnterStation_1Plane()
        {
            //Arrange
            var station1 = new LogicStation
            {
                WaitingTime = TimeSpan.FromSeconds(2)
            };

            var plane = new Plane()
            {
                Route = new MockRoute()
            };

            //Act
            station1.EnterStation(plane);

            //Assert
            Thread.Sleep(10);
            Assert.IsTrue(station1.CurrentPlane.Equals(plane));

            Thread.Sleep(TimeSpan.FromSeconds(2.01));
            Assert.IsTrue(station1.CurrentPlane == null);
        }