Skip to content

Commit

Permalink
test case #false
Browse files Browse the repository at this point in the history
  • Loading branch information
v-vreyya authored and v-vreyya committed Dec 26, 2024
1 parent b2ee66c commit b628285
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/Azure.Functions.Cli/Helpers/VersionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ namespace Azure.Functions.Cli.Helpers
internal class VersionHelper
{
private static string _cliVersion = Constants.CliVersion;
private static string _latestCoreToolsAssemblyZipFile;

// This method is created only for testing
public static void SetCliVersion(string version)
public static void SetCliVersion(string version, string assemblyZipfile)
{
_cliVersion = version;
_latestCoreToolsAssemblyZipFile = assemblyZipfile;
}

public static async Task<string> RunAsync(Task<bool> isRunningOlderVersion = null)
Expand Down Expand Up @@ -64,7 +66,7 @@ public static async Task<bool> IsRunningAnOlderVersion()
releaseList.Add(new ReleaseSummary(jProperty.Name, releaseDetail.ReleaseList.FirstOrDefault()));
}

var latestCoreToolsAssemblyZipFile = releaseList.FirstOrDefault(x => x.Release == data.Tags.V4Release.ReleaseVersion)?.CoreToolsAssemblyZipFile;
var latestCoreToolsAssemblyZipFile = _latestCoreToolsAssemblyZipFile ?? releaseList.FirstOrDefault(x => x.Release == data.Tags.V4Release.ReleaseVersion)?.CoreToolsAssemblyZipFile;

if (!string.IsNullOrEmpty(latestCoreToolsAssemblyZipFile) &&
!latestCoreToolsAssemblyZipFile.Contains($"{_cliVersion}.zip"))
Expand Down
3 changes: 2 additions & 1 deletion test/Azure.Functions.Cli.Tests/E2E/VersionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@ public void CoreToolsAssemblyZipFile_ShouldReturnEmpty_WhenDownloadLinkIsNull()

[Theory]
[InlineData("4.0.1", true)]
[InlineData("4.0.6610", false)]
public async Task IsRunningAnOlderVersion_ReturnsExpected_WhenOlderVersion(string cliVersion, bool expected)
{
VersionHelper.SetCliVersion(cliVersion);
VersionHelper.SetCliVersion(cliVersion, "Azure.Functions.Cli.linux-x64.4.0.6610.zip");

var result = await VersionHelper.IsRunningAnOlderVersion();

Expand Down

0 comments on commit b628285

Please sign in to comment.