A fork of Eusth's IPA
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.

ProgramTest.cs 1.6KB

6 years ago
123456789101112131415161718192021222324252627282930313233343536373839
  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. namespace IPA.Tests
  9. {
  10. public class ProgramTest
  11. {
  12. [Theory]
  13. // Unrelated path
  14. [InlineData("test/from.dll", "test/to.dll", "native", false, new string[] { "test/to.dll" })]
  15. // Flat -> Not-Flat
  16. [InlineData("native/from.dll", "native/to.dll", "native", false, new string[] { "native/x86/to.dll", "native/x86_64/to.dll" })]
  17. // Flat -> Flat
  18. [InlineData("native/from.dll", "native/to.dll", "native", true, new string[] { "native/to.dll" })]
  19. // Not-Flat -> Flat
  20. [InlineData("native/x86/from.dll", "native/x86/to.dll", "native", true, new string[] { })]
  21. [InlineData("native/x86_64/from.dll", "native/x86_64/to.dll", "native", true, new string[] { "native/to.dll" })]
  22. // Not-flat -> Not-Flat
  23. [InlineData("native/x86/from.dll", "native/x86/to.dll", "native", false, new string[] { "native/x86/to.dll" })]
  24. [InlineData("native/x86_64/from.dll", "native/x86_64/to.dll", "native", false, new string[] { "native/x86_64/to.dll" })]
  25. public void CopiesCorrectly(string from, string to, string nativeFolder, bool isFlat, string[] expected)
  26. {
  27. var outcome = Program.NativePluginInterceptor(new FileInfo(from), new FileInfo(to), new DirectoryInfo(nativeFolder), isFlat, Program.Architecture.Unknown).Select(f => f.FullName).ToList();
  28. var expectedPaths = expected.Select(e => new FileInfo(e)).Select(f => f.FullName).ToList();
  29. Assert.Equal(expectedPaths, outcome);
  30. }
  31. }
  32. }