public async Task CompleteOAuthFlowTest() { // setup var mockHttp = GetMockHttpMessageHandler(); Server server = new Server { Services = { Publisher.BindService(new PluginSalesforce.Plugin.Plugin(mockHttp.ToHttpClient())) }, Ports = { new ServerPort("localhost", 0, ServerCredentials.Insecure) } }; server.Start(); var port = server.Ports.First().BoundPort; var channel = new Channel($"localhost:{port}", ChannelCredentials.Insecure); var client = new Publisher.PublisherClient(channel); var completeRequest = new CompleteOAuthFlowRequest { Configuration = new OAuthConfiguration { ClientId = "client", ClientSecret = "secret", ConfigurationJson = "{}" }, RedirectUrl = "http://test.com?code=authcode", RedirectBody = "" }; // act var response = client.CompleteOAuthFlow(completeRequest); // assert Assert.IsType <CompleteOAuthFlowResponse>(response); Assert.Contains("mocktoken", response.OauthStateJson); Assert.Contains("mocktoken", response.OauthStateJson); // cleanup await channel.ShutdownAsync(); await server.ShutdownAsync(); }