Exemplo n.º 1
0
        public void Post_Folder_Not_Found()
        {
            var ingredient = new Logic.Recipe.Ingredient(fileSystem, string.Empty, BaseSite, false);
            ingredient.Create();

            Assert.Contains(string.Format(@"{0} folder not found", BaseSite + PostsFolder), writer.ToString());
        }
Exemplo n.º 2
0
        public void Draft_Folder_Not_Found()
        {
            var ingredient = new Logic.Recipe.Ingredient(fileSystem, string.Empty, BaseSite, true);

            ingredient.Create();

            Assert.Contains(string.Format(@"{0} folder not found", BaseSite + DraftsFolder), trace.ToString());
        }
Exemplo n.º 3
0
        public void Post_Folder_Not_Found()
        {
            var ingredient = new Logic.Recipe.Ingredient(fileSystem, string.Empty, BaseSite, false);

            ingredient.Create();

            Assert.Contains(string.Format(@"{0} folder not found", BaseSite + PostsFolder), writer.ToString());
        }
Exemplo n.º 4
0
        public void Post_Is_Created()
        {
            fileSystem.Directory.CreateDirectory(BaseSite + PostsFolder);
            var postTitle = "Post title";
            var postName = string.Format("{0}-{1}.md", DateTime.Today.ToString("yyyy-MM-dd"), SlugifyFilter.Slugify(postTitle));

            var ingredient = new Logic.Recipe.Ingredient(fileSystem, postTitle, BaseSite, false);
            ingredient.Create();

            Assert.True(fileSystem.File.Exists(fileSystem.Path.Combine(BaseSite + PostsFolder, postName)));
        }
Exemplo n.º 5
0
        public void Post_Is_Created()
        {
            fileSystem.Directory.CreateDirectory(BaseSite + PostsFolder);
            var postTitle = "Post title";
            var postName  = string.Format("{0}-{1}.md", DateTime.Today.ToString("yyyy-MM-dd"), SlugifyFilter.Slugify(postTitle));

            var ingredient = new Logic.Recipe.Ingredient(fileSystem, postTitle, BaseSite, false);

            ingredient.Create();

            Assert.True(fileSystem.File.Exists(fileSystem.Path.Combine(BaseSite + PostsFolder, postName)));
        }
Exemplo n.º 6
0
        public void Post_Already_Exists()
        {
            fileSystem.Directory.CreateDirectory(BaseSite + PostsFolder);
            var postTitle = "Post title";
            var postName = string.Format("{0}-{1}.md", DateTime.Today.ToString("yyyy-MM-dd"), SlugifyFilter.Slugify(postTitle));

            var ingredient = new Logic.Recipe.Ingredient(fileSystem, postTitle, BaseSite, false);
            ingredient.Create();
            ingredient.Create();

            Assert.Contains(string.Format("The \"{0}\" file already exists", postName), writer.ToString());
        }
Exemplo n.º 7
0
        public void Post_Has_Correct_Content()
        {
            fileSystem.Directory.CreateDirectory(BaseSite + PostsFolder);
            var postTitle = "Post title";
            var expectedContent = string.Format("---\r\n layout: post \r\n title: {0}\r\n comments: true\r\n---\r\n", postTitle);
            var postName = string.Format("{0}-{1}.md", DateTime.Today.ToString("yyyy-MM-dd"), SlugifyFilter.Slugify(postTitle));

            var ingredient = new Logic.Recipe.Ingredient(fileSystem, "Post title", BaseSite, false);
            ingredient.Create();

            Assert.Equal(expectedContent, fileSystem.File.ReadAllText(fileSystem.Path.Combine(BaseSite + PostsFolder, postName)));
        }
Exemplo n.º 8
0
        public void Post_Already_Exists()
        {
            fileSystem.Directory.CreateDirectory(BaseSite + PostsFolder);
            var postTitle = "Post title";
            var postName  = string.Format("{0}-{1}.md", DateTime.Today.ToString("yyyy-MM-dd"), SlugifyFilter.Slugify(postTitle));

            var ingredient = new Logic.Recipe.Ingredient(fileSystem, postTitle, BaseSite, false);

            ingredient.Create();
            ingredient.Create();

            Assert.Contains(string.Format("The \"{0}\" file already exists", postName), trace.ToString());
        }
Exemplo n.º 9
0
        public void Post_Has_Correct_Content()
        {
            fileSystem.Directory.CreateDirectory(BaseSite + PostsFolder);
            var postTitle       = "Post title";
            var expectedContent = string.Format("---\r\n layout: post \r\n title: {0}\r\n comments: true\r\n---\r\n", postTitle);
            var postName        = string.Format("{0}-{1}.md", DateTime.Today.ToString("yyyy-MM-dd"), SlugifyFilter.Slugify(postTitle));

            var ingredient = new Logic.Recipe.Ingredient(fileSystem, "Post title", BaseSite, false);

            ingredient.Create();

            Assert.Equal(expectedContent, fileSystem.File.ReadAllText(fileSystem.Path.Combine(BaseSite + PostsFolder, postName)));
        }