当前位置: 首页>>代码示例>>C#>>正文


C# CacheMock.Count方法代码示例

本文整理汇总了C#中Roadkill.Tests.Unit.StubsAndMocks.CacheMock.Count方法的典型用法代码示例。如果您正苦于以下问题:C# CacheMock.Count方法的具体用法?C# CacheMock.Count怎么用?C# CacheMock.Count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Roadkill.Tests.Unit.StubsAndMocks.CacheMock的用法示例。


在下文中一共展示了CacheMock.Count方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: addloggedinmenu_should_cache_html

		public void addloggedinmenu_should_cache_html()
		{
			// Arrange
			CacheMock cache = new CacheMock();
			SiteCache siteCache = new SiteCache(cache);

			// Act
			siteCache.AddLoggedInMenu("some html");

			// Assert
			Assert.That(cache.Count(), Is.EqualTo(1));
			IEnumerable<string> keys = cache.Select(x => x.Key);
			Assert.That(keys, Contains.Item(CacheKeys.LoggedInMenuKey()));
		}
开发者ID:RyanGroom,项目名称:roadkill,代码行数:14,代码来源:SiteCacheTests.cs

示例2: AddMenu_Should_Cache_Html

        public void AddMenu_Should_Cache_Html()
        {
            // Arrange
            CacheMock cache = new CacheMock();
            ApplicationSettings settings = new ApplicationSettings();
            SiteCache siteCache = new SiteCache(settings, cache);

            // Act
            siteCache.AddMenu("some html");

            // Assert
            Assert.That(cache.Count(), Is.EqualTo(1));
            IEnumerable<string> keys = cache.Select(x => x.Key);
            Assert.That(keys, Contains.Item(CacheKeys.MenuKey()));
        }
开发者ID:NaseUkolyCZ,项目名称:roadkill,代码行数:15,代码来源:SiteCacheTests.cs

示例3: removeall_should_remove_pageviewmodelcache_keys_only

		public void removeall_should_remove_pageviewmodelcache_keys_only()
		{
			// Arrange
			CacheMock cache = new CacheMock();
			cache.Add("site.blah", "xyz", new CacheItemPolicy());

			ApplicationSettings settings = new ApplicationSettings() { UseObjectCache = false };
			PageViewModelCache pageCache = new PageViewModelCache(settings, cache);
			pageCache.Add(1, 1, new PageViewModel());

			// Act
			pageCache.RemoveAll();

			// Assert
			Assert.That(cache.Count(), Is.EqualTo(1));
		}
开发者ID:RyanGroom,项目名称:roadkill,代码行数:16,代码来源:PageViewModelCacheTests.cs

示例4: RemoveAll_Should_Remove_ListCache_Keys_Only

        public void RemoveAll_Should_Remove_ListCache_Keys_Only()
        {
            // Arrange
            CacheMock cache = new CacheMock();
            cache.Add("site.blah", "xyz", new CacheItemPolicy());

            ApplicationSettings settings = new ApplicationSettings() { UseObjectCache = true };

            List<string> tagCacheItems1 = new List<string>() { "1", "2" };
            List<string> tagCacheItems2 = new List<string>() { "1", "2" };
            AddToCache(cache, "all.tags1", tagCacheItems1);
            AddToCache(cache, "all.tags2", tagCacheItems2);

            ListCache listCache = new ListCache(settings, cache);

            // Act
            listCache.RemoveAll();

            // Assert
            Assert.That(cache.Count(), Is.EqualTo(1));
        }
开发者ID:NaseUkolyCZ,项目名称:roadkill,代码行数:21,代码来源:ListCacheTests.cs

示例5: UpdatePluginSettings_Should_Add_Plugin_Settings_ToCache

        public void UpdatePluginSettings_Should_Add_Plugin_Settings_ToCache()
        {
            // Arrange
            CacheMock cache = new CacheMock();
            ApplicationSettings settings = new ApplicationSettings();
            SiteCache siteCache = new SiteCache(settings, cache);

            TextPluginStub plugin = new TextPluginStub();
            plugin.PluginCache = siteCache;
            plugin.Repository = new RepositoryMock();
            plugin.Settings.SetValue("foo", "bar");

            // Act
            siteCache.UpdatePluginSettings(plugin);

            // Assert
            Assert.That(cache.Count(), Is.EqualTo(1));
        }
开发者ID:NaseUkolyCZ,项目名称:roadkill,代码行数:18,代码来源:SiteCacheTests.cs

示例6: RemoveMenuCacheItems_Should_Clear_Cache_Items

        public void RemoveMenuCacheItems_Should_Clear_Cache_Items()
        {
            // Arrange
            CacheMock cache = new CacheMock();
            ApplicationSettings settings = new ApplicationSettings() { UseObjectCache = true };

            SiteCache siteCache = new SiteCache(settings, cache);
            siteCache.AddMenu("menu html");
            siteCache.AddLoggedInMenu("logged in menu html");
            siteCache.AddAdminMenu("admin menu html");

            // Act
            siteCache.RemoveMenuCacheItems();

            // Assert
            Assert.That(cache.Count(), Is.EqualTo(0));
        }
开发者ID:NaseUkolyCZ,项目名称:roadkill,代码行数:17,代码来源:SiteCacheTests.cs

示例7: RemoveAll_Should_Remove_SiteCache_Keys_Only

        public void RemoveAll_Should_Remove_SiteCache_Keys_Only()
        {
            // Arrange
            CacheMock cache = new CacheMock();
            cache.Add("list.blah", "xyz", new CacheItemPolicy());
            ApplicationSettings settings = new ApplicationSettings();
            SiteCache siteCache = new SiteCache(settings, cache);

            siteCache.AddMenu("menu html");
            siteCache.AddLoggedInMenu("logged in menu html");
            siteCache.AddAdminMenu("admin menu html");

            TextPluginStub plugin = new TextPluginStub();
            plugin.PluginCache = siteCache;
            plugin.Repository = new RepositoryMock();
            plugin.Settings.SetValue("foo", "bar");

            // Act
            siteCache.RemoveAll();

            // Assert
            Assert.That(cache.Count(), Is.EqualTo(1));
        }
开发者ID:NaseUkolyCZ,项目名称:roadkill,代码行数:23,代码来源:SiteCacheTests.cs

示例8: removepluginsettings_should_remove_plugin_settings

		public void removepluginsettings_should_remove_plugin_settings()
		{
			// Arrange
			CacheMock cache = new CacheMock();
			SiteCache siteCache = new SiteCache(cache);

			TextPluginStub plugin = new TextPluginStub();
			plugin.PluginCache = siteCache;
			plugin.Repository = new SettingsRepositoryMock();
			plugin.Settings.SetValue("foo", "bar");

			// Act
			siteCache.RemovePluginSettings(plugin);

			// Assert
			Assert.That(cache.Count(), Is.EqualTo(0));
		}
开发者ID:RyanGroom,项目名称:roadkill,代码行数:17,代码来源:SiteCacheTests.cs

示例9: removemenucacheitems_should_clear_cache_items

		public void removemenucacheitems_should_clear_cache_items()
		{
			// Arrange
			CacheMock cache = new CacheMock();

			SiteCache siteCache = new SiteCache(cache);
			siteCache.AddMenu("menu html");
			siteCache.AddLoggedInMenu("logged in menu html");
			siteCache.AddAdminMenu("admin menu html");

			// Act
			siteCache.RemoveMenuCacheItems();

			// Assert
			Assert.That(cache.Count(), Is.EqualTo(0));
		}
开发者ID:RyanGroom,项目名称:roadkill,代码行数:16,代码来源:SiteCacheTests.cs


注:本文中的Roadkill.Tests.Unit.StubsAndMocks.CacheMock.Count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。