Example #1
0
        public void Make_Bundle_Url()
        {
            var websiteInfo = new Mock <IWebsiteInfo>();

            websiteInfo.Setup(x => x.GetBasePath()).Returns(string.Empty);
            websiteInfo.Setup(x => x.GetBaseUrl()).Returns(new Uri("http://test.com"));

            var urlHelper = new RequestHelper(websiteInfo.Object);
            var hasher    = new Mock <IHasher>();

            hasher.Setup(x => x.Hash(It.IsAny <string>())).Returns("blah");
            var options = new SmidgeOptions {
                UrlOptions = new UrlManagerOptions {
                    BundleFilePath = "sg"
                }
            };
            var creator = new DefaultUrlManager(
                Mock.Of <IOptions <SmidgeOptions> >(x => x.Value == options),
                hasher.Object,
                urlHelper);

            var url = creator.GetUrl("my-bundle", ".js", false, Mock.Of <ICacheBuster>(buster => buster.GetValue() == "1"));

            Assert.Equal("/sg/my-bundle.js.v1", url);
        }
Example #2
0
        public void Make_Bundle_Url()
        {
            var hasher = new Mock <IHasher>();

            hasher.Setup(x => x.Hash(It.IsAny <string>())).Returns("blah");
            var options = new SmidgeOptions {
                UrlOptions = new UrlManagerOptions {
                    BundleFilePath = "sg"
                }
            };
            var creator = new DefaultUrlManager(
                Mock.Of <IOptions <SmidgeOptions> >(x => x.Value == options),
                Mock.Of <ISmidgeConfig>(x => x.Version == "1"),
                hasher.Object);

            var url = creator.GetUrl("my-bundle", ".js");

            Assert.Equal("sg/my-bundle.js.v1", url);
        }