Skip to content
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

Reverted changes to AssertionScope to maintain binary compatibility #977

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 19 additions & 5 deletions Src/FluentAssertions/Execution/AssertionScope.cs
Expand Up @@ -78,7 +78,7 @@ public static AssertionScope Current
private set => current = value;
}

public IAssertionScope UsingLineBreaks
public AssertionScope UsingLineBreaks
{
get
{
Expand All @@ -92,7 +92,7 @@ public bool Succeeded
get => succeeded.HasValue && succeeded.Value;
}

public IAssertionScope BecauseOf(string because, params object[] becauseArgs)
public AssertionScope BecauseOf(string because, params object[] becauseArgs)
{
reason = () =>
{
Expand Down Expand Up @@ -125,7 +125,7 @@ public IAssertionScope BecauseOf(string because, params object[] becauseArgs)
/// </remarks>
/// <param name="message">The format string that represents the failure message.</param>
/// <param name="args">Optional arguments to any numbered placeholders.</param>
public IAssertionScope WithExpectation(string message, params object[] args)
public AssertionScope WithExpectation(string message, params object[] args)
{
var localReason = reason;
expectation = () =>
Expand All @@ -152,7 +152,7 @@ public GivenSelector<T> Given<T>(Func<T> selector)
return new GivenSelector<T>(selector, !succeeded.HasValue || succeeded.Value, this);
}

public IAssertionScope ForCondition(bool condition)
public AssertionScope ForCondition(bool condition)
{
succeeded = condition;

Expand Down Expand Up @@ -266,10 +266,24 @@ public void Dispose()
}
}

public IAssertionScope WithDefaultIdentifier(string identifier)
public AssertionScope WithDefaultIdentifier(string identifier)
{
fallbackIdentifier = identifier;
return this;
}

#region Explicit Implementation to support the interface

IAssertionScope IAssertionScope.ForCondition(bool condition) => ForCondition(condition);

IAssertionScope IAssertionScope.BecauseOf(string because, params object[] becauseArgs) => BecauseOf(because, becauseArgs);

IAssertionScope IAssertionScope.WithExpectation(string message, params object[] args) => WithExpectation(message, args);

IAssertionScope IAssertionScope.WithDefaultIdentifier(string identifier) => WithDefaultIdentifier(identifier);

IAssertionScope IAssertionScope.UsingLineBreaks => UsingLineBreaks;

#endregion
}
}