/// <summary>Snippet for RegisterDebuggee</summary> public void RegisterDebuggee_RequestObject() { // Snippet: RegisterDebuggee(RegisterDebuggeeRequest, CallSettings) // Create client Controller2Client controller2Client = Controller2Client.Create(); // Initialize request argument(s) RegisterDebuggeeRequest request = new RegisterDebuggeeRequest { Debuggee = new Debuggee(), }; // Make the request RegisterDebuggeeResponse response = controller2Client.RegisterDebuggee(request); // End snippet }
/// <summary>Snippet for RegisterDebuggeeAsync</summary> public async Task RegisterDebuggeeAsync_RequestObject() { // Snippet: RegisterDebuggeeAsync(RegisterDebuggeeRequest, CallSettings) // Additional: RegisterDebuggeeAsync(RegisterDebuggeeRequest, CancellationToken) // Create client Controller2Client controller2Client = await Controller2Client.CreateAsync(); // Initialize request argument(s) RegisterDebuggeeRequest request = new RegisterDebuggeeRequest { Debuggee = new Debuggee(), }; // Make the request RegisterDebuggeeResponse response = await controller2Client.RegisterDebuggeeAsync(request); // End snippet }
public async Task RegisterDebuggeeAsync2() { Mock <Controller2.Controller2Client> mockGrpcClient = new Mock <Controller2.Controller2Client>(MockBehavior.Strict); RegisterDebuggeeRequest request = new RegisterDebuggeeRequest { Debuggee = new Debuggee(), }; RegisterDebuggeeResponse expectedResponse = new RegisterDebuggeeResponse(); mockGrpcClient.Setup(x => x.RegisterDebuggeeAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <RegisterDebuggeeResponse>(Task.FromResult(expectedResponse), null, null, null, null)); Controller2Client client = new Controller2ClientImpl(mockGrpcClient.Object, null); RegisterDebuggeeResponse response = await client.RegisterDebuggeeAsync(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void RegisterDebuggee2() { Mock <Controller2.Controller2Client> mockGrpcClient = new Mock <Controller2.Controller2Client>(MockBehavior.Strict); RegisterDebuggeeRequest request = new RegisterDebuggeeRequest { Debuggee = new Debuggee(), }; RegisterDebuggeeResponse expectedResponse = new RegisterDebuggeeResponse(); mockGrpcClient.Setup(x => x.RegisterDebuggee(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); Controller2Client client = new Controller2ClientImpl(mockGrpcClient.Object, null); RegisterDebuggeeResponse response = client.RegisterDebuggee(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void RegisterDebuggee() { moq::Mock <Controller2.Controller2Client> mockGrpcClient = new moq::Mock <Controller2.Controller2Client>(moq::MockBehavior.Strict); RegisterDebuggeeRequest request = new RegisterDebuggeeRequest { Debuggee = new Debuggee(), }; RegisterDebuggeeResponse expectedResponse = new RegisterDebuggeeResponse { Debuggee = new Debuggee(), }; mockGrpcClient.Setup(x => x.RegisterDebuggee(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); Controller2Client client = new Controller2ClientImpl(mockGrpcClient.Object, null); RegisterDebuggeeResponse response = client.RegisterDebuggee(request.Debuggee); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task RegisterDebuggeeAsync() { moq::Mock <Controller2.Controller2Client> mockGrpcClient = new moq::Mock <Controller2.Controller2Client>(moq::MockBehavior.Strict); RegisterDebuggeeRequest request = new RegisterDebuggeeRequest { Debuggee = new Debuggee(), }; RegisterDebuggeeResponse expectedResponse = new RegisterDebuggeeResponse { Debuggee = new Debuggee(), }; mockGrpcClient.Setup(x => x.RegisterDebuggeeAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <RegisterDebuggeeResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); Controller2Client client = new Controller2ClientImpl(mockGrpcClient.Object, null); RegisterDebuggeeResponse responseCallSettings = await client.RegisterDebuggeeAsync(request.Debuggee, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); RegisterDebuggeeResponse responseCancellationToken = await client.RegisterDebuggeeAsync(request.Debuggee, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }