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()); }
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()); }
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))); }
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()); }
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))); }
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()); }