mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 22:30:41 +01:00
Allow to create MappingModel from c# to be able to configure local and remote mocks similarly #391
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @antero-lukkonen on GitHub (Dec 20, 2021).
Is your feature request related to a problem? Please describe.
I am proposing an API extension, where i could use the fluent syntax of defining Mappings, so that i can work with within unit-test and remote server mocks the same way. I would define the mappings with fluent syntax and could share them.
Describe the solution you'd like
See additional context for rough examples.
Describe alternatives you've considered
Right now it is possible to achieve the same with interfaces that accept MappingModel, so this would be a convenience feature only.
Is your feature request supported by WireMock (java version)? Please provide details.
It seems to me to be an interface concern only.
Additional context
Maybe the below code will help understanding what i am after. That i could achieve the same result with both approaches.
@StefH commented on GitHub (Dec 25, 2021):
@antero-lukkonen
Do you mean code like this?
https://github.com/WireMock-Net/WireMock.Net/blob/master/src/WireMock.Net/Serialization/MappingConverter.cs
@StefH commented on GitHub (Feb 6, 2022):
@antero-lukkonen
is this what you mean?
@antero-lukkonen commented on GitHub (Feb 7, 2022):
I am so sorry for disappearing.
Yes indeed something like this. I found this in the codebase but it is internal.
Because i had been using WireMock previously in unit-testing context and had a use-case where i wanted it to run as a stand-alone server, i naturally started to describe my mock responses in the fluent syntax and then found that there is no way to configure a remote server using admin api in such way.
The fluent syntax goes well with other popular mocking tools like moq and other frameworks we use in asp.net so it is a common paradigm, whereas the Rest model based specification, while it certainly works, is a bit awkward and does not allow reuse if you want to share these setups between local and remotes.
@StefH commented on GitHub (Dec 22, 2022):
@antero-lukkonen I think this is the same request as https://github.com/WireMock-Net/WireMock.Net/issues/867 ?
@StefH commented on GitHub (Jan 7, 2023):
https://github.com/WireMock-Net/WireMock.Net/pull/869