-
Notifications
You must be signed in to change notification settings - Fork 453
Update version tests to use the new test framework #4443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Copilot
wants to merge
7
commits into
main
Choose a base branch
from
copilot/fix-4337
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f460a03
Initial plan for issue
Copilot 5ea4bfe
Implement FuncVersionCommand and update version test to use new frame…
Copilot 7615990
Restructure version tests according to new framework patterns
Copilot 6ab058e
fixing version tests to compile
aishwaryabh 8dc3801
updating tests to pass
aishwaryabh 26cef57
Remove unnecessary FluentAssertions from VersionHelperTests
Copilot e746c21
Revert FluentAssertions removal from VersionHelperTests
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
30 changes: 6 additions & 24 deletions
30
...e.Functions.Cli.Tests/E2E/VersionTests.cs → ...Functions.Cli.Tests/VersionHelperTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
test/Cli/Func.E2E.Tests/Commands/FuncVersion/VersionTests.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
using Azure.Functions.Cli.TestFramework.Assertions; | ||
using Azure.Functions.Cli.TestFramework.Commands; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace Azure.Functions.Cli.E2E.Tests.Commands.FuncVersion | ||
{ | ||
public class VersionTests(ITestOutputHelper log) : BaseE2ETests(log) | ||
{ | ||
[Theory] | ||
[InlineData("-v")] | ||
[InlineData("-version")] | ||
[InlineData("--version")] | ||
public void Version_DisplaysVersionNumber(string args) | ||
{ | ||
var testName = nameof(Version_DisplaysVersionNumber); | ||
var versionCommand = new FuncVersionCommand(FuncPath, testName, Log); | ||
|
||
// Execute the command | ||
var result = versionCommand | ||
.WithWorkingDirectory(WorkingDirectory) | ||
.Execute(new[] { args }); | ||
|
||
// Verify the output contains a version number starting with "4." | ||
result.Should().HaveStdOutContaining("4."); | ||
result.Should().ExitWith(0); | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the MIT License. See LICENSE in the project root for license information. | ||
|
||
using Xunit.Abstractions; | ||
|
||
namespace Azure.Functions.Cli.TestFramework.Commands | ||
{ | ||
public class FuncVersionCommand(string funcPath, string testName, ITestOutputHelper log) : FuncCommand(log) | ||
{ | ||
private readonly string _commandName = "version"; | ||
private readonly string _funcPath = funcPath; | ||
private readonly string _testName = testName; | ||
|
||
protected override CommandInfo CreateCommand(IEnumerable<string> args) | ||
{ | ||
var arguments = new List<string> { _commandName }.Concat(args).ToList(); | ||
|
||
if (WorkingDirectory is null) | ||
{ | ||
throw new InvalidOperationException("Working Directory must be set"); | ||
} | ||
|
||
var commandInfo = new CommandInfo() | ||
{ | ||
FileName = _funcPath, | ||
Arguments = arguments, | ||
WorkingDirectory = WorkingDirectory, | ||
TestName = _testName, | ||
}; | ||
|
||
return commandInfo; | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.