Skip to content

Commit

Permalink
Check for disposal on base request
Browse files Browse the repository at this point in the history
  • Loading branch information
nozzlegear committed Jan 29, 2024
1 parent 03a5e94 commit e2ea325
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ public void Clone_ShouldCloneMultipleTimesWithoutDisposalExceptions()
{
Headers = { {"some-key-1", "some-value-1"} }
};
var baseRequest = new CloneableRequestMessage(Host, Method, jsonContent);
var baseRequest = new TestCloneableRequestMessage(Host, Method, jsonContent);

// Act
var act = () =>
{
for (var i = 0; i < 5; i++)
Expand All @@ -115,7 +116,9 @@ public void Clone_ShouldCloneMultipleTimesWithoutDisposalExceptions()
}
};

// Assert
act.Should().NotThrow();
baseRequest.Disposed.Should().BeFalse();
}

#region CloneAsync
Expand Down Expand Up @@ -342,7 +345,7 @@ public async Task CloneAsync_ShouldCloneMultipleTimesWithoutDisposalExceptions()
{ "Content-Type", "fake/stream" }
}
};
var baseRequest = new CloneableRequestMessage(Host, Method, streamContent);
var baseRequest = new TestCloneableRequestMessage(Host, Method, streamContent);
baseRequest.Headers.Add("some-key-2", "some-value-2");

// Act
Expand All @@ -369,6 +372,7 @@ public async Task CloneAsync_ShouldCloneMultipleTimesWithoutDisposalExceptions()
};

await act.Should().NotThrowAsync();
baseRequest.Disposed.Should().BeFalse();
}

#endregion
Expand Down

0 comments on commit e2ea325

Please sign in to comment.