DesignerSupportTests.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using Xunit;
  8. using Xunit.Extensions;
  9. namespace Avalonia.DesignerSupport.Tests
  10. {
  11. public class DesignerSupportTests
  12. {
  13. [Theory,
  14. InlineData(@"Avalonia.DesignerSupport.TestApp.exe", @"..\..\tests\Avalonia.DesignerSupport.TestApp\MainWindow.xaml"),
  15. InlineData(@"..\..\samples\ControlCatalog.Desktop\bin\$BUILD\ControlCatalog.dll", @"..\..\samples\ControlCatalog\MainWindow.xaml")]
  16. public void DesgignerApiShoudBeOperational(string outputDir, string xamlFile)
  17. {
  18. var xaml = File.ReadAllText(xamlFile);
  19. #if DEBUG
  20. outputDir = outputDir.Replace("$BUILD", "Debug");
  21. #else
  22. outputDir = outputDir.Replace("$BUILD", "Release");
  23. #endif
  24. var domain = AppDomain.CreateDomain("TESTDOMAIN" + Guid.NewGuid());
  25. var checker = (Checker)domain.CreateInstanceFromAndUnwrap(typeof (Checker).Assembly.GetModules()[0].FullyQualifiedName,
  26. "Avalonia.DesignerSupport.Tests.Checker");
  27. checker.DoCheck(outputDir, xaml);
  28. }
  29. }
  30. }