public async stt::Task ListRequestObjectAsync() { moq::Mock <LicenseNotificationService.LicenseNotificationServiceClient> mockGrpcClient = new moq::Mock <LicenseNotificationService.LicenseNotificationServiceClient>(moq::MockBehavior.Strict); LicenseNotificationListRequest request = new LicenseNotificationListRequest { ApplicationId = "application_ideba4c06b", MaxResults = 2806814450U, StartToken = "start_token4a4e5304", Timestamp = 4440964450091394775UL, }; LicenseNotificationList expectedResponse = new LicenseNotificationList { Kind = "kindf7aa39d9", Notifications = { new LicenseNotification(), }, NextPageToken = "next_page_tokendbee0940", }; mockGrpcClient.Setup(x => x.ListAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <LicenseNotificationList>(stt::Task.FromResult(expectedResponse), null, null, null, null)); LicenseNotificationServiceClient client = new LicenseNotificationServiceClientImpl(mockGrpcClient.Object, null); LicenseNotificationList responseCallSettings = await client.ListAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); LicenseNotificationList responseCancellationToken = await client.ListAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void ListRequestObject() { moq::Mock <LicenseNotificationService.LicenseNotificationServiceClient> mockGrpcClient = new moq::Mock <LicenseNotificationService.LicenseNotificationServiceClient>(moq::MockBehavior.Strict); LicenseNotificationListRequest request = new LicenseNotificationListRequest { ApplicationId = "application_ideba4c06b", MaxResults = 2806814450U, StartToken = "start_token4a4e5304", Timestamp = 4440964450091394775UL, }; LicenseNotificationList expectedResponse = new LicenseNotificationList { Kind = "kindf7aa39d9", Notifications = { new LicenseNotification(), }, NextPageToken = "next_page_tokendbee0940", }; mockGrpcClient.Setup(x => x.List(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); LicenseNotificationServiceClient client = new LicenseNotificationServiceClientImpl(mockGrpcClient.Object, null); LicenseNotificationList response = client.List(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for List</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void ListRequestObject() { // Create client LicenseNotificationServiceClient licenseNotificationServiceClient = LicenseNotificationServiceClient.Create(); // Initialize request argument(s) LicenseNotificationListRequest request = new LicenseNotificationListRequest { ApplicationId = "", MaxResults = 0U, StartToken = "", Timestamp = 0UL, }; // Make the request LicenseNotificationList response = licenseNotificationServiceClient.List(request); }