public void AppendPreservesBalancedTree() { IDataPacket concatenatedSecondSubPacket = MockRepository.GenerateStub <IDataPacket>(); _dataPacket2.Stub(x => x.Append(_dataPacket3)).Return(concatenatedSecondSubPacket); Assert.AreEqual(new DataPacketNode(_dataPacket1, concatenatedSecondSubPacket), _dataPacket.Append(_dataPacket3)); }
private IDataPacket CreateDataPacketStub(IInputFile inputFile, long length, long startOffset, long endOffset) { IDataPacket dataPacket = MockRepository.GenerateStub <IDataPacket>(); dataPacket.Stub(x => x.InputFile).Return(inputFile); dataPacket.Stub(x => x.Length).Return(length); dataPacket.Stub(x => x.StartOffset).Return(startOffset); dataPacket.Stub(x => x.EndOffset).Return(endOffset); return(dataPacket); }
public void TestSubstSRC() { String parameters = "-l [SRC]"; String sourceFile = "source file"; _inputFile.Stub(i => i.Name).Return(sourceFile); _dataPacket.Stub(d => d.InputFile).Return(_inputFile); String subst = _checker.Substitute(parameters, _selection, _dataPacket, outputFilename); Assert.AreEqual(subst, "-l \"source file\""); }
public void IsFragmentedFalse() { With.Mocks(_mockRepository).Expecting(delegate { _dataPacket1.Stub(x => x.GetFragment(0L)).Return(_dataPacket2); _dataPacket1.Stub(x => x.Length).Return(DataPacketLength); _dataPacket2.Stub(x => x.Length).Return(DataPacketLength); }).Verify(delegate { Assert.IsFalse(_dataPacket1.IsFragmented()); }); }
public void GetSubPacketBothSubPackets() { _dataPacket1.Stub(x => x.GetSubPacket(SubPacketOffset, (Length1 - SubPacketOffset))).Return(_subPacket1); _dataPacket2.Stub(x => x.GetSubPacket(0L, SubPacketOffset)).Return(_subPacket2); IDataPacket concatenatedSubPackets = MockRepository.GenerateStub <IDataPacket>(); _subPacket1.Stub(x => x.Append(_subPacket2)).Return(concatenatedSubPackets); Assert.AreSame(concatenatedSubPackets, _dataPacket.GetSubPacket(SubPacketOffset, Length1)); }
public void SetUp() { _mockRepository = new MockRepository(); _dataPacket = MockRepository.GenerateStub <IDataPacket>(); _dataReader = MockRepository.GenerateStub <IDataReader>(); _dataWriter = _mockRepository.StrictMock <IDataWriter>(); _progressReporter = MockRepository.GenerateStub <IProgressReporter>(); _detectors = Enumerable.Empty <IDetector>(); _dataReaderPool = MockRepository.GenerateStub <IDataReaderPool>(); _createDataWriter = MockRepository.GenerateStub <Creator <IDataWriter, string> >(); _forensicIntegrityLog = MockRepository.GenerateStub <IForensicIntegrityLog>(); _dataPacket.Stub(x => x.Length).Return(DataPacketLength1); _createDataWriter.Stub(x => x(FileName)).Return(_dataWriter).Repeat.Once(); _saveAsContiguousFile = new SaveAsContiguousFile(_createDataWriter, _forensicIntegrityLog); }
public void GetSubPacketFirstSubPacket() { _dataPacket1.Stub(x => x.GetSubPacket(SubPacketOffset, SubPacketLength)).Return(_subPacket1); Assert.AreSame(_subPacket1, _dataPacket.GetSubPacket(SubPacketOffset, SubPacketLength)); }