[tests] Adjust ConfigTest to cope with different behavior when using NativeAOT.

This commit is contained in:
Rolf Bjarne Kvinge 2023-06-21 20:49:58 +02:00
Родитель 97b91f1600
Коммит c49888bee1
1 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -13,8 +13,17 @@ namespace MonoTouchFixtures {
[Test]
public void Existence ()
{
#if NATIVEAOT
#if __MACCATALYST__ || __MACOS__
var config_dir = Path.Combine (Path.GetDirectoryName (AppContext.BaseDirectory.TrimEnd ('/')), "MonoBundle");
#else
var config_dir = AppContext.BaseDirectory;
#endif
var config_file = Path.Combine (config_dir, Assembly.GetExecutingAssembly ().GetName ().Name + ".dll.config");
#else
var config_file = Assembly.GetExecutingAssembly ().Location + ".config";
Assert.True (File.Exists (config_file), "existence");
#endif
Assert.That (config_file, Does.Exist, "existence");
Assert.That (File.ReadAllText (config_file), Contains.Substring ("<secretMessage>Xamarin rocks</secretMessage>"), "content");
}
}