A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

38 lines
1.2 KiB

using System;
using System.IO;
using System.Reflection;
using Xunit;
namespace Avalonia.Build.Tasks.UnitTest;
public class CompileAvaloniaXamlTaskTest
{
[Fact]
public void Does_Not_Fail_When_Codebehind_Contains_DllImport()
{
using var engine = UnitTestBuildEngine.Start();
var basePath = Path.Combine(Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath), "Assets");
var originalAssemblyPath = Path.Combine(basePath,
"PInvoke.dll");
var referencesPath = Path.Combine(basePath,
"PInvoke.dll.refs");
var compiledAssemblyPath = "PInvoke.dll";
Assert.True(File.Exists(originalAssemblyPath), $"The original {originalAssemblyPath} don't exists.");
new CompileAvaloniaXamlTask()
{
AssemblyFile = originalAssemblyPath,
ReferencesFilePath = referencesPath,
OutputPath = compiledAssemblyPath,
RefAssemblyFile = null,
BuildEngine = engine,
ProjectDirectory = Directory.GetCurrentDirectory(),
VerifyIl = true
}.Execute();
Assert.Equal(0, engine.Errors.Count);
}
}