Esempio n. 1
0
        public void TestRecordManagerConstruct()
        {
            var gateProvider = new GateProvider(ConstructGate());

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

            Assert.AreEqual(recordManager.ContinueRecording, false);
        }
Esempio n. 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"));
        }
Esempio n. 3
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);
        }
Esempio n. 4
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);
        }
Esempio n. 5
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);
        }
        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);
        }