/// <summary>Snippet for Get</summary> public void GetRequestObject() { // Snippet: Get(GetSslPolicyRequest, CallSettings) // Create client SslPoliciesClient sslPoliciesClient = SslPoliciesClient.Create(); // Initialize request argument(s) GetSslPolicyRequest request = new GetSslPolicyRequest { Project = "", SslPolicy = "", }; // Make the request SslPolicy response = sslPoliciesClient.Get(request); // End snippet }
/// <summary>Snippet for GetAsync</summary> public async Task GetRequestObjectAsync() { // Snippet: GetAsync(GetSslPolicyRequest, CallSettings) // Additional: GetAsync(GetSslPolicyRequest, CancellationToken) // Create client SslPoliciesClient sslPoliciesClient = await SslPoliciesClient.CreateAsync(); // Initialize request argument(s) GetSslPolicyRequest request = new GetSslPolicyRequest { Project = "", SslPolicy = "", }; // Make the request SslPolicy response = await sslPoliciesClient.GetAsync(request); // End snippet }
public async stt::Task GetRequestObjectAsync() { moq::Mock <SslPolicies.SslPoliciesClient> mockGrpcClient = new moq::Mock <SslPolicies.SslPoliciesClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClientForGlobalOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetSslPolicyRequest request = new GetSslPolicyRequest { Project = "projectaa6ff846", SslPolicy = "ssl_policybf005a65", }; SslPolicy expectedResponse = new SslPolicy { Id = 11672635353343658936UL, Kind = "kindf7aa39d9", Name = "name1c9368b0", MinTlsVersion = "min_tls_versionf843e251", CreationTimestamp = "creation_timestamp235e59a1", CustomFeatures = { "custom_features19916d63", }, Profile = "profile1b48977d", Fingerprint = "fingerprint009e6052", Description = "description2cf9da67", SelfLink = "self_link7e87f12d", EnabledFeatures = { "enabled_featuresf1f398e0", }, Warnings = { new Warnings(), }, }; mockGrpcClient.Setup(x => x.GetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <SslPolicy>(stt::Task.FromResult(expectedResponse), null, null, null, null)); SslPoliciesClient client = new SslPoliciesClientImpl(mockGrpcClient.Object, null); SslPolicy responseCallSettings = await client.GetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); SslPolicy responseCancellationToken = await client.GetAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void GetRequestObject() { moq::Mock <SslPolicies.SslPoliciesClient> mockGrpcClient = new moq::Mock <SslPolicies.SslPoliciesClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClientForGlobalOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetSslPolicyRequest request = new GetSslPolicyRequest { Project = "projectaa6ff846", SslPolicy = "ssl_policybf005a65", }; SslPolicy expectedResponse = new SslPolicy { Id = 11672635353343658936UL, Kind = "kindf7aa39d9", Name = "name1c9368b0", MinTlsVersion = SslPolicy.Types.MinTlsVersion.Tls12, CreationTimestamp = "creation_timestamp235e59a1", CustomFeatures = { "custom_features19916d63", }, Profile = SslPolicy.Types.Profile.UndefinedProfile, Fingerprint = "fingerprint009e6052", Description = "description2cf9da67", SelfLink = "self_link7e87f12d", EnabledFeatures = { "enabled_featuresf1f398e0", }, Warnings = { new Warnings(), }, }; mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); SslPoliciesClient client = new SslPoliciesClientImpl(mockGrpcClient.Object, null); SslPolicy response = client.Get(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }