Esempio n. 1
0
        public virtual void TestAddRemoveEntries()
        {
            RpcCallCache cache    = new RpcCallCache("test", 100);
            IPAddress    clientIp = Extensions.GetAddressByName("1.1.1.1");
            int          xid      = 100;

            // Ensure null is returned when there is no entry in the cache
            // An entry is added to indicate the request is in progress
            RpcCallCache.CacheEntry e = cache.CheckOrAddToCache(clientIp, xid);
            NUnit.Framework.Assert.IsNull(e);
            e = cache.CheckOrAddToCache(clientIp, xid);
            ValidateInprogressCacheEntry(e);
            // Set call as completed
            RpcResponse response = Org.Mockito.Mockito.Mock <RpcResponse>();

            cache.CallCompleted(clientIp, xid, response);
            e = cache.CheckOrAddToCache(clientIp, xid);
            ValidateCompletedCacheEntry(e, response);
        }