Title: FluentAssertions .ShouldNotThrow() method is not found with ver5.4.2 but it's found with ver4.19.4
Tags: c#;unit-testing;nuget;fluent-assertions
Question: I have a salt-of-the-earth test project target .net4.7.1. I installed FluentAssertions ver5.4.2 via nuget package manager of visual studio. For some reason this kind of things:
someAction.ShouldNotThrow()
Was throwing an error about ShouldNotThrow() not being recognized. Once we rolled back to FluentAssertions nuget ver4.19.4 everything was ok. What gives? Does one have to tweak the app.config with assembly redirects of some sort or something to that effect?
Comment: When a project changes major versions (such as from 4 to 5) this is typically an indication that the API has been restructured and is not necessarily backwards compatible with existing code. Same thing here. `ShouldNotThrow()` has become `Should().NotThrow()` for consistency. This is [documented](https://www.continuousimprover.com/2018/02/fluent-assertions-50-best-unit-test.html).

Comment: +1 Thanks for tuning in. Can you please convert your comment over to an answer so that I can accept it? Thank in advance!


Here is another answer: Use someAction.Should().NotThrow<T&gt;() with optional T argument for exception type.
See documentation for version 5

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 2, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2018:00:11/07/18', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<c#><unit-testing><nuget><fluent-assertions>', 'Title': "FluentAssertions .ShouldNotThrow() method is not found with ver5.4.2 but it's found with ver4.19.4", 'ViewCount': 392, 'id': 53188128, 'user_AboutMe': '', 'user_AccountId': 461742.0, 'user_DisplayName': 'XDS', 'user_Reputation': 3359.0, 'user_Views': 421.0, 'user_id': 863651.0}}