Dev2.Diagnostics.DebugItem.ClearFile C# (CSharp) Method

ClearFile() public method

public ClearFile ( string fileName ) : void
fileName string
return void
        public void ClearFile(string fileName)
        {

            var path = Path.Combine(_tempPath, fileName);
            if(File.Exists(path))
            {
                File.Delete(path);
            }
        }

Usage Example

        // 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);
        }
All Usage Examples Of Dev2.Diagnostics.DebugItem::ClearFile