kekekeks / CoreRPC

Extensible RPC library with Typescript client generator
MIT License
82 stars 17 forks source link

feature: CoreRPC.Testing #17

Closed worldbeater closed 2 years ago

worldbeater commented 2 years ago

Resurrects https://github.com/kekekeks/CoreRPC/pull/14

public sealed class SecureRpcList : RpcListBase
{
    public SecureRpcList(string uri) : base(uri, new Dictionary<string, string> {["X-Auth"] = "foobar"}) { }

    public IRpcExec<SecureComputeRpc> Compute => Get<SecureComputeRpc>();
}

var secure = new SecureRpcList(address);
secure.Compute.Call(api => api.Sum(2, 2)).Should().Be(4);
secure.Compute.Call(api => api.Multiply(2, 2)).Should().Be(4);