public void WriteToFile_WriteTextToFile_FileContainsGivenText() { //Arrange var fileNamePrefix = "testFile"; var fileExtension = "txt"; var textToWriteToFile = "Text for test writing to file."; var strTimestamp = System.DateTime.Now.ToString("yyyyMMdd_HHmmss"); var fileName = fileNamePrefix + "_" + strTimestamp + "." + fileExtension; //Act FileLibrary.WriteToFile(textToWriteToFile, fileNamePrefix, fileExtension); //Assert Assert.AreEqual(textToWriteToFile, File.ReadAllText(fileName)); File.Delete(fileName); }
public void WriteToFile_WriteTextToFile_FileIsCrated() { //Arrange var fileNamePrefix = "testFile"; var fileExtension = "txt"; var textToWriteToFile = "Text for test writing to file."; var strTimestamp = System.DateTime.Now.ToString("yyyyMMdd_HHmmss"); var fileName = fileNamePrefix + "_" + strTimestamp + "." + fileExtension; //Act FileLibrary.WriteToFile(textToWriteToFile, fileNamePrefix, fileExtension); //Assert Assert.IsTrue(File.Exists(fileName)); File.Delete(fileName); }