コード例 #1
0
        public async Task ParsePriceWithCacheEmptyTest()
        {
            MusikProduktiv musikProduktiv = new MusikProduktiv();
            var            cache          = new LUCache <string, IDocument>();

            decimal price = await musikProduktiv.ParsePrice(testItem, cache);

            Assert.True(price > 0, "Price can't be below zero.");
        }
コード例 #2
0
        public void DontContainsSqueezedOutTest()
        {
            LUCache <string, object> cache = new LUCache <string, object>(1);

            cache.Add("1", new object());
            cache.Add("2", new object());

            Assert.False(cache.Contains("1"), "Must not contain a discarded element");
            Assert.True(cache.Contains("2"), "Must contain last added element");
        }
コード例 #3
0
        public void ClearTest()
        {
            LUCache <string, object> cache = new LUCache <string, object>(1);

            cache.Add("1", new object());

            Assert.True(cache.Contains("1"), "Must contain last added element");

            cache.Clear();

            Assert.False(cache.Contains("1"), "Cleared cache must not contains elements");
        }
コード例 #4
0
        public void WrongCapacityTest()
        {
            LUCache <string, object> cache;

            try
            {
                cache = new LUCache <string, object>(-1);
            }catch (Exception ex)
            {
                Assert.IsType <ArgumentException>(ex);
            }
        }
コード例 #5
0
        public void CanGetObjectTest()
        {
            LUCache <string, object> cache = new LUCache <string, object>();

            object objExpected = new object();

            cache.Add("1", objExpected);

            object objActual = cache.Get("1");

            Assert.True(objActual.Equals(objExpected), "Must be same object");
        }
コード例 #6
0
        public void LUCacheDefaultTest()
        {
            LUCache <string, object> cache = new LUCache <string, object>();

            Assert.False(cache.Contains("Some key"), "Cache must be empty");
        }