// Add record to a new log file // becausecurrent log file has reached maxEntriesPerFile public void AddRecord_LinesHasReachMaxEntriesPerFileTest() { LibrarianshipImmutable librarian = new LibrarianshipImmutable(3); FileContent file = new FileContent( "LibraryLog_0001.txt", new[] { "1;Arthur Jackson;Responsive Web Design;9/26/2016", "2;Maddox Webb;AngularJS by Example;9/27/2016", "3;Mel Fry;Python Machine Learning;9/28/2016" }); FileAction action = librarian.AddRecord( file, "Haiden Brown", "Practical Data Science", new DateTime(2016, 9, 29, 0, 0, 0)); Assert.AreEqual( ActionType.Create, action.Type); Assert.AreEqual( "LibraryLog_0002.txt", action.FileName); CollectionAssert.AreEqual( new[] { "1;Haiden Brown;Practical Data Science;9/29/2016" }, action.Content); }
// Add record to existing log file // but the lines is lower then maxEntriesPerFile public void AddRecord_LinesIsLowerThanMaxEntriesPerFileTest() { LibrarianshipImmutable librarian = new LibrarianshipImmutable(5); FileContent file = new FileContent( "LibraryLog_0001.txt", new[] { "1;Arthur Jackson;Responsive Web Design;9/26/2016" }); FileAction action = librarian.AddRecord( file, "Maddox Webb", "AngularJS by Example", new DateTime( 2016, 9, 27, 0, 0, 0)); Assert.AreEqual( ActionType.Update, action.Type); Assert.AreEqual( "LibraryLog_0001.txt", action.FileName); CollectionAssert.AreEqual( new[] { "1;Arthur Jackson;Responsive Web Design;9/26/2016", "2;Maddox Webb;AngularJS by Example;9/27/2016" }, action.Content); }