示例#1
0
        // ReSharper disable InconsistentNaming - Unit Test
        public void SaveFile_With_NullParameters_Expected_ThrowsArgumentNullException()
        // ReSharper restore InconsistentNaming
        {
            var debugState = new DebugItem();

            debugState.SaveFile(null, null);
        }
示例#2
0
        public void SaveFile_With_NullParameters_Expected_ThrowsArgumentNullException()

        {
            var debugState = new DebugItem();

            debugState.SaveFile(null, null);
        }
示例#3
0
        public void DebugItem_SaveFile_With_Contents_Expected_SavesFileToDisk()
        {
            var debugState = new DebugItem();

            debugState.ClearFile("TestDebugItemFile.txt");
            EnvironmentVariables.WebServerUri = "http://localhost:3142";
            var uri    = debugState.SaveFile(LongText, "TestDebugItemFile.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);
        }
示例#4
0
        public void DebugIem_SaveFile_WithContentsNewLineChars_ExpectedSavesFileToDiskWithCorrectChars()
        {
            var debugState = new DebugItem();

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

            var uri    = debugState.SaveFile(textToWrite, "TestSpecialCharsFile.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);
        }