Beispiel #1
0
        public void Does_vary_cache_by_Role()
        {
            ServerCacheRoles.Count = 0;
            var request = new ServerCacheRoles {
                Id = 3, Value = "foo"
            };

            var response = Config.ListeningOn.CombineWith(request.ToGetUrl())
                           .GetJsonFromUrl(requestFilter: req => req.AddHeader("X-role", "RoleA"))
                           .FromJson <ServerCacheRoles>();

            Assert.That(ServerCacheRoles.Count, Is.EqualTo(1));
            AssertEquals(response, request);

            response = Config.ListeningOn.CombineWith(request.ToGetUrl())
                       .GetJsonFromUrl(requestFilter: req => req.AddHeader("X-role", "RoleA"))
                       .FromJson <ServerCacheRoles>();

            Assert.That(ServerCacheRoles.Count, Is.EqualTo(1));
            AssertEquals(response, request);

            response = Config.ListeningOn.CombineWith(request.ToGetUrl())
                       .GetJsonFromUrl(requestFilter: req => req.AddHeader("X-role", "RoleB"))
                       .FromJson <ServerCacheRoles>();

            Assert.That(ServerCacheRoles.Count, Is.EqualTo(2));
            AssertEquals(response, request);
        }
Beispiel #2
0
 public object Any(ServerCacheRoles request)
 {
     Interlocked.Increment(ref ServerCacheRoles.Count);
     return(request);
 }