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


C# Mock.WithTagInStorage方法代码示例

本文整理汇总了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")));
        }
开发者ID:ilkerde,项目名称:dc-tagger,代码行数:12,代码来源:TaggerTests.cs

示例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
                                            }));
        }
开发者ID:ilkerde,项目名称:dc-tagger,代码行数:14,代码来源:TagTargetReferenceFinderTests.cs

示例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")));
        }
开发者ID:ilkerde,项目名称:dc-tagger,代码行数:11,代码来源:TaggerTests.cs

示例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")));
        }
开发者ID:ilkerde,项目名称:dc-tagger,代码行数:13,代码来源:TaggerTests.cs

示例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")));
        }
开发者ID:ilkerde,项目名称:dc-tagger,代码行数:15,代码来源:TaggerTests.cs

示例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();
        }
开发者ID:ilkerde,项目名称:dc-tagger,代码行数:12,代码来源:TaggerTests.cs


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