Skip to content

Commit

Permalink
Return value of pure method is not used
Browse files Browse the repository at this point in the history
  • Loading branch information
IT-VBFK committed Jun 14, 2023
1 parent cb2bd03 commit d4e6af6
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2476,7 +2476,7 @@ public void Should_throw_a_helpful_error_when_accidentally_using_equals_with_a_r
DateTimeOffset someDateTimeOffset = new(2022, 9, 25, 13, 48, 42, 0, TimeSpan.Zero);

// Act
Action action = () => someDateTimeOffset.Should().BeLessThan(0.Seconds()).Equals(someDateTimeOffset);
Action action = () => var _ = someDateTimeOffset.Should().BeLessThan(0.Seconds()).Equals(someDateTimeOffset);

// Assert
action.Should().Throw<NotSupportedException>()
Expand Down Expand Up @@ -2587,7 +2587,7 @@ public void Should_throw_a_helpful_error_when_accidentally_using_equals()
DateTimeOffset someDateTimeOffset = new(2022, 9, 25, 13, 48, 42, 0, TimeSpan.Zero);

// Act
Action action = () => someDateTimeOffset.Should().Equals(someDateTimeOffset);
Action action = () => var _ = someDateTimeOffset.Should().Equals(someDateTimeOffset);
// Assert
action.Should().Throw<NotSupportedException>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ public void Should_throw_a_helpful_error_when_accidentally_using_equals()
MyEnum? subject = null;

// Act
Action action = () => subject.Should().Equals(subject);
Action action = () => var _ = subject.Should().Equals(subject);
// Assert
action.Should().Throw<NotSupportedException>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ public void Should_throw_a_helpful_error_when_accidentally_using_equals()
var someObject = new Exception();

// Act
Action action = () => someObject.Should().Equals(someObject);
Action action = () => var _ = someObject.Should().Equals(someObject);
// Assert
action.Should().Throw<NotSupportedException>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1386,7 +1386,7 @@ public void Should_throw_a_helpful_error_when_accidentally_using_equals()
TimeOnly someTimeOnly = new(21, 1);

// Act
Action act = () => someTimeOnly.Should().Equals(someTimeOnly);
Action act = () => var _ = someTimeOnly.Should().Equals(someTimeOnly);
// Assert
act.Should().Throw<NotSupportedException>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ public void When_asserting_execution_time_of_null_action_it_should_throw()
object subject = null;

// Act
Action act = () => subject.ExecutionTimeOf(s => s.ToString()).Should().BeLessThan(1.Days());
Action act = () => var _ = subject.ExecutionTimeOf(s => s.ToString()).Should().BeLessThan(1.Days());

// Assert
act.Should().ThrowExactly<ArgumentNullException>()
Expand Down Expand Up @@ -626,7 +626,7 @@ public void When_accidentally_using_equals_it_should_throw_a_helpful_error()
var subject = new object();

// Act
Action act = () => subject.ExecutionTimeOf(s => s.ToString()).Should().Equals(1.Seconds());
Action act = () => var _ = subject.ExecutionTimeOf(s => s.ToString()).Should().Equals(1.Seconds());

// Assert
act.Should().Throw<NotSupportedException>().WithMessage(
Expand Down
4 changes: 2 additions & 2 deletions Tests/FluentAssertions.Specs/Types/MethodInfoSelectorSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void When_method_info_selector_is_null_then_should_should_throw()
MethodInfoSelector methodInfoSelector = null;

// Act
Action act = () => methodInfoSelector.Should();
Action act = () => var _ = methodInfoSelector.Should();
// Assert
act.Should().ThrowExactly<ArgumentNullException>()
Expand Down Expand Up @@ -433,7 +433,7 @@ public void When_accidentally_using_equals_it_should_throw_a_helpful_error()
Type type = typeof(TestClassForMethodSelector);

// Act
Action action = () => type.Methods().Should().Equals(null);
Action action = () => var _ = type.Methods().Should().Equals(null);

// Assert
action.Should().Throw<NotSupportedException>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void When_asserting_properties_are_virtual_and_they_are_it_should_succeed

// Act
Action act = () =>
propertyInfoSelector.Should().BeVirtual();
var _ = propertyInfoSelector.Should().BeVirtual();
// Assert
act.Should().NotThrow();
Expand Down Expand Up @@ -298,7 +298,7 @@ public void When_accidentally_using_equals_it_should_throw_a_helpful_error()
var someObject = new PropertyInfoSelectorAssertions();

// Act
Action action = () => someObject.Equals(someObject);
Action action = () => var _ = someObject.Equals(someObject);
// Assert
action.Should().Throw<NotSupportedException>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ public void When_accidentally_using_equals_it_should_throw_a_helpful_error()
});

// Act
Action action = () => types.Should().Equals(types);
Action action = () => var _ = types.Should().Equals(types);
// Assert
action.Should().Throw<NotSupportedException>()
Expand Down
2 changes: 1 addition & 1 deletion Tests/FluentAssertions.Specs/Types/TypeSelectorSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void When_type_selector_is_null_then_should_should_throw()
TypeSelector propertyInfoSelector = null;

// Act
Action act = () => propertyInfoSelector.Should();
Action act = () => var _ = propertyInfoSelector.Should();

// Assert
act.Should().ThrowExactly<ArgumentNullException>()
Expand Down

0 comments on commit d4e6af6

Please sign in to comment.