public void UpdateKeyRequestObject() { moq::Mock <RecaptchaEnterpriseService.RecaptchaEnterpriseServiceClient> mockGrpcClient = new moq::Mock <RecaptchaEnterpriseService.RecaptchaEnterpriseServiceClient>(moq::MockBehavior.Strict); UpdateKeyRequest request = new UpdateKeyRequest { Key = new Key(), UpdateMask = new wkt::FieldMask(), }; Key expectedResponse = new Key { KeyName = KeyName.FromProjectKey("[PROJECT]", "[KEY]"), DisplayName = "display_name137f65c2", WebSettings = new WebKeySettings(), AndroidSettings = new AndroidKeySettings(), IosSettings = new IOSKeySettings(), Labels = { { "key8a0b6e3c", "value60c16320" }, }, CreateTime = new wkt::Timestamp(), }; mockGrpcClient.Setup(x => x.UpdateKey(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); RecaptchaEnterpriseServiceClient client = new RecaptchaEnterpriseServiceClientImpl(mockGrpcClient.Object, null); Key response = client.UpdateKey(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task UpdateKeyRequestObjectAsync() { moq::Mock <RecaptchaEnterpriseService.RecaptchaEnterpriseServiceClient> mockGrpcClient = new moq::Mock <RecaptchaEnterpriseService.RecaptchaEnterpriseServiceClient>(moq::MockBehavior.Strict); UpdateKeyRequest request = new UpdateKeyRequest { Key = new Key(), UpdateMask = new wkt::FieldMask(), }; Key expectedResponse = new Key { KeyName = KeyName.FromProjectKey("[PROJECT]", "[KEY]"), DisplayName = "display_name137f65c2", WebSettings = new WebKeySettings(), AndroidSettings = new AndroidKeySettings(), IosSettings = new IOSKeySettings(), Labels = { { "key8a0b6e3c", "value60c16320" }, }, CreateTime = new wkt::Timestamp(), }; mockGrpcClient.Setup(x => x.UpdateKeyAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Key>(stt::Task.FromResult(expectedResponse), null, null, null, null)); RecaptchaEnterpriseServiceClient client = new RecaptchaEnterpriseServiceClientImpl(mockGrpcClient.Object, null); Key responseCallSettings = await client.UpdateKeyAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Key responseCancellationToken = await client.UpdateKeyAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async stt::Task GetKeyRequestObjectAsync() { moq::Mock <RecaptchaEnterpriseServiceV1Beta1.RecaptchaEnterpriseServiceV1Beta1Client> mockGrpcClient = new moq::Mock <RecaptchaEnterpriseServiceV1Beta1.RecaptchaEnterpriseServiceV1Beta1Client>(moq::MockBehavior.Strict); GetKeyRequest request = new GetKeyRequest { KeyName = KeyName.FromProjectKey("[PROJECT]", "[KEY]"), }; Key expectedResponse = new Key { KeyName = KeyName.FromProjectKey("[PROJECT]", "[KEY]"), DisplayName = "display_name137f65c2", WebSettings = new WebKeySettings(), AndroidSettings = new AndroidKeySettings(), IosSettings = new IOSKeySettings(), }; mockGrpcClient.Setup(x => x.GetKeyAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Key>(stt::Task.FromResult(expectedResponse), null, null, null, null)); RecaptchaEnterpriseServiceV1Beta1Client client = new RecaptchaEnterpriseServiceV1Beta1ClientImpl(mockGrpcClient.Object, null); Key responseCallSettings = await client.GetKeyAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Key responseCancellationToken = await client.GetKeyAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for GetKey</summary> public void GetKeyRequestObject() { // Snippet: GetKey(GetKeyRequest, CallSettings) // Create client RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = RecaptchaEnterpriseServiceClient.Create(); // Initialize request argument(s) GetKeyRequest request = new GetKeyRequest { KeyName = KeyName.FromProjectKey("[PROJECT]", "[KEY]"), }; // Make the request Key response = recaptchaEnterpriseServiceClient.GetKey(request); // End snippet }
/// <summary>Snippet for DeleteKey</summary> public void DeleteKeyRequestObject() { // Snippet: DeleteKey(DeleteKeyRequest, CallSettings) // Create client RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = RecaptchaEnterpriseServiceV1Beta1Client.Create(); // Initialize request argument(s) DeleteKeyRequest request = new DeleteKeyRequest { KeyName = KeyName.FromProjectKey("[PROJECT]", "[KEY]"), }; // Make the request recaptchaEnterpriseServiceV1Beta1Client.DeleteKey(request); // End snippet }
public void DeleteKeyRequestObject() { moq::Mock <RecaptchaEnterpriseService.RecaptchaEnterpriseServiceClient> mockGrpcClient = new moq::Mock <RecaptchaEnterpriseService.RecaptchaEnterpriseServiceClient>(moq::MockBehavior.Strict); DeleteKeyRequest request = new DeleteKeyRequest { KeyName = KeyName.FromProjectKey("[PROJECT]", "[KEY]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.DeleteKey(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); RecaptchaEnterpriseServiceClient client = new RecaptchaEnterpriseServiceClientImpl(mockGrpcClient.Object, null); client.DeleteKey(request); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for DeleteKeyAsync</summary> public async Task DeleteKeyRequestObjectAsync() { // Snippet: DeleteKeyAsync(DeleteKeyRequest, CallSettings) // Additional: DeleteKeyAsync(DeleteKeyRequest, CancellationToken) // Create client RecaptchaEnterpriseServiceClient recaptchaEnterpriseServiceClient = await RecaptchaEnterpriseServiceClient.CreateAsync(); // Initialize request argument(s) DeleteKeyRequest request = new DeleteKeyRequest { KeyName = KeyName.FromProjectKey("[PROJECT]", "[KEY]"), }; // Make the request await recaptchaEnterpriseServiceClient.DeleteKeyAsync(request); // End snippet }
public async stt::Task DeleteKeyRequestObjectAsync() { moq::Mock <RecaptchaEnterpriseService.RecaptchaEnterpriseServiceClient> mockGrpcClient = new moq::Mock <RecaptchaEnterpriseService.RecaptchaEnterpriseServiceClient>(moq::MockBehavior.Strict); DeleteKeyRequest request = new DeleteKeyRequest { KeyName = KeyName.FromProjectKey("[PROJECT]", "[KEY]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.DeleteKeyAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null)); RecaptchaEnterpriseServiceClient client = new RecaptchaEnterpriseServiceClientImpl(mockGrpcClient.Object, null); await client.DeleteKeyAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); await client.DeleteKeyAsync(request, st::CancellationToken.None); mockGrpcClient.VerifyAll(); }
public void GetKeyRequestObject() { moq::Mock <RecaptchaEnterpriseServiceV1Beta1.RecaptchaEnterpriseServiceV1Beta1Client> mockGrpcClient = new moq::Mock <RecaptchaEnterpriseServiceV1Beta1.RecaptchaEnterpriseServiceV1Beta1Client>(moq::MockBehavior.Strict); GetKeyRequest request = new GetKeyRequest { KeyName = KeyName.FromProjectKey("[PROJECT]", "[KEY]"), }; Key expectedResponse = new Key { KeyName = KeyName.FromProjectKey("[PROJECT]", "[KEY]"), DisplayName = "display_name137f65c2", WebSettings = new WebKeySettings(), AndroidSettings = new AndroidKeySettings(), IosSettings = new IOSKeySettings(), }; mockGrpcClient.Setup(x => x.GetKey(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); RecaptchaEnterpriseServiceV1Beta1Client client = new RecaptchaEnterpriseServiceV1Beta1ClientImpl(mockGrpcClient.Object, null); Key response = client.GetKey(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }