Exemple #1
0
        public void Collection_access_is_not_cached()
        {
            var cacheProvider = Caches.NewInMemoryCacheProvider().Build();

            this.BuildDataStore(FakeJson.AccountList, cacheProvider);

            IQueryable <IAccount> accounts = new CollectionResourceQueryable <IAccount>("/accounts", this.dataStore).Synchronously();

            accounts.First();

            IQueryable <IAccount> accounts2 = new CollectionResourceQueryable <IAccount>("/accounts", this.dataStore);

            accounts2.First();

            this.dataStore.RequestExecutor.Received(2).Execute(
                Arg.Any <IHttpRequest>());
        }
Exemple #2
0
        public void Collection_items_are_cached()
        {
            var cacheProvider = Caches.NewInMemoryCacheProvider().Build();

            this.BuildDataStore(FakeJson.AccountList, cacheProvider);

            IQueryable <IAccount> accounts = new CollectionResourceQueryable <IAccount>("/accounts", this.dataStore);

            accounts.First();

            var han = this.dataStore.GetResource <IAccount>("/accounts/account1");

            han.Email.ShouldBe("*****@*****.**");
            han.FullName.ShouldBe("Han Solo");

            this.dataStore.RequestExecutor.Received(1).Execute(
                Arg.Any <IHttpRequest>());
        }
        public void Collection_items_are_cached()
        {
            var cacheProvider = Caches.NewInMemoryCacheProvider().Build();
            this.BuildDataStore(FakeJson.AccountList, cacheProvider);

            IQueryable<IAccount> accounts = new CollectionResourceQueryable<IAccount>("/accounts", this.dataStore);
            accounts.First();

            var han = this.dataStore.GetResource<IAccount>("/accounts/account1");
            han.Email.ShouldBe("*****@*****.**");
            han.FullName.ShouldBe("Han Solo");

            this.dataStore.RequestExecutor.Received(1).Execute(
                Arg.Any<IHttpRequest>());
        }
        public void Collection_access_is_not_cached()
        {
            var cacheProvider = Caches.NewInMemoryCacheProvider().Build();
            this.BuildDataStore(FakeJson.AccountList, cacheProvider);

            IQueryable<IAccount> accounts = new CollectionResourceQueryable<IAccount>("/accounts", this.dataStore).Synchronously();
            accounts.First();

            IQueryable<IAccount> accounts2 = new CollectionResourceQueryable<IAccount>("/accounts", this.dataStore);
            accounts2.First();

            this.dataStore.RequestExecutor.Received(2).Execute(
                Arg.Any<IHttpRequest>());
        }