本文整理汇总了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 });
}
示例2: StoresReferences
public void StoresReferences()
{
var bundle = new TestableBundle("~/bundle");
bundle.AddReference("~\\test");
bundle.AddReference("~\\other");
bundle.References.SequenceEqual(new[] { "~/test", "~/other" }).ShouldBeTrue();
}
示例3: CreateBundleUrlCallsBundleUrlProperty
public void CreateBundleUrlCallsBundleUrlProperty()
{
var bundle = new TestableBundle("~") { Hash = new byte[] {} };
var url = UrlGenerator.CreateBundleUrl(bundle, false);
url.ShouldEqual("_cassette/testablebundle/_");
}
示例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)
);
}
示例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);
}
示例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"))
);
}
示例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);
}
示例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();
}
示例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();
}
示例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();
}
示例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);
}
示例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();
}
示例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();
}
示例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();
}
示例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()
);
}