Releases: bmazzarol/Bunsen-Burner
Releases · bmazzarol/Bunsen-Burner
Testable HttpClient!
This adds a solution for testing http client
using a http message store.
using HttpBuildR;
using static BunsenBurner.Http.HttpMessageMatchers;
using Req = System.Net.Http.HttpMethod;
using Resp = System.Net.HttpStatusCode;
var store = HttpMessageStore.New();
store.Setup(
// for a given named client
"PersonService",
// matchers can be used and composed to match incomming requests
HasMethod(HttpMethod.Put).And(HasJsonContent((Person p) => p.Age > 19))),
// response builder can be provided
req => Resp.OK.Result(request: req)
.WithJsonContent(new { LastUpdatedDate = DateTime.Now })
...
// now a store can be converted to a client, or passed to a DummyFactory
var client = store.CreateClient("PersonService");
// now call the client
var result = await client.SendAsync(Req.Put.To("some-endpoint")
.WithBearerToken(...)
.WithJsonContent(new Person(25)));
// the store records all requests and responses made against it
Assert.True(store.Any(m => m.ClientName == "PersonService"
&& m.Request.Method == HttpMethod.Put
&& m.Response.StatusCode == Resp.OK))
BREAKING CHANGES:
- Request has been replaced by the standard
HttpRequestMessage and uses HttpBuildR.Request for usability - Response has been replaced by the standard HttpResponseMessage
and uses HttpBuildR.Response for usability - This breaks how request responses are built and is also not 100% immutable
- However it allows for interop with low level request response semantics
- The Connect Http method is not supported on standard 2.0
- Converting to an Azure Request is now async, so requires awaiting
For an example of how to change your code base see the pr changes that introduced this. Essentually move over to using HttpBuildR instead of the old custom Request and Response types
What's Changed
- chore(deps): Bump JWT from 9.0.3 to 10.0.0 by @dependabot in #100
- chore(deps): Bump Meziantou.Analyzer from 2.0.3 to 2.0.4 by @dependabot in #99
- chore(deps): Bump Verify.Xunit from 19.5.0 to 19.6.0 by @dependabot in #102
- chore(deps): Bump Verify.NUnit from 19.5.0 to 19.6.0 by @dependabot in #101
- chore(deps): Bump Meziantou.Analyzer from 2.0.4 to 2.0.5 by @dependabot in #103
- feat(http,function-app): testable http client by @bmazzarol in #107
Full Changelog: 5.3.1...6.0.0
v5.3.1
What's Changed
- chore(deps): Bump Meziantou.Analyzer from 1.0.758 to 2.0.3 by @dependabot in #97
Full Changelog: 5.3.0...5.3.1
Dependency Injection Testing Support
What's Changed
- chore(deps): bump Microsoft.NET.Test.Sdk from 17.4.0 to 17.4.1 by @dependabot in #87
- chore(deps): bump Meziantou.Analyzer from 1.0.756 to 1.0.757 by @dependabot in #90
- chore(deps): bump Verify.Xunit from 19.3.0 to 19.5.0 by @dependabot in #91
- chore(deps): bump Verify.NUnit from 19.3.0 to 19.5.0 by @dependabot in #92
- chore(deps): bump Flurl from 3.0.6 to 3.0.7 by @dependabot in #93
- chore(deps): bump SonarAnalyzer.CSharp from 8.50.0.58025 to 8.51.0.59060 by @dependabot in #94
- chore(deps): bump BenchmarkDotNet from 0.13.2 to 0.13.3 by @dependabot in #95
- chore(deps): Bump Meziantou.Analyzer from 1.0.757 to 1.0.758 by @dependabot in #96
- feat(dependency-injection): adds support for testing dependency injec… by @bmazzarol in #98
Full Changelog: 5.2.0...5.3.0
Easier ways to build startup classes
What's Changed
- feat(background,function-app): added more methods for building startup by @bmazzarol in #86
Full Changelog: 5.1.0...5.2.0
Expose constructor function for converting HTTP response to a BB response
What's Changed
- fix: expose the constructor function from http resp to resp by @bmazzarol in #82
- chore(deps): bump WireMock.Net from 1.5.12 to 1.5.13 by @dependabot in #81
Full Changelog: 5.0.0...5.1.0
Improved logging
What's Changed
- feat(logging,http,background): improved logging by @bmazzarol in #80
Full Changelog: 4.0.1...5.0.0
Fix issues with test server and override services
Full Changelog: 4.0.0...4.0.1
Non-cached use cases for builders
What's Changed
- feat(http,function-app,background): cater for non-cached use cases by @bmazzarol in #79
Full Changelog: 3.0.0...4.0.0
Improve http ergonomics
What's Changed
- feat(http): improve http ergonomics by @bmazzarol in #78
Full Changelog: 2.2.0...3.0.0
Allow scenarios to be redefined
What's Changed
- feat(core): ability to redefine/reset scenarios by @bmazzarol in #77
Full Changelog: 2.1.0...2.2.0