Exemplo n.º 1
0
        public void PublishUpdate_SerializerCalled()
        {
            publisher.NotifyUpdate("A", "B");

            A.CallTo(() => _serializer.Serialize(
                         A <CacheUpdateNotificationArgs> .That.Matches(args => args.Key == "A" && args.Type == "B" && args.ClientName == "C")))
            .MustHaveHappened(Repeated.Exactly.Once);
        }
        public void Get_Add_CalledBefore_Publish()
        {
            var item = "B";

            _redispublishingCache.Get("a", () => item, TimeSpan.FromMinutes(1));

            A.CallTo(() => _database.StringSet(
                         A <RedisKey> .Ignored,
                         A <RedisValue> .Ignored,
                         A <TimeSpan?> .Ignored,
                         When.Always,
                         CommandFlags.FireAndForget))
            .MustHaveHappened(Repeated.Exactly.Once)
            .Then(A.CallTo(
                      () => _cachePublisher.NotifyUpdate(
                          A <string> ._,
                          A <string> ._,
                          A <TimeSpan?> ._))
                  .MustHaveHappened());
        }
Exemplo n.º 3
0
 public void Add <T>(string key, T item)
 {
     _cache.Add(key, item);
     _cachePublisher.NotifyUpdate(key, item.GetType().AssemblyQualifiedName);
 }
        public void Add_Publisher_Called()
        {
            _publishingCache.Add("a", "b");

            A.CallTo(() => _publisher.NotifyUpdate("a", typeof(string).FullName));
        }