ClearFile() 공개 메소드

public ClearFile ( string fileName ) : void
fileName string
리턴 void
예제 #1
0
        // ReSharper disable InconsistentNaming - Unit Test
        public void DebugIem_SaveFile_WithContentsNewLineChars_ExpectedSavesFileToDiskWithCorrectChars()
        // ReSharper restore InconsistentNaming
        {
            var debugState = new DebugItem();

            debugState.ClearFile("TestFile.txt");
            EnvironmentVariables.WebServerUri = "http://localhost:3142";
            string expeced = "\r\nThis is\r\n the text\\n that we are writing";
            string textToWrite = "\nThis is\r\n the text\\n that we are writing";

            var uri = debugState.SaveFile(textToWrite, "TestFile.txt");
            var path = new Uri(uri).OriginalString.Replace("?DebugItemFilePath=", "").Replace(EnvironmentVariables.WebServerUri + "/Services/FetchDebugItemFileService", "");
            var exists = File.Exists(path);
            Assert.IsTrue(exists);

            var contents = File.ReadAllText(path);
            Assert.AreEqual(expeced, contents);
        }
예제 #2
0
        // ReSharper disable InconsistentNaming - Unit Test
        public void SaveFile_With_Contents_Expected_SavesFileToDisk()
        // ReSharper restore InconsistentNaming
        {
            var debugState = new DebugItem();

            debugState.ClearFile("TestFile.txt");
            EnvironmentVariables.WebServerUri = "http://localhost:3142";
            var uri = debugState.SaveFile(LongText, "TestFile.txt");
            var path = new Uri(uri).OriginalString.Replace("?DebugItemFilePath=", "").Replace(EnvironmentVariables.WebServerUri + "/Services/FetchDebugItemFileService", "");
            var exists = File.Exists(path);
            Assert.IsTrue(exists);

            var contents = File.ReadAllText(path);
            Assert.AreEqual(LongText, contents);
        }