public async stt::Task ValidateExclusivityRequestObjectAsync() { moq::Mock <GkeHubMembershipService.GkeHubMembershipServiceClient> mockGrpcClient = new moq::Mock <GkeHubMembershipService.GkeHubMembershipServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); ValidateExclusivityRequest request = new ValidateExclusivityRequest { Parent = "parent7858e4d0", CrManifest = "cr_manifestdf1378ad", IntendedMembership = "intended_membership4a00bbcb", }; ValidateExclusivityResponse expectedResponse = new ValidateExclusivityResponse { Status = new gr::Status(), }; mockGrpcClient.Setup(x => x.ValidateExclusivityAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <ValidateExclusivityResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); GkeHubMembershipServiceClient client = new GkeHubMembershipServiceClientImpl(mockGrpcClient.Object, null); ValidateExclusivityResponse responseCallSettings = await client.ValidateExclusivityAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); ValidateExclusivityResponse responseCancellationToken = await client.ValidateExclusivityAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for ValidateExclusivity</summary> public void ValidateExclusivityRequestObject() { // Snippet: ValidateExclusivity(ValidateExclusivityRequest, CallSettings) // Create client GkeHubMembershipServiceClient gkeHubMembershipServiceClient = GkeHubMembershipServiceClient.Create(); // Initialize request argument(s) ValidateExclusivityRequest request = new ValidateExclusivityRequest { Parent = "", CrManifest = "", IntendedMembership = "", }; // Make the request ValidateExclusivityResponse response = gkeHubMembershipServiceClient.ValidateExclusivity(request); // End snippet }
/// <summary>Snippet for ValidateExclusivityAsync</summary> public async Task ValidateExclusivityRequestObjectAsync() { // Snippet: ValidateExclusivityAsync(ValidateExclusivityRequest, CallSettings) // Additional: ValidateExclusivityAsync(ValidateExclusivityRequest, CancellationToken) // Create client GkeHubMembershipServiceClient gkeHubMembershipServiceClient = await GkeHubMembershipServiceClient.CreateAsync(); // Initialize request argument(s) ValidateExclusivityRequest request = new ValidateExclusivityRequest { Parent = "", CrManifest = "", IntendedMembership = "", }; // Make the request ValidateExclusivityResponse response = await gkeHubMembershipServiceClient.ValidateExclusivityAsync(request); // End snippet }
public void ValidateExclusivityRequestObject() { moq::Mock <GkeHubMembershipService.GkeHubMembershipServiceClient> mockGrpcClient = new moq::Mock <GkeHubMembershipService.GkeHubMembershipServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); ValidateExclusivityRequest request = new ValidateExclusivityRequest { Parent = "parent7858e4d0", CrManifest = "cr_manifestdf1378ad", IntendedMembership = "intended_membership4a00bbcb", }; ValidateExclusivityResponse expectedResponse = new ValidateExclusivityResponse { Status = new gr::Status(), }; mockGrpcClient.Setup(x => x.ValidateExclusivity(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); GkeHubMembershipServiceClient client = new GkeHubMembershipServiceClientImpl(mockGrpcClient.Object, null); ValidateExclusivityResponse response = client.ValidateExclusivity(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }