1

我们将 Refit 用于我们的 API 声明,并希望使用接口继承。此处显示了一个示例:https ://github.com/reactiveui/refit#interface-inheritance

public interface IPlatformRestClient
{
    HttpClient Client { get; }

    [Get("/version")]
    Task<string> GetVersion();
}

public interface ITestRestClient : IPlatformRestClient
{
    [Get("/test")]
    Task<string> Test();
}

我可能是盲人并且做错了什么,但构造会导致以下错误消息

“AutoGeneratedITestRestClient”未实现接口成员“IPlatformRestClient.GetVersion()”Platform.RestClient.UnitTests

如果我打开存根:

/// <inheritdoc />
[global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[global::System.Diagnostics.DebuggerNonUserCode]
[Preserve]
[global::System.Reflection.Obfuscation(Exclude=true)]
partial class AutoGeneratedITestRestClient : ITestRestClient
{
    /// <inheritdoc />
    public HttpClient Client { get; protected set; }
    readonly IRequestBuilder requestBuilder;

    /// <inheritdoc />
    public AutoGeneratedITestRestClient(HttpClient client, IRequestBuilder requestBuilder)
    {
        Client = client;
        this.requestBuilder = requestBuilder;
    }

    /// <inheritdoc />
    Task<string> ITestRestClient.Test()
    {
        var arguments = new object[] {  };
        var func = requestBuilder.BuildRestResultFuncForMethod("Test", new Type[] {  });
        return (Task<string>)func(Client, arguments);
    }
}

那么这个功能是坏了还是我有任何错误?

4

0 回答 0