本文整理汇总了C#中EntityFramework.Caching.CacheKey.Should方法的典型用法代码示例。如果您正苦于以下问题:C# CacheKey.Should方法的具体用法?C# CacheKey.Should怎么用?C# CacheKey.Should使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EntityFramework.Caching.CacheKey
的用法示例。
在下文中一共展示了CacheKey.Should方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: KeyTest
public void KeyTest()
{
string key = DateTime.Now.Ticks.ToString(CultureInfo.InvariantCulture);
var target = new CacheKey(key);
target.Should().NotBeNull();
target.Key.Should().NotBeNull();
target.Key.Should().Be(key);
}
示例2: CacheKeyConstructorTest1
public void CacheKeyConstructorTest1()
{
string key = string.Empty;
var target = new CacheKey(key);
target.Should().NotBeNull();
target.Key.Should().NotBeNull();
target.Key.Should().Be(string.Empty);
}
示例3: TagsTest
public void TagsTest()
{
string key = DateTime.Now.Ticks.ToString(CultureInfo.InvariantCulture);
string[] tags = new[] { "a", "b" };
var target = new CacheKey(key, tags);
target.Should().NotBeNull();
target.Key.Should().NotBeNull();
target.Key.Should().Be(key);
target.Tags.Should().HaveCount(2);
}
示例4: CreatePolicySlidingTest
public void CreatePolicySlidingTest()
{
string key = DateTime.Now.Ticks.ToString(CultureInfo.InvariantCulture);
string[] tags = new[] { "a", "b" };
var cacheKey = new CacheKey(key, tags);
cacheKey.Should().NotBeNull();
var slidingExpiration = TimeSpan.FromMinutes(5);
var cachePolicy = CachePolicy.WithSlidingExpiration(slidingExpiration);
cachePolicy.Should().NotBeNull();
var policy = MemoryCacheProvider.CreatePolicy(cacheKey, cachePolicy);
policy.Should().NotBeNull();
policy.SlidingExpiration.Should().Be(slidingExpiration);
policy.ChangeMonitors.Should().NotBeNull();
policy.ChangeMonitors.Should().HaveCount(1);
policy.ChangeMonitors.Should().ContainItemsAssignableTo<CacheEntryChangeMonitor>();
}
示例5: CreateChangeMonitorTest
public void CreateChangeMonitorTest()
{
string key = DateTime.Now.Ticks.ToString(CultureInfo.InvariantCulture);
string[] tags = new[] { "a", "b" };
var cacheKey = new CacheKey(key, tags);
cacheKey.Should().NotBeNull();
var monitor = MemoryCacheProvider.CreateChangeMonitor(cacheKey);
monitor.Should().NotBeNull();
monitor.CacheKeys.Should().HaveCount(2);
var cacheTag = new CacheTag("a");
string tagKey = MemoryCacheProvider.GetTagKey(cacheTag);
tagKey.Should().NotBeNullOrEmpty();
monitor.CacheKeys.Should().Contain(tagKey);
}