public void TestRecordManagerConstruct()
        {
            var gateProvider = new GateProvider(ConstructGate());

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

            Assert.AreEqual(recordManager.ContinueRecording, false);
        }
        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"));
        }
        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);
        }
        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);
        }
Example #5
0
 public RecordManager(GateProvider gateProvider, DataAccessLayer dataAccessLayer)
 {
     this.GateProvider = gateProvider;
     this._dataAccessLayer = dataAccessLayer;
 }
        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);
        }
        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);
        }
 public MockRecordManager(GateProvider gateProvider, DataAccessLayer dataAccessLayer)
     : base(gateProvider, dataAccessLayer)
 {
     
 }