LogicAppUnit / TestingFramework

Unit testing framework for Azure Logic Apps (Standard)
MIT License
23 stars 11 forks source link

Checking for 'func' command works on MacOS too #14

Closed eashi closed 1 year ago

eashi commented 1 year ago

This PR changes the code that checks for the func command in PATH so that it works on both Windows and MacOS.

The current code only works on Windows:

  1. The path separator is a semicolon (doesn't work on Mac). This PR changes the code so that it uses the Path.PathSeparator rather than hard-coding a semicolon or a colon. For more information check: https://learn.microsoft.com/en-us/dotnet/api/system.io.path.pathseparator?view=net-7.0
  2. The check assumes that the command file func has the extension suffix .exe. This is true on Windows, but not on MacOS. This PR searches for both cases to support both Windows and MacOS.
  3. The Environment.GetEnvironmentVariable("PATH", EnvironmentVariableTarget.Machine) returns null because the option passed EnvironmentVariableTarget.Machine fails on MacOS. Removing the option fixes it and shouldn't cause any unexpected behaviours. For more infomration check https://learn.microsoft.com/en-us/dotnet/api/system.environment.getenvironmentvariable?view=net-7.0
eashi commented 1 year ago

Thanks for accepting the PR. I haven't came across any other issues, but will keep you posted. Cheers.

mark-abrams commented 1 year ago

Hi @eashi , I have uploaded version 1.6.0 of LogicAppUnit to Nuget. This includes your changes in PR #14 and also PR #15 for support for the MacOS platform. Thank you for your contribution.

eashi commented 1 year ago

This is great news, thanks Mark for the great project and active maintenance.