예제 #1
0
        public void ListRequestObject()
        {
            moq::Mock <Licenses.LicensesClient> mockGrpcClient = new moq::Mock <Licenses.LicensesClient>(moq::MockBehavior.Strict);
            ListLicensesRequest request = new ListLicensesRequest
            {
                PageToken            = "page_tokenf09e5538",
                MaxResults           = 2806814450U,
                OrderBy              = "order_byb4d33ada",
                Project              = "projectaa6ff846",
                Filter               = "filtere47ac9b2",
                ReturnPartialSuccess = false,
            };
            LicensesListResponse expectedResponse = new LicensesListResponse
            {
                Id            = "id74b70bb8",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         = { new License(), },
                SelfLink      = "self_link7e87f12d",
            };

            mockGrpcClient.Setup(x => x.List(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            LicensesClient       client   = new LicensesClientImpl(mockGrpcClient.Object, null);
            LicensesListResponse response = client.List(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
예제 #2
0
        public void List()
        {
            moq::Mock <Licenses.LicensesClient> mockGrpcClient = new moq::Mock <Licenses.LicensesClient>(moq::MockBehavior.Strict);
            ListLicensesRequest request = new ListLicensesRequest
            {
                Project = "projectaa6ff846",
            };
            LicensesListResponse expectedResponse = new LicensesListResponse
            {
                Id            = "id74b70bb8",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         = { new License(), },
                SelfLink      = "self_link7e87f12d",
            };

            mockGrpcClient.Setup(x => x.List(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            LicensesClient       client   = new LicensesClientImpl(mockGrpcClient.Object, null);
            LicensesListResponse response = client.List(request.Project);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }