• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Cassette.TestableBundle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Cassette.TestableBundle的典型用法代码示例。如果您正苦于以下问题:C# TestableBundle类的具体用法?C# TestableBundle怎么用?C# TestableBundle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TestableBundle类属于Cassette命名空间,在下文中一共展示了TestableBundle类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: FileSystemWatchingBundleRebuilder_Tests

        public FileSystemWatchingBundleRebuilder_Tests()
        {
            tempDirectory = new TempDirectory();
            Directory.CreateDirectory(Path.Combine(tempDirectory, "cache"));
            var settings = new CassetteSettings
            {
                SourceDirectory = new FileSystemDirectory(tempDirectory),
                CacheDirectory = new FileSystemDirectory(Path.Combine(tempDirectory, "cache")),
                IsFileSystemWatchingEnabled = true
            };
            bundles = new BundleCollection(settings, Mock.Of<IFileSearchProvider>(), Mock.Of<IBundleFactoryProvider>());
            bundleConfiguration = new Mock<IConfiguration<BundleCollection>>();

            var bundle = new TestableBundle("~");
            var asset1 = new StubAsset("~/test.js");
            var asset2 = new StubAsset("~/sub/test2.js");
            asset1.AddRawFileReference("~/image.png");
            bundle.Assets.Add(asset1);
            bundle.Assets.Add(asset2);
            bundles.Add(bundle);

            fileSearch = new Mock<IFileSearch>();
            fileSearch
                .Setup(s => s.IsMatch(It.IsAny<string>()))
                .Returns<string>(path => path.EndsWith(".js"));

            var initializer = new BundleCollectionInitializer(new[] { bundleConfiguration.Object }, new ExternalBundleGenerator(Mock.Of<IBundleFactoryProvider>(), settings));
            rebuilder = new FileSystemWatchingBundleRebuilder(settings, bundles, initializer, new[] { fileSearch.Object });
        }
开发者ID:joshperry,项目名称:cassette,代码行数:29,代码来源:FileSystemWatchingBundleRebuilder.cs


示例2: StoresReferences

 public void StoresReferences()
 {
     var bundle = new TestableBundle("~/bundle");
     bundle.AddReference("~\\test");
     bundle.AddReference("~\\other");
     bundle.References.SequenceEqual(new[] { "~/test", "~/other" }).ShouldBeTrue();
 }
开发者ID:tomdenny,项目名称:cassette,代码行数:7,代码来源:Bundle.cs


示例3: CreateBundleUrlCallsBundleUrlProperty

        public void CreateBundleUrlCallsBundleUrlProperty()
        {
            var bundle = new TestableBundle("~") { Hash = new byte[] {} };

            var url = UrlGenerator.CreateBundleUrl(bundle, false);

            url.ShouldEqual("_cassette/testablebundle/_");
        }
开发者ID:Zocdoc,项目名称:cassette,代码行数:8,代码来源:UrlGenerator.cs


示例4: BundleCollection_AddPerSubDirectory_Tests

 public BundleCollection_AddPerSubDirectory_Tests()
 {
     factory
         .Setup(f => f.CreateBundle(It.IsAny<string>(), It.IsAny<IEnumerable<IFile>>(), It.IsAny<BundleDescriptor>()))
         .Returns<string, IEnumerable<IFile>, BundleDescriptor>(
             (path, files, d) => createdBundle = new TestableBundle(path)
         );
 }
开发者ID:jlopresti,项目名称:cassette,代码行数:8,代码来源:BundleCollection.AddPerSubDirectory.cs


示例5: CreateBundleUrlCallsBundleUrlProperty

        public void CreateBundleUrlCallsBundleUrlProperty()
        {
            var bundle = new TestableBundle("~") { Hash = new byte[] { 1, 2, 3 } };

            var url = UrlGenerator.CreateBundleUrl(bundle);

            url.ShouldEqual("cassette.axd/" + bundle.Url);
        }
开发者ID:jlopresti,项目名称:cassette,代码行数:8,代码来源:UrlGenerator_CreateBundleUrl_Tests.cs


示例6: GivenBundleAdded_WhenAddAnotherWithSamePath_ThenExceptionIsThrown

        public void GivenBundleAdded_WhenAddAnotherWithSamePath_ThenExceptionIsThrown()
        {
            var bundle = new TestableBundle("~/test");
            bundles.Add(bundle);

            Assert.Throws<ArgumentException>(
                () => bundles.Add(new TestableBundle("~/test"))
            );
        }
开发者ID:joshperry,项目名称:cassette,代码行数:9,代码来源:BundleCollection.cs


示例7: GivenBundleAdded_WhenGetByPartialPath_ThenBundleReturned

        public void GivenBundleAdded_WhenGetByPartialPath_ThenBundleReturned()
        {
            var bundle = new TestableBundle("~/test");
            bundles.Add(bundle);

            var actualBundle = bundles.Get("test");

            actualBundle.ShouldBeSameAs(bundle);
        }
开发者ID:joshperry,项目名称:cassette,代码行数:9,代码来源:BundleCollection.cs


示例8: TestableBundle

        public void GivenBundlesWithNoDependenciesAreReferencedInNonAlphaOrder_WhenIncludeReferencesAndSortBundles_ThenReferenceOrderIsMaintained()
        {
            var bundle1 = new TestableBundle("~/bundle1");
            var bundle2 = new TestableBundle("~/bundle2");
            var container = new BundleContainer(new[] { bundle1, bundle2 });

            var sorted = container.IncludeReferencesAndSortBundles(new[] { bundle2, bundle1 });

            sorted.SequenceEqual(new[] { bundle2, bundle1 }).ShouldBeTrue();
        }
开发者ID:prasanths,项目名称:cassette,代码行数:10,代码来源:BundleContainer.cs


示例9: BundlesWithSamePathButDifferentAssetsAreNotEqual

 public void BundlesWithSamePathButDifferentAssetsAreNotEqual()
 {
     var bundle1 = new TestableBundle("~/bundle");
     var asset1 = new StubAsset("~/bundle/asset1.js");
     bundle1.Assets.Add(asset1);
     var bundle2 = new TestableBundle("~/bundle");
     var asset2 = new StubAsset("~/bundle/asset2.js");
     bundle2.Assets.Add(asset2);
     bundle1.Equals(bundle2).ShouldBeFalse();
 }
开发者ID:jlopresti,项目名称:cassette,代码行数:10,代码来源:Bundle.Equals.cs


示例10: GivenBundleWithReferenceToAnotherBundle_BundlesAreSortedInDependencyOrder

        public void GivenBundleWithReferenceToAnotherBundle_BundlesAreSortedInDependencyOrder()
        {
            var bundle1 = new TestableBundle("~/bundle1");
            var bundle2 = new TestableBundle("~/bundle2");
            bundle1.AddReference("~/bundle2");

            var container = new BundleContainer(new[] { bundle1, bundle2 });
            var sorted = container.IncludeReferencesAndSortBundles(new[] { bundle1, bundle2 });
            sorted.SequenceEqual(new[] { bundle2, bundle1 }).ShouldBeTrue();
        }
开发者ID:prasanths,项目名称:cassette,代码行数:10,代码来源:BundleContainer.cs


示例11: FindBundleContainingPathOfBundleWherePathIsMissingRootPrefixReturnsTheBundle

 public void FindBundleContainingPathOfBundleWherePathIsMissingRootPrefixReturnsTheBundle()
 {
     var expectedBundle = new TestableBundle("~/test");
     var collection = new BundleCollection(new CassetteSettings(), Mock.Of<IFileSearchProvider>(), Mock.Of<IBundleFactoryProvider>())
     {
         expectedBundle
     };
     var actualBundle = collection.FindBundlesContainingPath("test").First();
     actualBundle.ShouldBeSameAs(expectedBundle);
 }
开发者ID:prabirshrestha,项目名称:cassette,代码行数:10,代码来源:BundleCollection.FindBundlesContainingPath.cs


示例12: GivenBundleWithReferenceToAnotherBundle_BundlesAreSortedInDependencyOrder

        public void GivenBundleWithReferenceToAnotherBundle_BundlesAreSortedInDependencyOrder()
        {
            var bundle1 = new TestableBundle("~/bundle1");
            var bundle2 = new TestableBundle("~/bundle2");
            bundle1.AddReference("~/bundle2");

            var collection = CreateBundleCollection(new[] { bundle1, bundle2 });
            collection.BuildReferences();
            var sorted = collection.SortBundles(new[] { bundle1, bundle2 });
            sorted.SequenceEqual(new[] { bundle2, bundle1 }).ShouldBeTrue();
        }
开发者ID:jlopresti,项目名称:cassette,代码行数:11,代码来源:BundleCollection.SortBundles.cs


示例13: GivenBundlesAdded_WhenEnumerated_ThenBundlesReturned

        public void GivenBundlesAdded_WhenEnumerated_ThenBundlesReturned()
        {
            var bundle1 = new TestableBundle("~/test1");
            var bundle2 = new TestableBundle("~/test2");
            bundles.Add(bundle1);
            bundles.Add(bundle2);

            var set = new HashSet<Bundle>(bundles);

            set.SetEquals(new[] { bundle1, bundle2 }).ShouldBeTrue();
        }
开发者ID:joshperry,项目名称:cassette,代码行数:11,代码来源:BundleCollection.cs


示例14: TestableBundle

        public void GivenBundlesWithNoDependenciesAreReferencedInNonAlphaOrder_WhenSortBundles_ThenReferenceOrderIsMaintained()
        {
            var bundle1 = new TestableBundle("~/bundle1");
            var bundle2 = new TestableBundle("~/bundle2");
            var collection = CreateBundleCollection(new[] { bundle1, bundle2 });

            collection.BuildReferences();
            var sorted = collection.SortBundles(new[] { bundle2, bundle1 });

            sorted.SequenceEqual(new[] { bundle2, bundle1 }).ShouldBeTrue();
        }
开发者ID:jlopresti,项目名称:cassette,代码行数:11,代码来源:BundleCollection.SortBundles.cs


示例15: GivenBundlesWithCyclicReferences_WhenBuildReferences_ThenExceptionThrown

        public void GivenBundlesWithCyclicReferences_WhenBuildReferences_ThenExceptionThrown()
        {
            var bundle1 = new TestableBundle("~/bundle1");
            var bundle2 = new TestableBundle("~/bundle2");
            bundle1.AddReference("~/bundle2");
            bundle2.AddReference("~/bundle1");
            var collection = CreateBundleCollection(new[] { bundle1, bundle2 });

            Assert.Throws<InvalidOperationException>(
                () => collection.BuildReferences()
            );
        }
开发者ID:jlopresti,项目名称:cassette,代码行数:12,代码来源:BundleCollection.SortBundles.cs


示例16: BundleAssetsAreSortedByPathBeforeBeingComparedForEquality

        public void BundleAssetsAreSortedByPathBeforeBeingComparedForEquality()
        {
            var bundle1 = new TestableBundle("~/bundle");
            bundle1.Assets.Add(new StubAsset("~/bundle/asset1.js"));
            bundle1.Assets.Add(new StubAsset("~/bundle/asset2.js"));

            var bundle2 = new TestableBundle("~/bundle");
            bundle2.Assets.Add(new StubAsset("~/bundle/asset2.js"));
            bundle2.Assets.Add(new StubAsset("~/bundle/asset1.js"));

            bundle1.Equals(bundle2).ShouldBeTrue();
        }
开发者ID:jlopresti,项目名称:cassette,代码行数:12,代码来源:Bundle.Equals.cs


示例17: GivenBundleWithInvalid_BuildReferencesThrowsException

        public void GivenBundleWithInvalid_BuildReferencesThrowsException()
        {
            var bundle1 = new TestableBundle("~/bundle1");
            bundle1.AddReference("~\\bundle2");
            collection.Add(bundle1);

            var exception = Assert.Throws<AssetReferenceException>(delegate
            {
                collection.BuildReferences();
            });
            exception.Message.ShouldEqual("Reference error in bundle descriptor for \"~/bundle1\". Cannot find \"~/bundle2\".");
        }
开发者ID:jlopresti,项目名称:cassette,代码行数:12,代码来源:BundleCollection.BuildReferences.cs


示例18: GivenBundlesWithCyclicReferences_WhenIncludeReferencesAndSortBundles_ThenExceptionThrown

        public void GivenBundlesWithCyclicReferences_WhenIncludeReferencesAndSortBundles_ThenExceptionThrown()
        {
            var bundle1 = new TestableBundle("~/bundle1");
            var bundle2 = new TestableBundle("~/bundle2");
            bundle1.AddReference("~/bundle2");
            bundle2.AddReference("~/bundle1");
            var container = new BundleContainer(new[] { bundle1, bundle2 });

            Assert.Throws<InvalidOperationException>(delegate
            {
                container.IncludeReferencesAndSortBundles(new[] { bundle2, bundle1 });
            });
        }
开发者ID:prasanths,项目名称:cassette,代码行数:13,代码来源:BundleContainer.cs


示例19: TestableBundle

        public void GivenBundleReferencedInOneLocationAlsoUsedInAnother_WhenGetBundlesForSecondLocation_ThenBundleForFirstLocationIsNotIncluded()
        {
            var bundle1 = new TestableBundle("~/test1") { PageLocation = "head" };
            var bundle2 = new TestableBundle("~/test2");
            bundle2.AddReference("~/test1");
            bundleContainer.Setup(c => c.FindBundlesContainingPath("~/test2"))
                           .Returns(new Bundle[] { bundle2 });
            bundleContainer.Setup(c => c.IncludeReferencesAndSortBundles(It.IsAny<IEnumerable<Bundle>>()))
                           .Returns<IEnumerable<Bundle>>(ms => new[] { bundle1, bundle2 });

            builder.Reference("~/test2");
            builder.GetBundles(null).Count().ShouldEqual(1);
        }
开发者ID:ryansroberts,项目名称:cassette,代码行数:13,代码来源:ReferenceBuilder.cs


示例20: AcceptCallsAcceptForEachAsset

        public void AcceptCallsAcceptForEachAsset()
        {
            var visitor = new Mock<IBundleVisitor>();
            var bundle = new TestableBundle("~/test");
            var asset1 = new Mock<IAsset>();
            var asset2 = new Mock<IAsset>();
            bundle.Assets.Add(asset1.Object);
            bundle.Assets.Add(asset2.Object);

            bundle.Accept(visitor.Object);

            asset1.Verify(a => a.Accept(visitor.Object));
            asset2.Verify(a => a.Accept(visitor.Object));
        }
开发者ID:tomdenny,项目名称:cassette,代码行数:14,代码来源:Bundle.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Configuration.CassetteSettings类代码示例发布时间:2022-05-24
下一篇:
C# Cassandra.Session类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap