public void BuildClusterStream_Throws_Exception_When_Stream_List_Is_Null() { CarrierStreamFactory clusterStreamFactory = new CarrierStreamFactory(); Assert.Throws<ArgumentNullException>(() => clusterStreamFactory.BuildClusterStream<CarrierClusterStream>(new OneKeySequence(), null)); }
public void CarrierClusterStream_Write_Read_Successfully() { ICarrierStreamFactory factory = new CarrierStreamFactory(); factory.RegisterCarrierStreams(); IList<Stream> streams = new List<Stream>(); foreach (string fileName in _fileNames) streams.Add(File.Open(fileName, FileMode.Open)); using (Stream carrierClusterStream = factory.BuildClusterStream<CarrierClusterStream>( new OneKeySequence(), streams)) { carrierClusterStream.Write(WRITE_READ_VALUE, 0, WRITE_READ_VALUE.Length); } streams.Clear(); foreach (string fileName in _fileNames) streams.Add(File.Open(fileName, FileMode.Open)); using (Stream carrierClusterStream = factory.BuildClusterStream<CarrierClusterStream>( new OneKeySequence(), streams)) { byte[] readResult = new byte[WRITE_READ_VALUE.Length]; carrierClusterStream.Seek(0, SeekOrigin.Begin); int readLength = carrierClusterStream.Read(readResult, 0, readResult.Length); Assert.AreEqual(WRITE_READ_VALUE.Length, readLength); Assert.AreEqual(WRITE_READ_VALUE, readResult); } }
public void BuildClusterStream_Throws_Exception_When_KeySequence_Is_Null() { CarrierStreamFactory clusterStreamFactory = new CarrierStreamFactory(); Assert.Throws<ArgumentNullException>(() => clusterStreamFactory.BuildClusterStream<CarrierClusterStream>(null, new List<Stream>())); }
public void CarrierClusterStream_Loads_Binary_Carrier_Stream_Successfully() { ICarrierStreamFactory factory = new CarrierStreamFactory(); factory.RegisterCarrierStreams(); IList<Stream> streams = new List<Stream>(); foreach(string fileName in _fileNames) streams.Add(File.Open(fileName, FileMode.Open)); using (Stream carrierClusterStream = factory.BuildClusterStream<CarrierClusterStream>( new OneKeySequence(), streams)) { Assert.AreEqual(12, carrierClusterStream.Length); } }
public void Successful_Constructor() { CarrierStreamFactory clusterStreamFactory = new CarrierStreamFactory(); Assert.IsInstanceOf <ICarrierStreamFactory>(clusterStreamFactory); }
public void Successful_Constructor() { CarrierStreamFactory clusterStreamFactory = new CarrierStreamFactory(); Assert.IsInstanceOf<ICarrierStreamFactory>(clusterStreamFactory); }
public void RegisterCarrierStreams_Successful() { CarrierStreamFactory clusterStreamFactory = new CarrierStreamFactory(); Assert.DoesNotThrow(() => clusterStreamFactory.RegisterCarrierStreams()); }