public void TestDetectData() { using (IDataReader dataReader = new MockDataReader(new byte[DataFileLength], _inputFile)) { IScanContext scanContext = TestFramework.CreateScanContext(_project); scanContext.Detectors = new[] { _detector }; IDataBlockBuilder builder = TestFramework.CreateDataBlockBuilder(); builder.Detectors = scanContext.Detectors; builder.InputFile = _inputFile; IDataBlock dataBlock = _detector.DetectData(dataReader, builder, scanContext); Assert.IsNotNull(dataBlock, "Unknown format detector (DetectData not null)"); IResultNode results = scanContext.Results; Assert.IsNotNull(results, "Unknown format detector (Results not null)"); Assert.AreEqual(_detector, dataBlock.Detectors.First(), "Detector of data block"); Assert.AreEqual(1, results.Children.Count, "One child 'Data'"); IResultNode data = results.Children[0]; Assert.IsEmpty((ICollection)data.Children, "Data has no children"); Assert.AreEqual(0, data.StartOffset, ""); Assert.AreEqual(DataFileLength, data.Length, ""); Assert.IsFalse(data.IsFragmented(), "Single fragment"); Assert.AreEqual(_inputFile, data.InputFile, "Input file"); Assert.IsFalse(dataBlock.IsFullFile, "Does not produce full files"); } }