Exemplo n.º 1
0
        public void RemoveNoException()
        {
            // arrange
            var cacheSize = 10;
            var cache     = new TaskCache(cacheSize);
            var key       = "Foo";

            // act
            Action verify = () => cache.Remove(key);

            // assert
            Assert.Null(Record.Exception(verify));
        }
Exemplo n.º 2
0
        public void RemoveNoException()
        {
            // arrange
            var      cacheSize         = 10;
            TimeSpan slidingExpiration = TimeSpan.Zero;
            var      cache             = new TaskCache <string, string>(cacheSize,
                                                                        slidingExpiration);
            var key = "Foo";

            // act
            Action verify = () => cache.Remove(key);

            // assert
            Assert.Null(Record.Exception(verify));
        }
Exemplo n.º 3
0
        public void RemoveKeyNull()
        {
            // arrange
            var      cacheSize         = 10;
            TimeSpan slidingExpiration = TimeSpan.Zero;
            var      cache             = new TaskCache <string, string>(cacheSize,
                                                                        slidingExpiration);
            string key = null;

            // act
            Action verify = () => cache.Remove(key);

            // assert
            Assert.Throws <ArgumentNullException>("key", verify);
        }
Exemplo n.º 4
0
        public void RemoveEntry()
        {
            // arrange
            var cacheSize = 10;
            var cache     = new TaskCache(cacheSize);
            var key       = "Foo";

            cache.TryAdd(key, "Bar");

            // act
            cache.Remove(key);

            // assert
            var exists = cache.TryGetValue(key, out object actual);

            Assert.False(exists);
            Assert.Null(actual);
        }
Exemplo n.º 5
0
        public void RemoveEntry()
        {
            // arrange
            var      cacheSize         = 10;
            TimeSpan slidingExpiration = TimeSpan.Zero;
            var      cache             = new TaskCache <string, string>(cacheSize,
                                                                        slidingExpiration);
            var key = "Foo";

            cache.TryAdd(key, Task.FromResult("Bar"));

            // act
            cache.Remove(key);

            // assert
            var exists = cache.TryGetValue(key, out Task <string> actual);

            Assert.False(exists);
            Assert.Null(actual);
        }