示例#1
0
        public void RequestEntry()
        {
            //UV.ValidateEntryRequest(KodeGenerator.id);
            //bool IDStatus = UV.ValidateEntryRequest(status);

            //if( IDStatus== true)
            //{
            //    Door.OpenDoor();
            //    Console.WriteLine("Door Open");
            //}
            //else
            //{
            //    Door.CloseDoor();
            //    Console.WriteLine("Door closed");
            //}
            switch (doorState)
            {
            case DoorState.Closed:
                _door.OpenDoor();
                doorState = DoorState.Opening;
                break;

            case DoorState.Opening:
                _door.CloseDoor();
                doorState = DoorState.Closing;
                break;

            case DoorState.Closing:
                _door.CloseDoor();
                doorState = DoorState.Closed;
                break;
            }
        }
 public void ChargeController_SetValue_on_CurrentChanged(double current, double expected)
 {
     _door.CloseDoor();
     _usbCharger.Connected.Returns(true);
     _usbCharger.CurrentValueEvent += Raise.EventWith(new CurrentChangedEventArgs {
         Current = current
     });
     Assert.That(_uut.Current, Is.EqualTo(expected));
 }
示例#3
0
        public void DoorClosed_OpenDoor_AssertDoorMoveEvent_Raised()
        {
            // Act
            _door.OpenDoor();
            _door.CloseDoor();

            // Assert
            Assert.That(_doorMoveEventArgs, Is.Not.Null);
        }
示例#4
0
 private void Update()
 {
     if (timer > 0)
     {
         timer -= Time.deltaTime;
         if (timer <= 0f)
         {
             door.CloseDoor();
         }
     }
 }
示例#5
0
 private void OnTriggerExit2D(Collider2D collider)
 {
     if (collider.GetComponent <CharacterController2D>() != null)
     {
         door.CloseDoor();
     }
 }
示例#6
0
 private void OnTriggerExit2D(Collider2D other)
 {
     if (other.CompareTag("Object_Box"))
     {
         door.CloseDoor();
     }
 }
示例#7
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.R))
     {
         doorA.OpenDoor();
     }
     if (Input.GetKeyDown(KeyCode.T))
     {
         doorA.CloseDoor();
     }
     if (Input.GetKeyDown(KeyCode.F))
     {
         doorB.OpenDoor();
     }
     if (Input.GetKeyDown(KeyCode.G))
     {
         doorB.CloseDoor();
     }
     if (Input.GetKeyDown(KeyCode.V))
     {
         doorC.OpenDoor();
     }
     if (Input.GetKeyDown(KeyCode.B))
     {
         doorC.CloseDoor();
     }
 }
 public void ChangeState(IDoor door, ILight light, IHeater heater, IStartButton startButton, ITimer timer)
 {
     door.CloseDoor();
     light.TurnOnLight();
     heater.TurnOn();
     startButton.ButtonIsPressed();
     timer.Start();
 }
        public void Door_ClosedDoor_EventFired()
        {
            var wasCalled = false;

            _uut.DoorCloseEvent += (sender, args) => wasCalled = true;

            _uut.CloseDoor();
            Assert.True(wasCalled);
        }
示例#10
0
 public DoorControlClass(Door door)
 {
     this._door = door;
     _door.CloseDoor();
     doorState = DoorState.Closed;
 }
示例#11
0
 public void CloseDoor()
 {
     _door.CloseDoor();
 }
示例#12
0
 public void CloseDoor_event_fired()
 {
     _uut.CloseDoor();
     Assert.That(_eventArgDoorOpen, Is.Not.Null);
 }
示例#13
0
    static void Main(string[] args)
    {
        //set up DI
        ServiceProvider   ServiceProvider;
        ServiceCollection services = new ServiceCollection();

        //register services and build service provider
        ConfigureServices(services);
        ServiceProvider = services.BuildServiceProvider();

        //get instances
        IDoor          door            = ServiceProvider.GetService <IDoor>();
        IRfidReader    rfidReader      = ServiceProvider.GetService <IRfidReader>();
        IDisplay       Display         = ServiceProvider.GetService <IDisplay>();
        StationControl _stationControl = ServiceProvider.GetService <StationControl>();
        //local vars
        bool finish = false;

        do
        {
            Display.NotifyStation("Indtast E, O, C, R: ");
            string input = Display.ReadInput();
            if (string.IsNullOrEmpty(input))
            {
                continue;
            }

            switch (input[0])
            {
            case 'E':
                finish = true;
                break;

            case 'O':
                door.OpenDoor();
                break;

            case 'C':
                door.CloseDoor();
                break;

            case 'R':
                Display.NotifyStation("Input RFID id: ");
                string idString = Display.ReadInput();
                //fix maybe?
                try
                {
                    int id = Convert.ToInt32(idString);
                    rfidReader.Read(id);
                }
                catch (FormatException e)
                {
                    Display.NotifyStation("You must input a valid number!");
                }
                break;

            default:
                break;
            }
        } while (!finish);
    }