public void Constructor_PostAndDraftExist_IncrementsNextId() { FakeFileSystem fileSystem = new FakeFileSystem(); fileSystem.AddFile("BlogFiles\\Drafts\\1.xml"); fileSystem.AddFile("BlogFiles\\Posts\\date_2.xml"); TestDataStore.ResetCurrentId(); TestDataStore dataStore = new TestDataStore(fileSystem); Post testPost = new Post { Slug = "Test-slug", Title = "Test title", Body = "Test body", PubDate = DateTime.Now, LastModified = DateTime.Now, IsPublic = false, Excerpt = "Test excerpt" }; dataStore.SavePost(testPost); Assert.Equal(3, testPost.Id); }
public void Constructor_DraftExists_IncrementsNextId() { FakeFileSystem fileSystem = new FakeFileSystem(); fileSystem.AddFile("BlogFiles\\Drafts\\1.xml"); TestDataStore.ResetCurrentId(); TestDataStore dataStore = new TestDataStore(fileSystem); Post testPost = new Post { Title = "Test", Slug = "Test", Body = "test body", PubDate = DateTimeOffset.Now, IsPublic = false }; dataStore.SavePost(testPost); Assert.Equal(2, testPost.Id); }