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


C# Cassette.TestableBundle类代码示例

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


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


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