public void CollectPostInfo_EmptyFile_DoesNotHavePostNode_SetDefaultValues() { IFileSystem testFileSystem = new FakeFileSystem(); BlogDataStore testDataStore = new BlogDataStore(testFileSystem); testFileSystem.WriteFileText($"BlogFiles\\Posts\\empty_file.xml", ""); Assert.Null(testDataStore.CollectPostInfo($"BlogFiles\\Posts\\empty_file.xml")); }
public void CollectPostInfo_EmptyFile_HasPostNode_SetDefaultValues() { IFileSystem testFileSystem = new FakeFileSystem(); BlogDataStore testDataStore = new BlogDataStore(testFileSystem); testFileSystem.WriteFileText($"BlogFiles\\Posts\\empty_file.xml", "<Post/>"); Post testPost = testDataStore.CollectPostInfo($"BlogFiles\\Posts\\empty_file.xml"); Assert.NotEqual(default(Guid), testPost.Id); Assert.Equal("", testPost.Slug); Assert.Equal("", testPost.Title); Assert.Equal("", testPost.Body); Assert.Equal(default(DateTimeOffset), testPost.PubDate); Assert.Equal(default(DateTimeOffset), testPost.LastModified); Assert.Equal(true, testPost.IsPublic); Assert.Equal(false, testPost.IsDeleted); Assert.Equal("", testPost.Excerpt); }