Пример #1
0
        public async Task TestManifest()
        {
            _blogConfigMock.Setup(bc => bc.GeneralSettings).Returns(new Configuration.GeneralSettings
            {
                SiteTitle = "Fake Title"
            });

            _webHostEnvMock.Setup(p => p.WebRootPath).Returns(@"C:\35\404\996\251");

            var ctl = new AssetsController(
                _loggerMock.Object,
                _appSettingsMock.Object,
                _imageStorageSettingsMock.Object,
                _asyncImageStorageProviderMock.Object,
                _blogConfigMock.Object,
                _siteIconGeneratorMock.Object,
                _webHostEnvMock.Object);

            var result = await ctl.Manifest(_webHostEnvMock.Object);

            Assert.IsInstanceOf(typeof(JsonResult), result);
            if (result is JsonResult jsonResult)
            {
                if (jsonResult.Value is ManifestModel model)
                {
                    Assert.IsTrue(model.ShortName == _blogConfigMock.Object.GeneralSettings.SiteTitle);
                    Assert.IsTrue(model.Name == _blogConfigMock.Object.GeneralSettings.SiteTitle);
                }
            }
        }
Пример #2
0
        public void TestManifest()
        {
            _blogConfigMock.Setup(bc => bc.GeneralSettings).Returns(new Configuration.GeneralSettings()
            {
                SiteTitle = "Fake Title"
            });

            var ctl    = new AssetsController(_loggerMock.Object, _appSettingsMock.Object, _blogConfigMock.Object);
            var result = ctl.Manifest();

            Assert.IsInstanceOf(typeof(JsonResult), result);
            if (result is JsonResult jsonResult)
            {
                if (jsonResult.Value is ManifestModel model)
                {
                    Assert.IsTrue(model.ShortName == _blogConfigMock.Object.GeneralSettings.SiteTitle);
                    Assert.IsTrue(model.Name == _blogConfigMock.Object.GeneralSettings.SiteTitle);
                }
            }
        }