コード例 #1
0
 public void Test_BlobStream_Save_On_Flush()
 {
     BlobStream blobStream = new BlobStream(_cache, _key, _region);
     byte[] blob = Encoding.ASCII.GetBytes(LoremIpsum.OneThousandCharacters);
     blobStream.Write(blob, 0, blob.Length);
     Assert.IsNull(_cache.Get(_key, _region));
     blobStream.Flush();
     Assert.IsNotNull(_cache.Get(_key, _region));
 }
コード例 #2
0
        public void Test_BlobStream_SetLength_Zero_Removes_Stream()
        {
            string loremIpsum = LoremIpsum.OneThousandCharacters;
            FillCache(loremIpsum);

            BlobStream blobStream = new BlobStream(_cache, _key, _region);
            blobStream.SetLength(0);
            Assert.IsNull(_cache.Get(_key, _region));
        }
コード例 #3
0
 public void Test_BlobStream_Read()
 {
     string loremIpsum = LoremIpsum.OneThousandCharacters;
     FillCache(loremIpsum);
     BlobStream blobStream = new BlobStream(_cache, _key, _region);
     byte[] readBytes = new byte[loremIpsum.Length];
     blobStream.Read(readBytes, 0, readBytes.Length);
     Assert.AreEqual(LoremIpsum.OneThousandCharacters, Encoding.ASCII.GetString(readBytes));
 }
コード例 #4
0
 public void Test_BlobStream_Write()
 {
     string loremIpsum = LoremIpsum.OneThousandCharacters;
     using (BlobStream blobStream = new BlobStream(_cache, _key, _region))
     {
         byte[] blob = Encoding.ASCII.GetBytes(LoremIpsum.OneThousandCharacters);
         blobStream.Write(blob, 0, blob.Length);
     }
     byte[] actual = _cache.Get(_key, _region) as byte[];
     Assert.IsNotNull(actual);
     Assert.AreEqual(loremIpsum, Encoding.ASCII.GetString(actual));
 }