本文整理汇总了C#中Foo.GetFilePath方法的典型用法代码示例。如果您正苦于以下问题:C# Foo.GetFilePath方法的具体用法?C# Foo.GetFilePath怎么用?C# Foo.GetFilePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Foo
的用法示例。
在下文中一共展示了Foo.GetFilePath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main (string [] args)
{
AppDomainSetup setup = new AppDomainSetup ();
string basedir = AppDomain.CurrentDomain.BaseDirectory;
setup.ConfigurationFile = Path.Combine (AppDomain.CurrentDomain.BaseDirectory,
"t46.exe.config2");
AppDomain domain = AppDomain.CreateDomain ("test",
AppDomain.CurrentDomain.Evidence, setup);
Program p;
Foo f;
Configuration c;
p = GetRemote (domain);
Assert.AreEqual (Path.Combine (basedir, "t46.exe.config2"),
p.GetFilePath (string.Empty), "#A1");
Assert.AreEqual ("Hello World2!",
p.GetSettingValue (string.Empty, "hithere"), "#A2");
Assert.AreEqual (Path.Combine (basedir, "t46.exe.config2"),
p.GetFilePath ((string) null), "#A3");
Assert.AreEqual ("Hello World2!",
p.GetSettingValue ((string) null, "hithere"), "#A4");
p = new Program ();
c = p.OpenExeConfiguration (string.Empty);
Assert.AreEqual (Path.Combine (basedir, "t46.exe.config"),
c.FilePath, "#B1");
Assert.AreEqual ("Hello World!",
c.AppSettings.Settings ["hithere"].Value, "#B2");
c = p.OpenExeConfiguration ((string) null);
Assert.AreEqual (Path.Combine (basedir, "t46.exe.config"),
c.FilePath, "#B3");
Assert.AreEqual ("Hello World!",
c.AppSettings.Settings ["hithere"].Value, "#B4");
f = Foo.GetRemote (domain);
Assert.AreEqual (Path.Combine (basedir, "t46.exe.config2"),
f.GetFilePath (string.Empty), "#C1");
Assert.AreEqual ("Hello World2!",
f.GetSettingValue (string.Empty, "hithere"), "#C2");
Assert.AreEqual (Path.Combine (basedir, "t46.exe.config2"),
f.GetFilePath ((string) null), "#C1");
Assert.AreEqual ("Hello World2!",
f.GetSettingValue ((string) null, "hithere"), "#C2");
f = new Foo ();
c = f.OpenExeConfiguration (string.Empty);
Assert.AreEqual (Path.Combine (basedir, "t46.exe.config"),
c.FilePath, "#D1");
Assert.AreEqual ("Hello World!",
c.AppSettings.Settings ["hithere"].Value, "#D2");
c = f.OpenExeConfiguration ((string) null);
Assert.AreEqual (Path.Combine (basedir, "t46.exe.config"),
c.FilePath, "#D1");
Assert.AreEqual ("Hello World!",
c.AppSettings.Settings ["hithere"].Value, "#D2");
AppDomain.Unload (domain);
setup = new AppDomainSetup ();
domain = AppDomain.CreateDomain ("test",
AppDomain.CurrentDomain.Evidence, setup);
p = GetRemote (domain);
Assert.AreEqual (Path.Combine (basedir, "t46.exe.config"),
p.GetFilePath (string.Empty), "#E1");
Assert.AreEqual ("Hello World!",
p.GetSettingValue (string.Empty, "hithere"), "#E2");
p = new Program ();
c = p.OpenExeConfiguration (string.Empty);
Assert.AreEqual (Path.Combine (basedir, "t46.exe.config"),
c.FilePath, "#F1");
Assert.AreEqual ("Hello World!",
c.AppSettings.Settings ["hithere"].Value, "#F2");
f = Foo.GetRemote (domain);
Assert.AreEqual (Path.Combine (basedir, "t46.exe.config"),
f.GetFilePath (string.Empty), "#G1");
Assert.AreEqual ("Hello World!",
f.GetSettingValue (string.Empty, "hithere"), "#G2");
f = new Foo ();
c = f.OpenExeConfiguration (string.Empty);
Assert.AreEqual (Path.Combine (basedir, "t46.exe.config"),
c.FilePath, "#H1");
Assert.AreEqual ("Hello World!",
c.AppSettings.Settings ["hithere"].Value, "#H2");
Console.WriteLine ("configuration OK");
}