public void ListInvoices() { moq::Mock <InvoiceService.InvoiceServiceClient> mockGrpcClient = new moq::Mock <InvoiceService.InvoiceServiceClient>(moq::MockBehavior.Strict); ListInvoicesRequest request = new ListInvoicesRequest { CustomerId = "customer_id3b3724cb", BillingSetup = "billing_setupa2c2701f", IssueYear = "issue_yeara1ebdef1", IssueMonth = gagve::MonthOfYearEnum.Types.MonthOfYear.January, }; ListInvoicesResponse expectedResponse = new ListInvoicesResponse { Invoices = { new gagvr::Invoice(), }, }; mockGrpcClient.Setup(x => x.ListInvoices(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); InvoiceServiceClient client = new InvoiceServiceClientImpl(mockGrpcClient.Object, null); ListInvoicesResponse response = client.ListInvoices(request.CustomerId, request.BillingSetup, request.IssueYear, request.IssueMonth); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void ListInvoices() { Mock <InvoiceService.InvoiceServiceClient> mockGrpcClient = new Mock <InvoiceService.InvoiceServiceClient>(MockBehavior.Strict); ListInvoicesRequest expectedRequest = new ListInvoicesRequest { CustomerId = "customerId-1772061412", BillingSetup = "billingSetup-1181632583", IssueYear = "issueYear1443510243", IssueMonth = MonthOfYearEnum.Types.MonthOfYear.Unspecified, }; ListInvoicesResponse expectedResponse = new ListInvoicesResponse(); mockGrpcClient.Setup(x => x.ListInvoices(expectedRequest, It.IsAny <CallOptions>())) .Returns(expectedResponse); InvoiceServiceClient client = new InvoiceServiceClientImpl(mockGrpcClient.Object, null); string customerId = "customerId-1772061412"; string billingSetup = "billingSetup-1181632583"; string issueYear = "issueYear1443510243"; MonthOfYearEnum.Types.MonthOfYear issueMonth = MonthOfYearEnum.Types.MonthOfYear.Unspecified; ListInvoicesResponse response = client.ListInvoices(customerId, billingSetup, issueYear, issueMonth); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }