Skip to content

Commit

Permalink
Move business logic
Browse files Browse the repository at this point in the history
  • Loading branch information
FriggaHel committed Mar 22, 2024
1 parent c2417d9 commit ea67975
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions visual-dotnet/SauceLabs.Visual/VisualCheckOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,7 @@ public class VisualCheckOptions
/// <c>TestName</c> manually set the TestName of the Test.
/// </summary>
public string? TestName { get; set; }

internal bool HasIncompleteTestContext() => string.IsNullOrEmpty(SuiteName) || string.IsNullOrEmpty(TestName);
}
}
2 changes: 1 addition & 1 deletion visual-dotnet/SauceLabs.Visual/VisualClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public Task<string> VisualCheck(string name, VisualCheckOptions? options = null,
[CallerMemberName] string callerMemberName = "")
{
options ??= new VisualCheckOptions();
if (!string.IsNullOrEmpty(callerMemberName) && (string.IsNullOrEmpty(options.SuiteName) || string.IsNullOrEmpty(options.TestName)))
if (!string.IsNullOrEmpty(callerMemberName) && options.HasIncompleteTestContext())
{
var stack = new StackTrace();
var frame = stack.GetFrames()?.FirstOrDefault(f => f.GetMethod().Name == callerMemberName);
Expand Down

0 comments on commit ea67975

Please sign in to comment.