示例#1
0
        public IList <DataBlockVerification> VerifyScanOfFragmented(string fileName)
        {
            if (String.IsNullOrEmpty(_fileNameProject))
            {
                Assert.Fail("Incorrect Test Setup:WithProjectFile has not been called.");
            }
            if (!File.Exists(fileName))
            {
                Assert.Fail("Incorrect Test Setup:No file exists at " + Path.GetFullPath(fileName));
            }
            if (_videoDetector == null)
            {
                Assert.Fail("Incorrect Test Setup:WithDetector has not been called.");
            }
            File.Delete(_fileNameProject);
            // Scan test file
            IInputFile scannedFile = ScanFile(fileName);
            var        blocks      = _project.GetDataBlocks(scannedFile);
            var        verifyers   = new List <IDataBlock>(blocks).ConvertAll(block =>
            {
                var result = TestFramework.GetResults(block);
                var descr  = TestFramework.GetDescriptionText(result);
                return(new DataBlockVerification(block, result, "fragment " + block.FragmentIndex + " detected using " + (_systemDetector == null ? "" : _systemDetector.Name + " and ") + _videoDetector.Name + ", containing Results:" + descr));
            });

            return(verifyers);
        }
示例#2
0
 private string DescribeChild(IResultNode child)
 {
     return(TestFramework.GetDescriptionText(child));
 }
        public CodecStreamVerification VerifyCodecStream(int index)
        {
            var stream = _dataBlock.CodecStreams[index];
            var result = TestFramework.GetResults(stream);

            return(new CodecStreamVerification(stream, result, "Stream " + stream.StreamNumber + "(" + stream.Name + ") from " + _description + ", with Results:" + Environment.NewLine + TestFramework.GetDescriptionText(result)));
        }
示例#4
0
        /// <summary>
        /// You do not need a project file for this kind of scan
        /// </summary>
        /// <param name="byteStream"></param>
        public DataBlockVerification Scan(byte[] byteStream)
        {
            IScanContext scanContext = TestFramework.CreateScanContext(_project);
            IDataBlock   dataBlock   = ScanDataBlock(byteStream, scanContext);

            Assert.IsNotNull(dataBlock);

            // Data block detected, perform a rescan for the results
            IScanContext rescanContext = TestFramework.CreateScanContext(_project);

            rescanContext.Detectors = dataBlock.Detectors;
            var detectedByteStream = new byte[dataBlock.Length];

            Array.Copy(byteStream, dataBlock.StartOffset, detectedByteStream, 0, detectedByteStream.Length);
            ScanDataBlock(detectedByteStream, rescanContext);
            Assert.IsNotNull(rescanContext.Results);

            return(new DataBlockVerification(dataBlock, rescanContext.Results, "using " + _videoDetector.Name + " detected datablock within memory buffer of size " + byteStream.Length + "." + TestFramework.GetDescriptionText(rescanContext.Results)));
        }
示例#5
0
 private static String Describe(IFragment dataBlock)
 {
     return(TestFramework.GetDescriptionText(TestFramework.GetResults(dataBlock)));
 }