Пример #1
0
        public void op_ContainsKey_string_whenFalse()
        {
            var obj = new WebCacheCollection();

            try
            {
                obj[AlphaDecimal.Random()] = new object();

                Assert.False(obj.ContainsKey(AlphaDecimal.Random()));
            }
            finally
            {
                obj.Clear();
            }
        }
Пример #2
0
        public void op_Set_string_object_TimeSpan()
        {
            var obj = new WebCacheCollection();

            try
            {
                var key = AlphaDecimal.Random();
                obj.Set(key, new object(), new TimeSpan(123456));

                Assert.True(obj.ContainsKey(key));
            }
            finally
            {
                obj.Clear();
            }
        }
Пример #3
0
        public void op_Set_string_object_DateTime()
        {
            var obj = new WebCacheCollection();

            try
            {
                var key = AlphaDecimal.Random();
                obj.Set(key, new object(), DateTime.UtcNow.AddDays(1));

                Assert.True(obj.ContainsKey(key));
            }
            finally
            {
                obj.Clear();
            }
        }
Пример #4
0
        public void op_ContainsKey_string_whenTrue()
        {
            var obj = new WebCacheCollection();

            try
            {
                var key = AlphaDecimal.Random();
                obj[key] = new object();

                Assert.True(obj.ContainsKey(key));
            }
            finally
            {
                obj.Clear();
            }
        }
Пример #5
0
        public void op_Remove_string()
        {
            var obj = new WebCacheCollection();

            try
            {
                var key      = AlphaDecimal.Random();
                var expected = new object();
                obj[key] = expected;
                var actual = obj.Remove(key);

                Assert.False(obj.ContainsKey(key));
                Assert.Same(expected, actual);
            }
            finally
            {
                obj.Clear();
            }
        }
Пример #6
0
        public void op_RemoveOfT_string()
        {
            var obj = new WebCacheCollection();

            try
            {
                var       key      = AlphaDecimal.Random();
                const int expected = 123;
                obj[key] = expected;
                var actual = obj.Remove <int>(key);

                Assert.False(obj.ContainsKey(key));
                Assert.Equal(expected, actual);
            }
            finally
            {
                obj.Clear();
            }
        }