public void CreateAlertFeedbackRequestObject() { moq::Mock <AlertCenterService.AlertCenterServiceClient> mockGrpcClient = new moq::Mock <AlertCenterService.AlertCenterServiceClient>(moq::MockBehavior.Strict); CreateAlertFeedbackRequest request = new CreateAlertFeedbackRequest { CustomerId = "customer_id3b3724cb", AlertId = "alert_idc6c58cd5", Feedback = new AlertFeedback(), }; AlertFeedback expectedResponse = new AlertFeedback { CustomerId = "customer_id3b3724cb", AlertId = "alert_idc6c58cd5", FeedbackId = "feedback_idc9a08801", CreateTime = new wkt::Timestamp(), Type = AlertFeedbackType.VeryUseful, Email = "email7cf5830c", }; mockGrpcClient.Setup(x => x.CreateAlertFeedback(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AlertCenterServiceClient client = new AlertCenterServiceClientImpl(mockGrpcClient.Object, null); AlertFeedback response = client.CreateAlertFeedback(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task CreateAlertFeedbackRequestObjectAsync() { moq::Mock <AlertCenterService.AlertCenterServiceClient> mockGrpcClient = new moq::Mock <AlertCenterService.AlertCenterServiceClient>(moq::MockBehavior.Strict); CreateAlertFeedbackRequest request = new CreateAlertFeedbackRequest { CustomerId = "customer_id3b3724cb", AlertId = "alert_idc6c58cd5", Feedback = new AlertFeedback(), }; AlertFeedback expectedResponse = new AlertFeedback { CustomerId = "customer_id3b3724cb", AlertId = "alert_idc6c58cd5", FeedbackId = "feedback_idc9a08801", CreateTime = new wkt::Timestamp(), Type = AlertFeedbackType.VeryUseful, Email = "email7cf5830c", }; mockGrpcClient.Setup(x => x.CreateAlertFeedbackAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <AlertFeedback>(stt::Task.FromResult(expectedResponse), null, null, null, null)); AlertCenterServiceClient client = new AlertCenterServiceClientImpl(mockGrpcClient.Object, null); AlertFeedback responseCallSettings = await client.CreateAlertFeedbackAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); AlertFeedback responseCancellationToken = await client.CreateAlertFeedbackAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for CreateAlertFeedback</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void CreateAlertFeedbackRequestObject() { // Create client AlertCenterServiceClient alertCenterServiceClient = AlertCenterServiceClient.Create(); // Initialize request argument(s) CreateAlertFeedbackRequest request = new CreateAlertFeedbackRequest { CustomerId = "", AlertId = "", Feedback = new AlertFeedback(), }; // Make the request AlertFeedback response = alertCenterServiceClient.CreateAlertFeedback(request); }
/// <summary>Snippet for CreateAlertFeedbackAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task CreateAlertFeedbackRequestObjectAsync() { // Create client AlertCenterServiceClient alertCenterServiceClient = await AlertCenterServiceClient.CreateAsync(); // Initialize request argument(s) CreateAlertFeedbackRequest request = new CreateAlertFeedbackRequest { CustomerId = "", AlertId = "", Feedback = new AlertFeedback(), }; // Make the request AlertFeedback response = await alertCenterServiceClient.CreateAlertFeedbackAsync(request); }
/// <summary>Snippet for CreateAlertFeedbackAsync</summary> public async Task CreateAlertFeedbackRequestObjectAsync() { // Snippet: CreateAlertFeedbackAsync(CreateAlertFeedbackRequest, CallSettings) // Additional: CreateAlertFeedbackAsync(CreateAlertFeedbackRequest, CancellationToken) // Create client AlertCenterServiceClient alertCenterServiceClient = await AlertCenterServiceClient.CreateAsync(); // Initialize request argument(s) CreateAlertFeedbackRequest request = new CreateAlertFeedbackRequest { CustomerId = "", AlertId = "", Feedback = new AlertFeedback(), }; // Make the request AlertFeedback response = await alertCenterServiceClient.CreateAlertFeedbackAsync(request); // End snippet }