Skip to content

Commit

Permalink
refactor: removes unnecessary exception message assertions
Browse files Browse the repository at this point in the history
These messages differ between .NET Framework, .NET Standard and .NET 8, making them tedious to test. The messages themselves are superfluous and unnecessary for what we're doing, so the assertions have been removed.
  • Loading branch information
nozzlegear committed Jan 15, 2025
1 parent b7c0414 commit e761833
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ public void Deserialize_WhenTheNodeIsNotASystemTextJsonNode_ShouldThrow()
// Assert
act.Should()
.Throw<ArgumentException>()
.WithMessage($"Expected a {nameof(SystemJsonElement)} but got *. (Parameter 'element')")
.And
.ParamName
.Should()
Expand Down Expand Up @@ -305,7 +304,6 @@ public void Deserialize_T_WhenTheNodeIsNotASystemTextJsonNode_ShouldThrow()
// Assert
act.Should()
.Throw<ArgumentException>()
.WithMessage($"Expected a {nameof(SystemJsonElement)} but got *. (Parameter 'element')")
.And
.ParamName
.Should()
Expand Down Expand Up @@ -378,8 +376,7 @@ public async Task DeserializeAsync_WhenTheNodeIsNotASystemTextJsonNode_ShouldThr

// Assert
var exn = await act.Should()
.ThrowAsync<ArgumentException>()
.WithMessage($"Expected a {nameof(SystemJsonElement)} but got *. (Parameter 'element')");
.ThrowAsync<ArgumentException>();
exn.And.ParamName.Should().Be("element");
}

Expand Down Expand Up @@ -458,8 +455,7 @@ public async Task DeserializeAsync_T_WhenTheNodeIsNotASystemTextJsonNode_ShouldT

// Assert
var exn = await act.Should()
.ThrowAsync<ArgumentException>()
.WithMessage($"Expected a {nameof(SystemJsonElement)} but got *. (Parameter 'element')");
.ThrowAsync<ArgumentException>();
exn.And.ParamName.Should().Be("element");
}

Expand Down

0 comments on commit e761833

Please sign in to comment.