public void Test_SegmentStream_Write_Small_Segments_Totaling_Buffer_Size_Auto_Flushes() { stream = new SegmentStream(cache, Key, SegmentSize, SmallBufferSize); string message = LoremIpsum.OneThousandCharacters + " I only need 24 extra characters this is 43"; string[] array = message.Split(' '); int bytesWritten = 0; foreach (var item in array) { var buffer = Encoding.ASCII.GetBytes(item); stream.Write(buffer, 0, buffer.Length); stream.WriteByte((byte)' '); bytesWritten += buffer.Length + 1; } byte[] bytes = cache.Get(SegmentUtility.GenerateSegmentKey(0, Key)) as byte[]; Assert.IsNotNull(bytes); bytes = cache.Get(SegmentUtility.GenerateSegmentKey(1, Key)) as byte[]; Assert.IsNull(bytes); }