public void AppendStringToExistingFile_AppendTextWithoutNewLine_TextIsAppended() { //Arrange var textToWriteToFile = "Text for test writing to file."; var textToAppendToExistingFile = "Appended text."; var fileName = Path.GetTempFileName(); File.WriteAllText(fileName, textToWriteToFile); //Act FileLibrary.AppendStringToExistingFile(textToAppendToExistingFile, fileName, false); //Assert Assert.AreEqual( string.Format("{0}{1}", textToWriteToFile, textToAppendToExistingFile), File.ReadAllText(fileName)); }