示例#1
0
        public void RequestEntrySucceededTests_RequestingEntry_RequestAccepted()
        {
            var _stubDoor = MockRepository.GenerateMock<IDoor>();
            var _stubBeeper = MockRepository.GenerateMock<IBeeper>();
            var _mockCardDb = MockRepository.GenerateMock<ICardDB>();

            _mockCardDb.Expect(
                x => x.ValidateEntryRequest(2)).Return(true);

            var d = new DoorControl(_mockCardDb, _stubDoor, _stubBeeper);
            d.RequestEntry(1);

            Assert.AreEqual(true, d.Request);
        }
        static void Main(string[] args)
        {
            IAlarm             alarm          = new Alarm();
            IDoor              door           = new Door();
            IEntryNotification notification   = new EntryNotification();
            IUserValidation    userValidation = new UserValidation();

            userValidation.AddId(10);
            DoorControl control = new DoorControl(alarm, door, notification, userValidation);

            door.DoorIsOpen = false;
            control.RequestEntry(10);
            Thread.Sleep(10);
            control.RequestEntry(15);
        }
示例#3
0
 public static void Main(string[] args)
 {
     Console.WriteLine ("Happy Test !\n");
     DoorControl MyController = new DoorControl(new CardDB(), new Door(), new Beeper());
     MyController.RequestEntry(1);
     MyController.OpenDoor();
     MyController.CloseDoor();
 }