本文整理汇总了C#中ICacheProvider.Expect方法的典型用法代码示例。如果您正苦于以下问题:C# ICacheProvider.Expect方法的具体用法?C# ICacheProvider.Expect怎么用?C# ICacheProvider.Expect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICacheProvider
的用法示例。
在下文中一共展示了ICacheProvider.Expect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EstablishContext
protected override void EstablishContext()
{
MockConfigValueProvider();
MockInvocation("ObjectMethod");
MockCacheKeyGenerator("abc");
suppliedCacheValue = new FakeModel { Id = 1, Name = "One" };
invocation.ReturnValue = suppliedCacheValue;
//Create Default cache provider without the cache value.
defaultCacheProvider = MockCacheProvider();
//Populate constraintBag with with values passed to insert.
defaultCacheProvider.Expect(x => x.Insert(null, null, DateTime.Now, TimeSpan.Parse("1:00")));
constraintBag = new ExpandoObject();
LastCall.Constraints(
new ActionConstraint<string>(x => constraintBag.key = x),
new ActionConstraint<object>(x => constraintBag.value = x),
new ActionConstraint<DateTime>(x => constraintBag.absoluteExpiration = x),
new ActionConstraint<TimeSpan>(x => constraintBag.slidingExpiration = x)
);
secondaryCacheProvider = MockCacheProvider();
//Populate constraintBag with with values passed to insert.
secondaryCacheProvider.Expect(x => x.Insert(null, null, DateTime.Now, TimeSpan.Parse("1:00")));
secondaryConstraintBag = new ExpandoObject();
LastCall.Constraints(
new ActionConstraint<string>(x => secondaryConstraintBag.key = x),
new ActionConstraint<object>(x => secondaryConstraintBag.value = x),
new ActionConstraint<DateTime>(x => secondaryConstraintBag.absoluteExpiration = x),
new ActionConstraint<TimeSpan>(x => secondaryConstraintBag.slidingExpiration = x)
);
cacheProviders = new[] { defaultCacheProvider, secondaryCacheProvider };
}