Exemplo n.º 1
0
        public void ThrowWithTheProperSettingNameIfTitleIsNotSupplied()
        {
            string rootPath = $"c:\\{string.Empty.GetRandom()}\\";

            var xml = new SettingsFileBuilder().UseRandomValues()
                      .RemoveTitle().Build();

            var fileSystem = new Mock <IFile>();

            fileSystem.Setup(f => f.ReadAllText(It.IsAny <string>()))
            .Returns(xml.ToString());

            SiteSettings actual;
            string       expected = nameof(actual.Title);
            var          target   = (null as IContentRepository).Create(fileSystem.Object, rootPath);

            try
            {
                actual = target.GetSiteSettings();
            }
            catch (SettingNotFoundException ex)
            {
                Assert.Equal(expected, ex.SettingName);
            }
        }
Exemplo n.º 2
0
        public void ReturnAnEmptyStringIfThemeIsNotSupplied()
        {
            var xml = new SettingsFileBuilder().UseRandomValues()
                      .RemoveTheme().Build();

            var fileSystem = new Mock <IFile>();

            fileSystem.Setup(f => f.ReadAllText(It.IsAny <string>()))
            .Returns(xml.ToString());

            var target = (null as IContentRepository).Create(fileSystem.Object, "c:\\");
            var actual = target.GetSiteSettings();

            Assert.Equal(string.Empty, actual.Theme);
        }