protected void TestMotion(CaptureTesting captureTesting, MotionSensorTypes motionSensorType, MotionSensorSettingsTest settings)
        {
            captureId = captureTesting.captureId;

            if (motionSensorType == MotionSensorTypes.Motion2a)
            {
                using (MotionSensor2aTest test = new MotionSensor2aTest())
                {
                    test.settings = settings;

                    captureTesting.detectionStartTime    = DateTime.Now;
                    captureTesting.detectedMovmentFrames = new List <int>();
                    captureTesting.detectionMethod       = "a";

                    test.expectedFrames = captureTesting.numberFrames;
                    test.timedTest      = timedTest;
                    test.Run(captureTesting.captureId);

                    captureTesting.detectedMovmentFrames = test.movementFrames;
                    captureTesting.detectionEndTime      = DateTime.Now;

                    if (timedTest)
                    {
                        elapsedMilliseconds = test.testTimer.Elapsed.TotalMilliseconds;
                    }
                }

                WriteToDatabase(captureTesting, settings); //calls the subclass method
            }
        }
        public void CaptureListTestXml()
        {
            CaptureTesting cap = new CaptureTesting();

            cap.captureId             = "111";
            cap.detectionStartTime    = DateTime.Now;
            cap.detectionEndTime      = DateTime.Now.AddMinutes(1);
            cap.detectionMethod       = "a";
            cap.detectedMovmentFrames = new List <int>();
            cap.detectedMovmentFrames.Add(1);
            cap.detectedMovmentFrames.Add(31);
            cap.detectedMovmentFrames.Add(78);
            cap.detectedMovmentFrames.Add(66);

            XmlDocument xmldoc = cap.SerialiseMe();

            Assert.IsTrue(xmldoc.OuterXml.Count() > 0);

            cap                       = new CaptureTesting();
            cap.captureId             = "222";
            cap.detectionMethod       = "a";
            cap.detectionStartTime    = DateTime.Now;
            cap.detectionEndTime      = DateTime.Now.AddMinutes(1);
            cap.detectedMovmentFrames = new List <int>();
            cap.detectedMovmentFrames.Add(8);
            cap.detectedMovmentFrames.Add(88);
            cap.detectedMovmentFrames.Add(98);
            cap.detectedMovmentFrames.Add(28);

            xmldoc = cap.SerialiseMe();
            Assert.IsTrue(xmldoc.OuterXml.Count() > 0);


            cap                    = new CaptureTesting();
            cap.captureId          = "333";
            cap.detectionMethod    = "a";
            cap.detectionStartTime = DateTime.Now;
            cap.detectionEndTime   = DateTime.Now.AddMinutes(1);

            xmldoc = cap.SerialiseMe();
            Assert.IsTrue(xmldoc.OuterXml.Count() > 0);


            cap                 = new CaptureTesting();
            cap.captureId       = "444";
            cap.detectionMethod = "a";
            xmldoc              = cap.SerialiseMe();
            Assert.IsTrue(xmldoc.OuterXml.Count() > 0);
        }
        internal override void WriteToDatabase(CaptureTesting captureTest, MotionSensorSettingsTest motionSettings)
        {
            var db = new CaptureDbTest(ConfigurationManager.ConnectionStrings["LOCALDB"].ConnectionString);

            db.CreateLagTestSession(captureTest.captureId, motionSettings.asynchronous, elapsedMilliseconds);
        }
 internal abstract void WriteToDatabase(CaptureTesting captureTest, MotionSensorSettingsTest motionSettings);
Beispiel #5
0
        internal override void WriteToDatabase(CaptureTesting captureTest, MotionSensorSettingsTest motionSettings)
        {
            var db = new CaptureDbTest(ConfigurationManager.ConnectionStrings["LOCALDB"].ConnectionString);

            db.CreateDetectionSession(captureTest.SerialiseMe(), motionSettings.SerialiseMe(), captureTest.captureId);
        }