AssemblyInit.cs 621 B

1234567891011121314151617181920212223242526272829
  1. using System.IO;
  2. using Microsoft.VisualStudio.TestTools.UnitTesting;
  3. namespace BepInEx.Tests
  4. {
  5. [TestClass]
  6. public class AssemblyInit
  7. {
  8. private static string _testPath;
  9. [AssemblyInitialize]
  10. public static void InitAss(TestContext context)
  11. {
  12. _testPath = Path.Combine(Path.GetTempPath(), "BepinexTestDir");
  13. Directory.CreateDirectory(_testPath);
  14. string exePath = Path.Combine(_testPath, "Text.exe");
  15. File.WriteAllBytes(exePath, new byte[] { });
  16. Paths.SetExecutablePath(_testPath);
  17. }
  18. [AssemblyCleanup]
  19. public static void CleanupAss()
  20. {
  21. Directory.Delete(_testPath, true);
  22. }
  23. }
  24. }