CommandResolverTestUtils.cs 836 B

123456789101112131415161718192021222324252627
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. using Microsoft.DotNet.Cli.Utils;
  4. namespace Microsoft.DotNet.Tests
  5. {
  6. public static class CommandResolverTestUtils
  7. {
  8. public static string CreateNonRunnableTestCommand(string directory, string filename, string extension = ".dll")
  9. {
  10. Directory.CreateDirectory(directory);
  11. var filePath = Path.Combine(directory, filename + extension);
  12. File.WriteAllText(filePath, "test command that does nothing.");
  13. return filePath;
  14. }
  15. public static IEnvironmentProvider SetupEnvironmentProviderWhichFindsExtensions(params string[] extensions)
  16. {
  17. return new EnvironmentProvider(extensions);
  18. }
  19. }
  20. }