Пример #1
0
        public void TestRecordManagerConstruct()
        {
            var gateProvider = new GateProvider(ConstructGate());

            var recordManager = new RecordManager(gateProvider, ConstructMockDataAccessLayer());

            Assert.AreEqual(recordManager.ContinueRecording, false);
        }
Пример #2
0
        public void TestIsBlackListedItem()
        {
            var gateProvider = new GateProvider(ConstructGate());

            var recordManager = new RecordManager(gateProvider, ConstructMockDataAccessLayer());
            
            Assert.IsTrue(recordManager.IsBlackListedNumber("TN 00 0000"));
            Assert.IsFalse(recordManager.IsBlackListedNumber("TN 00 9999"));
        }
Пример #3
0
        public void TestGateProviderConstruct()
        {
            const string expecetedCom = "COM1";
            const int expectedCamId = 1;
            var gateModel = new Gate("one") { ComPortName = expecetedCom };
            gateModel.Cameras.Add(new CameraModel(){ID = expectedCamId});

            UserManager.Instance.SetLoggedInUser("super");

            var gateProvider = new GateProvider(gateModel);

            Assert.IsTrue(gateProvider.ComPortProvider != null);
            
            // TODO : Mock COM Provider
            //Assert.AreEqual(gateProvider.ComPortProvider.SerialPort.PortName, expecetedCom);
            
            Assert.IsTrue(gateProvider.CameraProviders.Count() == 1);
            Assert.AreEqual(gateProvider.CameraProviders.First().CameraModel.ID, expectedCamId);
        }
Пример #4
0
        public void TestRecordCurrentSnapshots()
        {
            var gate = ConstructGate();

            var byteAry = new byte[] {1, 2, 3};
            var cameraProviders = gate.Cameras.Select(x => new MockCameraProvider(x, byteAry));

            var gateProvider = new GateProvider(gate) {CameraProviders = cameraProviders};
            
            var recordManager = new RecordManager(gateProvider,ConstructMockDataAccessLayer());

            VehicleBasicInfoModel vehicleBasicInfoModel;
            VehicleImagesModel vehicleImagesModel;

            recordManager.RecordCurrentSnapshots(out vehicleBasicInfoModel, out vehicleImagesModel);
            
            Assert.NotNull(vehicleBasicInfoModel.DateTime);
            Assert.NotNull(vehicleBasicInfoModel.UniqueEntryId);
            Assert.AreEqual(vehicleBasicInfoModel.UniqueEntryId, vehicleImagesModel.ForeignKeyId);
            Assert.AreEqual(vehicleBasicInfoModel.IsBlackListed, false);
        }
Пример #5
0
 public RecordManager(GateProvider gateProvider, DataAccessLayer dataAccessLayer)
 {
     this.GateProvider = gateProvider;
     this._dataAccessLayer = dataAccessLayer;
 }
Пример #6
0
        public void TestStartRecordingInfoTrue()
        {
            var gate = ConstructGate();

            var byteAry = new byte[] { 1, 2, 3 };
            var cameraProviders = gate.Cameras.Select(x => new MockCameraProvider(x, byteAry));

            var gateProvider = new GateProvider(gate)
            {
                CameraProviders = cameraProviders,
                ComPortProvider = new MockComProvider() { MockReadString = "S"}
            };

            VehicleBasicInfoModel vehicleBasicInfoModel;
            VehicleImagesModel vehicleImagesModel;

            // Action
            var recordManager = new RecordManager(gateProvider, ConstructMockDataAccessLayer());

            // Assert
            Assert.IsTrue(recordManager.StartRecordingInfo(out vehicleBasicInfoModel, out vehicleImagesModel));
            Assert.AreEqual(((MockComProvider)gateProvider.ComPortProvider).MockWriteString, "E");
            Assert.NotNull(vehicleBasicInfoModel.DateTime);
            Assert.AreEqual(vehicleBasicInfoModel.UniqueEntryId, vehicleImagesModel.ForeignKeyId);
        }
Пример #7
0
        public void TestStartRecordingInfoFalse()
        {
            var gate = ConstructGate();

            var byteAry = new byte[] { 1, 2, 3 };
            var cameraProviders = gate.Cameras.Select(x => new MockCameraProvider(x, byteAry));

            var gateProvider = new GateProvider(gate)
            {
                CameraProviders = cameraProviders,
                ComPortProvider = new MockComProvider()
            };

            VehicleBasicInfoModel vehicleBasicInfoModel;
            VehicleImagesModel vehicleImagesModel;

            // Action
            var recordManager = new RecordManager(gateProvider, ConstructMockDataAccessLayer());

            // Assert
            Assert.IsFalse(recordManager.StartRecordingInfo(out vehicleBasicInfoModel, out vehicleImagesModel));
            Assert.AreEqual(((MockComProvider)gateProvider.ComPortProvider).MockWriteString, string.Empty);
        }
Пример #8
0
        public MainCameraViewModel(DataAccessLayer dataAccessLayer)
        {
            this._dataAccessLayer = dataAccessLayer;
            this.StartRecordingCmd = new RelayCommand(StartRecordingHandler);
            this.StopRecordingCmd = new RelayCommand(StopRecordingHandler);

            this._vehicleNumber = "TN 00 0000";
            this._chasisImage = this.GetDefaultImage("no-chasis.jpg");
            this._carTopViewImage = this.GetDefaultImage("no-car-topview.jpg");
            this._driverImage = this.GetDefaultImage("no-driver.jpg");
            this._licencePlateImage = this.GetDefaultImage("no-licence.jpg");

            var gateProvider = new GateProvider(this._dataAccessLayer.ReadGateInfo());
            this._recordManager = new RecordManager(gateProvider, dataAccessLayer);

            this._thread = new Thread(RecordDelegate);
        }
Пример #9
0
 public MockRecordManager(GateProvider gateProvider, DataAccessLayer dataAccessLayer)
     : base(gateProvider, dataAccessLayer)
 {
     
 }