Exemplo n.º 1
0
        public void A_stream_storage_instance_with_stream_factories()
        {
            Func<Stream> primaryStreamFactory = () => new MemoryStream();
            Func<Stream> tempStreamFactory = () =>
                {
                    HasCalledTempStreamFactory = true;
                    return new MemoryStream();
                };
            Action<Stream> primaryStreamCleanUp = s => s.Close();
            Action<Stream> tempStreamCleanUp = s => s.Close();

            Storage = new StreamStorage(primaryStreamFactory,
                                        tempStreamFactory,
                                        primaryStreamCleanUp,
                                        tempStreamCleanUp);

            Table = "Test";

            for (int i = 0; i < 110; i++)
                Storage.Store(Table, i.ToString(), BitConverter.GetBytes(i));

            for (int i = 11; i < 33; i++)
                Storage.Remove(Table, i.ToString());

            Storage.CleanUp();
        }
Exemplo n.º 2
0
        public void A_stream_storage_instance()
        {
            if (DataStream == null)
                DataStream = new MemoryStream();

            Func<Stream> primaryStreamFactory = () => new MemoryStream();
            Func<Stream> tempStreamFactory = () => new MemoryStream();

            Storage = new StreamStorage(primaryStreamFactory, tempStreamFactory, null, null);

            Table = "Test";
        }
			public ITemporaryStreamStorage CreateTemporaryStreamStorage (CancellationToken cancellationToken = default(CancellationToken))
			{
				var result = new StreamStorage ();
				serviceList.Add (result);
				return result;
			}