diff --git a/Refit.Tests/RestService.cs b/Refit.Tests/RestService.cs index 1b94c915e..cf940c7ad 100644 --- a/Refit.Tests/RestService.cs +++ b/Refit.Tests/RestService.cs @@ -501,6 +501,37 @@ await fixture.GetFooBarsDerived( mockHttp.VerifyNoOutstandingExpectation(); } + [Fact] + public async Task GetWithDerivedObjectAsBaseType() + { + // possibly a bug see https://github.com/reactiveui/refit/issues/1882 + var mockHttp = new MockHttpMessageHandler(); + mockHttp + .Expect(HttpMethod.Get, "http://foo/foos/1/bar") + .WithExactQueryString( + new[] + { + new KeyValuePair("SomeProperty3", "test"), + new KeyValuePair("SomeProperty2", "barNone"), + new KeyValuePair("SomeProperty", "1") + } + ) + .Respond("application/json", "Ok"); + + var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp }; + var fixture = RestService.For("http://foo", settings); + + await fixture.GetBarsByFoo( + new PathBoundDerivedObject() + { + SomeProperty = 1, + SomeProperty2 = "barNone", + SomeProperty3 = "test" + } + ); + mockHttp.VerifyNoOutstandingExpectation(); + } + [Fact] public async Task GetWithPathBoundObjectAndQueryParameter() {