public void TestCloseStream()
        {
            var factory = new Ds3.Helpers.Strategies.StreamFactory.StreamFactory();
            Func<string, Stream> func = name => new MemoryStream(Encoding.UTF8.GetBytes("I am a stream"));

            factory.CreateStream(func, null, Stubs.Blob1, Stubs.Blob1Length);

            factory.CloseStream(Stubs.Blob1.Context);
        }
        public void TestCreateStreamSaveDiffrentStreamForDiffrentStreams()
        {
            var factory = new Ds3.Helpers.Strategies.StreamFactory.StreamFactory();
            Func<string, Stream> func = name => new MemoryStream(Encoding.UTF8.GetBytes("I am a stream"));

            factory.CreateStream(func, null, Stubs.Blob1, Stubs.Blob1Length);
            factory.CreateStream(func, null, Stubs.Blob3, Stubs.Blob3Length);

            Assert.AreEqual(2, factory.GetStreamStore().Count);
        }
        public void TestCloseStreamException()
        {
            var factory = new Ds3.Helpers.Strategies.StreamFactory.StreamFactory();
            Func<string, Stream> func = name => new MemoryStream(Encoding.UTF8.GetBytes("I am a stream"));

            factory.CreateStream(func, null, Stubs.Blob1, Stubs.Blob1Length);

            factory.CloseStream(Stubs.Blob1.Context);
            Assert.Throws<StreamNotFoundException>(() => factory.CloseStream(Stubs.Blob3.Context));
        }
        public void TestCreateStreamSaveSameStreamBlob()
        {
            var factory = new Ds3.Helpers.Strategies.StreamFactory.StreamFactory();
            var stream = new MemoryStream(Encoding.UTF8.GetBytes("I am a stream"));
            Func <string, Stream> func = name => stream;

            factory.CreateStream(func, null, Stubs.Blob1, Stubs.Blob1Length);
            factory.CreateStream(func, null, Stubs.Blob1, Stubs.Blob1Length);

            Assert.AreEqual(1, factory.GetStreamStore().Count);
            Assert.AreEqual(stream, factory.GetStreamStore()["bar"]);
        }