Skip to content

Commit

Permalink
Disable NotThrowAfter for netstandard < 2.0
Browse files Browse the repository at this point in the history
Older versions of netstandard don't support
Thread.Sleep() which is required by NotThrowAfter.
  • Loading branch information
frederik-h committed Nov 19, 2018
1 parent cdd339e commit fe90171
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Src/FluentAssertions/Specialized/ActionAssertions.cs
Expand Up @@ -114,6 +114,7 @@ public void NotThrow(string because = "", params object[] becauseArgs)
}
}

#if NET45 || NET47 || NETSTANDARD2_0 || NETCOREAPP2_0
/// <summary>
/// Asserts that the current <see cref="Action"/> stops throwing any exception
/// after a specified amount of time.
Expand Down Expand Up @@ -165,6 +166,7 @@ public void NotThrowAfter(TimeSpan waitTime, TimeSpan pollInterval, string becau
.BecauseOf(because, becauseArgs)
.FailWith("Did not expect any exceptions after {0}{reason}, but found {1}.", waitTime, exception);
}
#endif

private Exception InvokeSubjectWithInterception()
{
Expand Down
2 changes: 2 additions & 0 deletions Tests/Shared.Specs/ExceptionAssertionSpecs.cs
Expand Up @@ -894,6 +894,7 @@ public void When_no_exception_should_be_thrown_and_none_was_it_should_not_throw(
foo.Invoking(f => f.Do()).Should().NotThrow();
}

#if NET45 || NET47 || NETSTANDARD2_0 || NETCOREAPP2_0
#pragma warning disable CS1998
[Fact]
public void NotThrowAfter_when_subject_is_async_it_should_throw()
Expand Down Expand Up @@ -1020,6 +1021,7 @@ public void NotThrowAfter_when_no_exception_should_be_thrown_after_wait_time_and

act.Should().NotThrow();
}
#endif // NotThrowAfter tests

}

Expand Down

0 comments on commit fe90171

Please sign in to comment.