Ejemplo n.º 1
0
        public void AggregatedList()
        {
            moq::Mock <MachineTypes.MachineTypesClient> mockGrpcClient = new moq::Mock <MachineTypes.MachineTypesClient>(moq::MockBehavior.Strict);
            AggregatedListMachineTypesRequest           request        = new AggregatedListMachineTypesRequest
            {
                Project = "projectaa6ff846",
            };
            MachineTypeAggregatedList expectedResponse = new MachineTypeAggregatedList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         =
                {
                    {
                        "key8a0b6e3c",
                        new MachineTypesScopedList()
                    },
                },
                SelfLink     = "self_link7e87f12d",
                Unreachables =
                {
                    "unreachables3ca950ee",
                },
            };

            mockGrpcClient.Setup(x => x.AggregatedList(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            MachineTypesClient        client   = new MachineTypesClientImpl(mockGrpcClient.Object, null);
            MachineTypeAggregatedList response = client.AggregatedList(request.Project);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 2
0
        public void AggregatedListRequestObject()
        {
            moq::Mock <MachineTypes.MachineTypesClient> mockGrpcClient = new moq::Mock <MachineTypes.MachineTypesClient>(moq::MockBehavior.Strict);
            AggregatedListMachineTypesRequest           request        = new AggregatedListMachineTypesRequest
            {
                PageToken            = "page_tokenf09e5538",
                MaxResults           = 2806814450U,
                Filter               = "filtere47ac9b2",
                IncludeAllScopes     = false,
                OrderBy              = "order_byb4d33ada",
                Project              = "projectaa6ff846",
                ReturnPartialSuccess = false,
            };
            MachineTypeAggregatedList expectedResponse = new MachineTypeAggregatedList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         =
                {
                    {
                        "key8a0b6e3c",
                        new MachineTypesScopedList()
                    },
                },
                SelfLink     = "self_link7e87f12d",
                Unreachables =
                {
                    "unreachables3ca950ee",
                },
            };

            mockGrpcClient.Setup(x => x.AggregatedList(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            MachineTypesClient        client   = new MachineTypesClientImpl(mockGrpcClient.Object, null);
            MachineTypeAggregatedList response = client.AggregatedList(request);

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