当前位置: 首页>>代码示例>>C#>>正文


C# FileNotFoundException.ToString方法代码示例

本文整理汇总了C#中System.IO.FileNotFoundException.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# FileNotFoundException.ToString方法的具体用法?C# FileNotFoundException.ToString怎么用?C# FileNotFoundException.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.FileNotFoundException的用法示例。


在下文中一共展示了FileNotFoundException.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NoRestriction

		public void NoRestriction ()
		{
			FileNotFoundException fle = new FileNotFoundException ("message", "filename",
				new FileNotFoundException ("inner message", "inner filename"));

			Assert.AreEqual ("message", fle.Message, "Message");
			Assert.AreEqual ("filename", fle.FileName, "FileName");
			Assert.IsNull (fle.FusionLog, "FusionLog");
			Assert.IsNotNull (fle.ToString (), "ToString");
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:10,代码来源:FileNotFoundExceptionCas.cs

示例2: Constructor2

		public void Constructor2 ()
		{
			FileNotFoundException fnf = new FileNotFoundException ("message");

#if NET_2_0
			Assert.IsNotNull (fnf.Data, "#1");
#endif
			Assert.IsNull (fnf.FileName, "#2");
			Assert.IsNull (fnf.InnerException, "#3");
			Assert.IsNotNull (fnf.Message, "#4");
			Assert.AreEqual ("message", fnf.Message, "#5");
			Assert.IsNull (fnf.FusionLog, "#6");
#if TARGET_JVM
            Assert.IsTrue(fnf.ToString().StartsWith(fnf.GetType().FullName + ": message"),"#7");
#else
			Assert.AreEqual (fnf.GetType ().FullName + ": message",
				fnf.ToString (), "#7");
#endif
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:19,代码来源:FileNotFoundExceptionTest.cs

示例3: Constructor1

		public void Constructor1 ()
		{
			FileNotFoundException fnf = new FileNotFoundException ();

			Assert.IsNotNull (fnf.Data, "#1");
			Assert.IsNull (fnf.FileName, "#2");
			Assert.IsNull (fnf.InnerException, "#3");
			Assert.IsNotNull (fnf.Message, "#4"); // Unable to find the specified file
			Assert.IsNull (fnf.FusionLog, "#5");
			Assert.IsTrue (fnf.ToString ().StartsWith (fnf.GetType().FullName), "#6");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:11,代码来源:FileNotFoundExceptionTest.cs

示例4: FullRestriction

		public void FullRestriction ()
		{
			FileNotFoundException fle = new FileNotFoundException ("message", "filename",
				new FileNotFoundException ("inner message", "inner filename"));

			Assert.AreEqual ("message", fle.Message, "Message");
			Assert.AreEqual ("filename", fle.FileName, "FileName");
			Assert.IsNull (fle.FusionLog, "FusionLog");
			// ToString doesn't work in this case and strangely throws a FileNotFoundException
			Assert.IsNotNull (fle.ToString (), "ToString");
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:11,代码来源:FileNotFoundExceptionCas.cs

示例5: Constructor2_Message_Empty

		public void Constructor2_Message_Empty ()
		{
			FileNotFoundException fnf = new FileNotFoundException (string.Empty);

			Assert.IsNotNull (fnf.Data, "#1");
			Assert.IsNull (fnf.FileName, "#2");
			Assert.IsNull (fnf.InnerException, "#3");
			Assert.IsNotNull (fnf.Message, "#4");
			Assert.AreEqual (string.Empty, fnf.Message, "#5");
			Assert.IsNull (fnf.FusionLog, "#6");
			Assert.AreEqual (fnf.GetType ().FullName + ": ",
				fnf.ToString (), "#7");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:13,代码来源:FileNotFoundExceptionTest.cs

示例6: Constructor3

		public void Constructor3 ()
		{
			ArithmeticException ame = new ArithmeticException ("something");
			FileNotFoundException fnf = new FileNotFoundException ("message",
				ame);

			Assert.IsNotNull (fnf.Data, "#1");
			Assert.IsNull (fnf.FileName, "#2");
			Assert.IsNotNull (fnf.InnerException, "#3");
			Assert.AreSame (ame, fnf.InnerException, "#4");
			Assert.IsNotNull (fnf.Message, "#5");
			Assert.AreEqual ("message", fnf.Message, "#6");
			Assert.IsNull (fnf.FusionLog, "#7");
			Assert.AreEqual (fnf.GetType ().FullName + ": message ---> "
				+ ame.GetType ().FullName + ": something", fnf.ToString (), "#8");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:16,代码来源:FileNotFoundExceptionTest.cs

示例7: Constructor4_Message_Null

		public void Constructor4_Message_Null ()
		{
			FileNotFoundException fnf = null;
			
			fnf = new FileNotFoundException ((string) null, "file.txt");

			Assert.IsNotNull (fnf.Data, "#A1");
			Assert.IsNotNull (fnf.FileName, "#A2");
			Assert.AreEqual ("file.txt", fnf.FileName, "#A3");
			Assert.IsNull (fnf.InnerException, "#A4");
			Assert.IsNotNull (fnf.Message, "#A5");
			Assert.IsNull (fnf.FusionLog, "#A6");
			Assert.IsTrue (fnf.ToString ().StartsWith (fnf.GetType ().FullName
				+ ": "), "#A7");
			Assert.IsTrue (fnf.ToString ().IndexOf (Environment.NewLine) != -1, "#A8");
			Assert.IsTrue (fnf.ToString ().IndexOf ("'file.txt'") != -1, "#A9");
			Assert.IsFalse (fnf.ToString ().IndexOf ("\"file.txt\"") != -1, "#A10");

			fnf = new FileNotFoundException ((string) null, string.Empty);

			Assert.IsNotNull (fnf.Data, "#B1");
			Assert.IsNotNull (fnf.FileName, "#B2");
			Assert.AreEqual (string.Empty, fnf.FileName, "#B3");
			Assert.IsNull (fnf.InnerException, "#B4");
			// .NET 1.1: File or assembly name , or one of its dependencies ...
			// .NET 2.0: Could not load file or assembly '' or one of its ...
			Assert.IsNotNull (fnf.Message, "#B5");
			Assert.IsNull (fnf.FusionLog, "#B6");
			Assert.IsTrue (fnf.ToString ().StartsWith (fnf.GetType ().FullName
				+ ": "), "#B7");
			Assert.IsFalse (fnf.ToString ().IndexOf (Environment.NewLine) != -1, "#B8");
			Assert.IsTrue (fnf.ToString ().IndexOf ("''") != -1, "#B9");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:33,代码来源:FileNotFoundExceptionTest.cs

示例8: Constructor4_Message_Empty

		public void Constructor4_Message_Empty ()
		{
			FileNotFoundException fnf = null;
			
			fnf = new FileNotFoundException (string.Empty, "file.txt");

			Assert.IsNotNull (fnf.Data, "#1");
			Assert.IsNotNull (fnf.FileName, "#2");
			Assert.AreEqual ("file.txt", fnf.FileName, "#3");
			Assert.IsNull (fnf.InnerException, "#4");
			Assert.IsNotNull (fnf.Message, "#5");
			Assert.AreEqual (string.Empty, fnf.Message, "#6");
			Assert.IsNull (fnf.FusionLog, "#7");
			Assert.IsTrue (fnf.ToString ().StartsWith (fnf.GetType ().FullName
				+ ": " + Environment.NewLine), "#8");
			Assert.IsTrue (fnf.ToString ().IndexOf ("'file.txt'") != -1, "#9");
			Assert.IsFalse (fnf.ToString ().IndexOf ("\"file.txt\"") != -1, "#10");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:18,代码来源:FileNotFoundExceptionTest.cs

示例9: Constructor4_FileNameAndMessage_Null

		public void Constructor4_FileNameAndMessage_Null ()
		{
			FileNotFoundException fnf = new FileNotFoundException ((string) null,
				(string) null);

			Assert.IsNotNull (fnf.Data, "#1");
			Assert.IsNull (fnf.FileName, "#2");
			Assert.IsNull (fnf.InnerException, "#3");
			Assert.IsNull (fnf.Message, "#4");
			Assert.IsNull (fnf.FusionLog, "#5");
			Assert.IsTrue (fnf.ToString ().StartsWith (fnf.GetType ().FullName
				+ ": "), "#6");
			Assert.IsFalse (fnf.ToString ().IndexOf (Environment.NewLine) != -1, "#7");
			Assert.IsFalse (fnf.ToString ().IndexOf ("''") != -1, "#8");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:15,代码来源:FileNotFoundExceptionTest.cs

示例10: Constructor4_FileName_Null

		public void Constructor4_FileName_Null ()
		{
			FileNotFoundException fnf = new FileNotFoundException ("message",
				(string) null);

			Assert.IsNotNull (fnf.Data, "#A1");
			Assert.IsNull (fnf.FileName, "#A2");
			Assert.IsNull (fnf.InnerException, "#A3");
			Assert.IsNotNull (fnf.Message, "#A4");
			Assert.AreEqual ("message", fnf.Message, "#A5");
			Assert.IsNull (fnf.FusionLog, "#A6");
		
			Assert.AreEqual (fnf.GetType ().FullName + ": message",
				fnf.ToString (), "#A7");

			fnf = new FileNotFoundException (string.Empty, (string) null);

			Assert.IsNotNull (fnf.Data, "#B1");
			Assert.IsNull (fnf.FileName, "#B2");
			Assert.IsNull (fnf.InnerException, "#B3");
			Assert.IsNotNull (fnf.Message, "#B4");
			Assert.AreEqual (string.Empty, fnf.Message, "#B5");
			Assert.IsNull (fnf.FusionLog, "#B6");
			Assert.AreEqual (fnf.GetType ().FullName + ": ",
				fnf.ToString (), "#B7");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:26,代码来源:FileNotFoundExceptionTest.cs

示例11: Constructor3_InnerException_Null

		public void Constructor3_InnerException_Null ()
		{
			FileNotFoundException fnf = new FileNotFoundException ("message",
				(Exception) null);

			Assert.IsNotNull (fnf.Data, "#1");
			Assert.IsNull (fnf.FileName, "#2");
			Assert.IsNull (fnf.InnerException, "#3");
			Assert.IsNotNull (fnf.Message, "#4");
			Assert.AreEqual ("message", fnf.Message, "#5");
			Assert.IsNull (fnf.FusionLog, "#6");
			Assert.AreEqual (fnf.GetType ().FullName + ": message",
				fnf.ToString (), "#7");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:14,代码来源:FileNotFoundExceptionTest.cs

示例12: Constructor2_Message_Null

		public void Constructor2_Message_Null ()
		{
			FileNotFoundException fnf = new FileNotFoundException ((string) null);

#if NET_2_0
			Assert.IsNotNull (fnf.Data, "#1");
#endif
			Assert.IsNull (fnf.FileName, "#2");
			Assert.IsNull (fnf.InnerException, "#3");
#if NET_2_0
			Assert.IsNull (fnf.Message, "#4");
#else
			Assert.IsNotNull (fnf.Message, "#4"); // File or assembly name (null), or ...
#endif
			Assert.IsNull (fnf.FusionLog, "#5");
#if NET_2_0 && !TARGET_JVM
			Assert.AreEqual (fnf.GetType ().FullName + ": ",
				fnf.ToString (), "#6");
#else
			Assert.IsTrue (fnf.ToString ().StartsWith (fnf.GetType ().FullName), "#6");
#endif
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:22,代码来源:FileNotFoundExceptionTest.cs

示例13: Constructor4_FileName_Null

		public void Constructor4_FileName_Null ()
		{
			FileNotFoundException fnf = new FileNotFoundException ("message",
				(string) null);

#if NET_2_0
			Assert.IsNotNull (fnf.Data, "#A1");
#endif
			Assert.IsNull (fnf.FileName, "#A2");
			Assert.IsNull (fnf.InnerException, "#A3");
			Assert.IsNotNull (fnf.Message, "#A4");
			Assert.AreEqual ("message", fnf.Message, "#A5");
			Assert.IsNull (fnf.FusionLog, "#A6");
#if TARGET_JVM
            Assert.IsTrue(fnf.ToString().StartsWith(fnf.GetType().FullName + ": message"), "#A7");
#else
		
			Assert.AreEqual (fnf.GetType ().FullName + ": message",
				fnf.ToString (), "#A7");
#endif

			fnf = new FileNotFoundException (string.Empty, (string) null);

#if NET_2_0
			Assert.IsNotNull (fnf.Data, "#B1");
#endif
			Assert.IsNull (fnf.FileName, "#B2");
			Assert.IsNull (fnf.InnerException, "#B3");
			Assert.IsNotNull (fnf.Message, "#B4");
			Assert.AreEqual (string.Empty, fnf.Message, "#B5");
			Assert.IsNull (fnf.FusionLog, "#B6");
#if TARGET_JVM
            Assert.IsTrue(fnf.ToString().StartsWith(fnf.GetType().FullName + ": "), "#B7");
#else
			Assert.AreEqual (fnf.GetType ().FullName + ": ",
				fnf.ToString (), "#B7");
#endif
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:38,代码来源:FileNotFoundExceptionTest.cs

示例14: Constructor3_Message_Null

		public void Constructor3_Message_Null ()
		{
			ArithmeticException ame = new ArithmeticException ("something");
			FileNotFoundException fnf = new FileNotFoundException ((string) null, ame);

#if NET_2_0
			Assert.IsNotNull (fnf.Data, "#1");
#endif
			Assert.IsNull (fnf.FileName, "#2");
			Assert.IsNotNull (fnf.InnerException, "#3");
			Assert.AreSame (ame, fnf.InnerException, "#4");
#if NET_2_0
			Assert.IsNull (fnf.Message, "#5");
#else
			Assert.IsNotNull (fnf.Message, "#5"); // File or assembly name (null), or ...
#endif
			Assert.IsNull (fnf.FusionLog, "#6");
#if NET_2_0
#if TARGET_JVM
            Assert.IsTrue(fnf.ToString().StartsWith(fnf.GetType().FullName + ":  ---> "
                + ame.GetType().FullName + ": something"), "#7");
#else
			Assert.AreEqual (fnf.GetType ().FullName + ":  ---> "
				+ ame.GetType ().FullName + ": something", fnf.ToString (), "#7");
#endif
#else
			Assert.IsTrue (fnf.ToString ().StartsWith (fnf.GetType ().FullName), "#7");
			Assert.IsFalse (fnf.ToString ().IndexOf (Environment.NewLine) != -1, "#9");
#endif
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:30,代码来源:FileNotFoundExceptionTest.cs

示例15: Constructor3_Message_Empty

		public void Constructor3_Message_Empty ()
		{
			ArithmeticException ame = new ArithmeticException ("something");
			FileNotFoundException fnf = new FileNotFoundException (string.Empty, ame);

#if NET_2_0
			Assert.IsNotNull (fnf.Data, "#1");
#endif
			Assert.IsNull (fnf.FileName, "#2");
			Assert.IsNotNull (fnf.InnerException, "#3");
			Assert.AreSame (ame, fnf.InnerException, "#4");
			Assert.IsNotNull (fnf.Message, "#5");
			Assert.AreEqual (string.Empty, fnf.Message, "#6");
			Assert.IsNull (fnf.FusionLog, "#7");
#if TARGET_JVM
            Assert.IsTrue(fnf.ToString().StartsWith(fnf.GetType().FullName + ":  ---> "
                + ame.GetType().FullName + ": something"), "#8");
#else
			Assert.AreEqual (fnf.GetType ().FullName + ":  ---> "
				+ ame.GetType ().FullName + ": something", fnf.ToString (), "#8");
#endif
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:22,代码来源:FileNotFoundExceptionTest.cs


注:本文中的System.IO.FileNotFoundException.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。