本文整理汇总了C#中Mock.WithTagInStorage方法的典型用法代码示例。如果您正苦于以下问题:C# Mock.WithTagInStorage方法的具体用法?C# Mock.WithTagInStorage怎么用?C# Mock.WithTagInStorage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mock
的用法示例。
在下文中一共展示了Mock.WithTagInStorage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: When_Querying_For_Mvc_And_Tag_Mvc_Is_Not_Assigned_Then_Returns_False
public void When_Querying_For_Mvc_And_Tag_Mvc_Is_Not_Assigned_Then_Returns_False()
{
var storageMock = new Mock<ITagStorageAdapter>();
storageMock.Setup(x => x.LoadTagMappingsFor(It.IsAny<TagTargetReference>()));
storageMock.WithTagInStorage("Any");
var targetMock = CreateStandardTargetMock();
Tagger tagger = new Tagger(targetMock.Object, storageMock.Object);
Assert.False(tagger.ContainsTag(new Tag("Mvc")));
}
示例2: When_One_Target_Exists_For_Mvc_Then_Returns_TargetReference
public void When_One_Target_Exists_For_Mvc_Then_Returns_TargetReference()
{
var storageMock = new Mock<ITagStorageAdapter>();
var tagRef = storageMock.WithTagInStorage("Mvc");
var tagFinder = new TagTargetReferenceFinder(storageMock.Object);
List<TagTargetReference> refs = tagFinder.FindByTag(new Tag("Mvc"));
Assert.That(refs, Contains.Item(new TagTargetReference()
{
FullTypeName = tagRef.FullTypeName,
Id = tagRef.Id
}));
}
示例3: When_Taggable_Is_Created_Then_All_Loaded_Tags_Are_In_TagsList
public void When_Taggable_Is_Created_Then_All_Loaded_Tags_Are_In_TagsList()
{
Mock<ITagTarget> targetMock = CreateStandardTargetMock();
var storageMock = new Mock<ITagStorageAdapter>();
storageMock.WithTagInStorage("JS");
var taggable = new Tagger(targetMock.Object, storageMock.Object);
Assert.That(taggable.Tags, Contains.Item(new Tag("JS")));
}
示例4: When_Tag_Mvc_Is_To_Be_Removed_And_Has_Not_Been_Already_Assigned_Then_Storage_Is_Not_Called
public void When_Tag_Mvc_Is_To_Be_Removed_And_Has_Not_Been_Already_Assigned_Then_Storage_Is_Not_Called()
{
Mock<ITagTarget> targetMock = CreateStandardTargetMock();
var storageMock = new Mock<ITagStorageAdapter>();
storageMock.WithTagInStorage("Nope");
storageMock.Setup(x => x.DeleteTagMapping(It.IsAny<TagMapping>())).Throws<Exception>();
Tagger tagger = new Tagger(targetMock.Object, storageMock.Object);
Assert.DoesNotThrow(() => tagger.RemoveTag(new Tag("Mvc")));
}
示例5: When_Tag_Mvc_Is_Removed_Then_TagsList_No_Longer_Contains_Mvc
public void When_Tag_Mvc_Is_Removed_Then_TagsList_No_Longer_Contains_Mvc()
{
var storageMock = new Mock<ITagStorageAdapter>();
storageMock.Setup(x => x.DeleteTagMapping(It.IsAny<TagMapping>())).Verifiable();
storageMock.Setup(x => x.LoadTagMappingsFor(It.IsAny<TagTargetReference>()));
var tagRef = storageMock.WithTagInStorage("Mvc");
var targetMock = CreateStandardTargetMock(tagRef.Id);
Tagger tagger = new Tagger(targetMock.Object, storageMock.Object);
tagger.RemoveTag(new Tag("Mvc"));
Assert.False(tagger.Tags.Contains(new Tag("Mvc")));
}
示例6: When_Tag_Mvc_Is_Removed_Then_Storage_Is_Called
public void When_Tag_Mvc_Is_Removed_Then_Storage_Is_Called()
{
var storageMock = new Mock<ITagStorageAdapter>();
storageMock.Setup(x => x.DeleteTagMapping(It.IsAny<TagMapping>())).Verifiable();
var tagRef = storageMock.WithTagInStorage("Mvc");
var targetMock = CreateStandardTargetMock(tagRef.Id);
Tagger tagger = new Tagger(targetMock.Object, storageMock.Object);
tagger.RemoveTag(new Tag("Mvc"));
storageMock.Verify();
}