コード例 #1
0
        public void set_async_forwards_the_call_onto_the_blob_cache()
        {
            var blobCache = new BlobCacheMock(MockBehavior.Loose);

            blobCache.When(x => x.Insert(It.IsAny <string>(), It.IsAny <byte[]>(), It.IsAny <DateTimeOffset?>())).Return(Observable.Return(Unit.Default));
            var service = new StateService(blobCache, new LoggerServiceMock(MockBehavior.Loose));

            service.SetAsync <string>("some key", "some value");

            // we don't verify the specific key because Akavache does some key manipulation internally
            blobCache.Verify(x => x.Insert(It.IsAny <string>(), It.IsAny <byte[]>(), It.IsAny <DateTimeOffset?>())).WasCalledExactlyOnce();
        }
コード例 #2
0
        public void get_async_forwards_the_call_onto_the_blob_cache()
        {
            var blobCache = new BlobCacheMock();

            blobCache.When(x => x.Get(It.IsAny <string>())).Return(Observable.Return(new byte[0]));
            var service = new StateService(blobCache, new LoggerServiceMock(MockBehavior.Loose));

            service.GetAsync <string>("some key");

            // we don't verify the specific key because Akavache does some key manipulation internally
            blobCache.Verify(x => x.Get(It.IsAny <string>())).WasCalledExactlyOnce();
        }
コード例 #3
0
        public void remove_forwards_the_call_onto_the_blob_cache()
        {
            var blobCache = new BlobCacheMock(MockBehavior.Loose);

            blobCache
            .When(x => x.Invalidate(It.IsAny <string>()))
            .Return(Observables.Unit);

            var sut = new StateServiceBuilder()
                      .WithBlobCache(blobCache)
                      .Build();

            sut.Remove <string>("some key");

            // we don't verify the specific key because Akavache does some key manipulation internally
            blobCache
            .Verify(x => x.Invalidate(It.IsAny <string>()))
            .WasCalledExactlyOnce();
        }
コード例 #4
0
        public void get_forwards_the_call_onto_the_blob_cache()
        {
            var blobCache = new BlobCacheMock();

            blobCache
            .When(x => x.Get(It.IsAny <string>()))
            .Return(Observable.Return(new byte[0]));

            var sut = new StateServiceBuilder()
                      .WithBlobCache(blobCache)
                      .Build();

            sut.Get <string>("some key");

            // we don't verify the specific key because Akavache does some key manipulation internally
            blobCache
            .Verify(x => x.Get(It.IsAny <string>()))
            .WasCalledExactlyOnce();
        }
コード例 #5
0
        public void set_async_forwards_the_call_onto_the_blob_cache()
        {
            var blobCache = new BlobCacheMock(MockBehavior.Loose);

            blobCache
                .When(x => x.Insert(It.IsAny<string>(), It.IsAny<byte[]>(), It.IsAny<DateTimeOffset?>()))
                .Return(Observable.Return(Unit.Default));

            var sut = new StateServiceBuilder()
                .WithBlobCache(blobCache)
                .Build();

            sut.SetAsync<string>("some key", "some value");

            // we don't verify the specific key because Akavache does some key manipulation internally
            blobCache
                .Verify(x => x.Insert(It.IsAny<string>(), It.IsAny<byte[]>(), It.IsAny<DateTimeOffset?>()))
                .WasCalledExactlyOnce();
        }
コード例 #6
0
        public void get_async_forwards_the_call_onto_the_blob_cache()
        {
            var blobCache = new BlobCacheMock();

            blobCache
                .When(x => x.Get(It.IsAny<string>()))
                .Return(Observable.Return(new byte[0]));

            var sut = new StateServiceBuilder()
                .WithBlobCache(blobCache)
                .Build();

            sut.GetAsync<string>("some key");

            // we don't verify the specific key because Akavache does some key manipulation internally
            blobCache
                .Verify(x => x.Get(It.IsAny<string>()))
                .WasCalledExactlyOnce();
        }
コード例 #7
0
        public void remove_forwards_the_call_onto_the_blob_cache()
        {
            var blobCache = new BlobCacheMock(MockBehavior.Loose);

            blobCache
                .When(x => x.Invalidate(It.IsAny<string>()))
                .Return(Observable.Return(Unit.Default));

            var sut = new StateServiceBuilder()
                .WithBlobCache(blobCache)
                .Build();

            sut.Remove<string>("some key");

            // we don't verify the specific key because Akavache does some key manipulation internally
            blobCache
                .Verify(x => x.Invalidate(It.IsAny<string>()))
                .WasCalledExactlyOnce();
        }