Esempio n. 1
0
        public void When_Item_Added_Then_GetValue_Returns_Default_Value()
        {
            // Arrange
            var cache = new NoCacheProvider();

            cache.Add("My Key", "My Value", CacheOptions.Absolute(CacheItemPriority.Medium, TimeSpan.FromDays(1)));

            // Act
            var result = cache.GetValue("My Key");

            // Assert
            result.Should().BeNull();
        }
Esempio n. 2
0
        public void When_Key_Removed_Then_Nothing_Happens()
        {
            // Arrange
            var cache = new NoCacheProvider();

            cache.Add("My Key", "My Value", CacheOptions.Absolute(CacheItemPriority.Medium, TimeSpan.FromDays(1)));

            // Act
            cache.Remove("My Key");

            // Assert
            Assert.Pass("Test was successful, should be able to always successfully call Remove");
        }
Esempio n. 3
0
        public void When_Item_Added_Then_ContainsKey_Is_False()
        {
            // Arrange
            var cache = new NoCacheProvider();

            cache.Add("My Key", "My Value", CacheOptions.Absolute(CacheItemPriority.Medium, TimeSpan.FromDays(1)));

            // Act
            var result = cache.ContainsKey("My Key");

            // Assert
            result.Should().BeFalse();
        }