From 73231de7e25e4371eb7ef737b93fcc03efc19128 Mon Sep 17 00:00:00 2001 From: Richard Schneider Date: Thu, 30 May 2019 16:08:00 +1200 Subject: [PATCH] test(FileSystemApi)" stream properties --- test/CoreApi/FileSystemApiTest.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/CoreApi/FileSystemApiTest.cs b/test/CoreApi/FileSystemApiTest.cs index 9f9e04aa..507b2d78 100644 --- a/test/CoreApi/FileSystemApiTest.cs +++ b/test/CoreApi/FileSystemApiTest.cs @@ -112,6 +112,23 @@ public async Task Add_SizeChunking() Assert.AreEqual("hello world", text); } + [TestMethod] + public async Task StreamBehaviour() + { + var ipfs = TestFixture.Ipfs; + var options = new AddFileOptions + { + ChunkSize = 3, + Pin = true, + }; + var node = await ipfs.FileSystem.AddTextAsync("hello world", options); + var stream = await ipfs.FileSystem.ReadFileAsync(node.Id); + Assert.AreEqual(11, stream.Length); + Assert.IsTrue(stream.CanRead); + Assert.IsFalse(stream.CanWrite); + Assert.IsTrue(stream.CanSeek); + } + [TestMethod] public async Task Add_HashAlgorithm() {