Example #1
0
        public async stt::Task ListAsync()
        {
            moq::Mock <TargetInstances.TargetInstancesClient> mockGrpcClient = new moq::Mock <TargetInstances.TargetInstancesClient>(moq::MockBehavior.Strict);
            ListTargetInstancesRequest request = new ListTargetInstancesRequest
            {
                Zone    = "zone255f4ea8",
                Project = "projectaa6ff846",
            };
            TargetInstanceList expectedResponse = new TargetInstanceList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         =
                {
                    new TargetInstance(),
                },
                SelfLink = "self_link7e87f12d",
            };

            mockGrpcClient.Setup(x => x.ListAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <TargetInstanceList>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            TargetInstancesClient client = new TargetInstancesClientImpl(mockGrpcClient.Object, null);
            TargetInstanceList    responseCallSettings = await client.ListAsync(request.Project, request.Zone, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            TargetInstanceList responseCancellationToken = await client.ListAsync(request.Project, request.Zone, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Example #2
0
        public async stt::Task GetAsync()
        {
            moq::Mock <TargetInstances.TargetInstancesClient> mockGrpcClient = new moq::Mock <TargetInstances.TargetInstancesClient>(moq::MockBehavior.Strict);
            GetTargetInstanceRequest request = new GetTargetInstanceRequest
            {
                Zone           = "zone255f4ea8",
                Project        = "projectaa6ff846",
                TargetInstance = "target_instance1017fe07",
            };
            TargetInstance expectedResponse = new TargetInstance
            {
                Id                = "id74b70bb8",
                Kind              = "kindf7aa39d9",
                Name              = "name1c9368b0",
                Zone              = "zone255f4ea8",
                Instance          = "instance99a62371",
                CreationTimestamp = "creation_timestamp235e59a1",
                Description       = "description2cf9da67",
                SelfLink          = "self_link7e87f12d",
                NatPolicy         = TargetInstance.Types.NatPolicy.NoNat,
            };

            mockGrpcClient.Setup(x => x.GetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <TargetInstance>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            TargetInstancesClient client = new TargetInstancesClientImpl(mockGrpcClient.Object, null);
            TargetInstance        responseCallSettings = await client.GetAsync(request.Project, request.Zone, request.TargetInstance, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            TargetInstance responseCancellationToken = await client.GetAsync(request.Project, request.Zone, request.TargetInstance, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Example #3
0
        public void List()
        {
            moq::Mock <TargetInstances.TargetInstancesClient> mockGrpcClient = new moq::Mock <TargetInstances.TargetInstancesClient>(moq::MockBehavior.Strict);
            ListTargetInstancesRequest request = new ListTargetInstancesRequest
            {
                Zone    = "zone255f4ea8",
                Project = "projectaa6ff846",
            };
            TargetInstanceList expectedResponse = new TargetInstanceList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         =
                {
                    new TargetInstance(),
                },
                SelfLink = "self_link7e87f12d",
            };

            mockGrpcClient.Setup(x => x.List(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            TargetInstancesClient client   = new TargetInstancesClientImpl(mockGrpcClient.Object, null);
            TargetInstanceList    response = client.List(request.Project, request.Zone);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Example #4
0
        public void ListRequestObject()
        {
            moq::Mock <TargetInstances.TargetInstancesClient> mockGrpcClient = new moq::Mock <TargetInstances.TargetInstancesClient>(moq::MockBehavior.Strict);
            ListTargetInstancesRequest request = new ListTargetInstancesRequest
            {
                Zone                 = "zone255f4ea8",
                PageToken            = "page_tokenf09e5538",
                MaxResults           = 2806814450U,
                OrderBy              = "order_byb4d33ada",
                Project              = "projectaa6ff846",
                Filter               = "filtere47ac9b2",
                ReturnPartialSuccess = false,
            };
            TargetInstanceList expectedResponse = new TargetInstanceList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         =
                {
                    new TargetInstance(),
                },
                SelfLink = "self_link7e87f12d",
            };

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

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Example #5
0
        public void Get()
        {
            moq::Mock <TargetInstances.TargetInstancesClient> mockGrpcClient = new moq::Mock <TargetInstances.TargetInstancesClient>(moq::MockBehavior.Strict);
            GetTargetInstanceRequest request = new GetTargetInstanceRequest
            {
                Zone           = "zone255f4ea8",
                Project        = "projectaa6ff846",
                TargetInstance = "target_instance1017fe07",
            };
            TargetInstance expectedResponse = new TargetInstance
            {
                Id                = "id74b70bb8",
                Kind              = "kindf7aa39d9",
                Name              = "name1c9368b0",
                Zone              = "zone255f4ea8",
                Instance          = "instance99a62371",
                CreationTimestamp = "creation_timestamp235e59a1",
                Description       = "description2cf9da67",
                SelfLink          = "self_link7e87f12d",
                NatPolicy         = TargetInstance.Types.NatPolicy.NoNat,
            };

            mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            TargetInstancesClient client   = new TargetInstancesClientImpl(mockGrpcClient.Object, null);
            TargetInstance        response = client.Get(request.Project, request.Zone, request.TargetInstance);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Example #6
0
        public void AggregatedList()
        {
            moq::Mock <TargetInstances.TargetInstancesClient> mockGrpcClient = new moq::Mock <TargetInstances.TargetInstancesClient>(moq::MockBehavior.Strict);
            AggregatedListTargetInstancesRequest request = new AggregatedListTargetInstancesRequest
            {
                Project = "projectaa6ff846",
            };
            TargetInstanceAggregatedList expectedResponse = new TargetInstanceAggregatedList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         =
                {
                    {
                        "key8a0b6e3c",
                        new TargetInstancesScopedList()
                    },
                },
                Unreachables =
                {
                    "unreachables3ca950ee",
                },
                SelfLink = "self_link7e87f12d",
            };

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

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void GetRequestObject()
        {
            moq::Mock <TargetInstances.TargetInstancesClient> mockGrpcClient = new moq::Mock <TargetInstances.TargetInstancesClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClientForZoneOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetTargetInstanceRequest request = new GetTargetInstanceRequest
            {
                Zone           = "zone255f4ea8",
                Project        = "projectaa6ff846",
                TargetInstance = "target_instance1017fe07",
            };
            TargetInstance expectedResponse = new TargetInstance
            {
                Id                = 11672635353343658936UL,
                Kind              = "kindf7aa39d9",
                Name              = "name1c9368b0",
                Zone              = "zone255f4ea8",
                Instance          = "instance99a62371",
                CreationTimestamp = "creation_timestamp235e59a1",
                Network           = "networkd22ce091",
                Description       = "description2cf9da67",
                SelfLink          = "self_link7e87f12d",
                NatPolicy         = "nat_policy8dd30c47",
            };

            mockGrpcClient.Setup(x => x.Get(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            TargetInstancesClient client   = new TargetInstancesClientImpl(mockGrpcClient.Object, null);
            TargetInstance        response = client.Get(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public async stt::Task DeleteRequestObjectAsync()
        {
            moq::Mock <TargetInstances.TargetInstancesClient> mockGrpcClient = new moq::Mock <TargetInstances.TargetInstancesClient>(moq::MockBehavior.Strict);
            DeleteTargetInstanceRequest request = new DeleteTargetInstanceRequest
            {
                Zone           = "zone255f4ea8",
                RequestId      = "request_id362c8df6",
                Project        = "projectaa6ff846",
                TargetInstance = "target_instance1017fe07",
            };
            Operation expectedResponse = new Operation
            {
                Id   = 11672635353343658936UL,
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                User = "******",
                Zone = "zone255f4ea8",
                CreationTimestamp   = "creation_timestamp235e59a1",
                StartTime           = "start_timebd8dd9c4",
                OperationGroupId    = "operation_group_idd2040cf0",
                TargetLink          = "target_link9b435dc0",
                Progress            = 278622268,
                Error               = new Error(),
                EndTime             = "end_time89285d30",
                Region              = "regionedb20d96",
                OperationType       = "operation_typeece9e153",
                Status              = Operation.Types.Status.Pending,
                HttpErrorMessage    = "http_error_messageb5ef3c7f",
                TargetId            = 6263187990225347157UL,
                ClientOperationId   = "client_operation_id4e51b631",
                StatusMessage       = "status_message2c618f86",
                HttpErrorStatusCode = 1766362655,
                Description         = "description2cf9da67",
                InsertTime          = "insert_time7467185a",
                SelfLink            = "self_link7e87f12d",
                Warnings            = { new Warnings(), },
            };

            mockGrpcClient.Setup(x => x.DeleteAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Operation>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            TargetInstancesClient client = new TargetInstancesClientImpl(mockGrpcClient.Object, null);
            Operation             responseCallSettings = await client.DeleteAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            Operation responseCancellationToken = await client.DeleteAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Example #9
0
        public void InsertRequestObject()
        {
            moq::Mock <TargetInstances.TargetInstancesClient> mockGrpcClient = new moq::Mock <TargetInstances.TargetInstancesClient>(moq::MockBehavior.Strict);
            InsertTargetInstanceRequest request = new InsertTargetInstanceRequest
            {
                Zone      = "zone255f4ea8",
                RequestId = "request_id362c8df6",
                Project   = "projectaa6ff846",
                TargetInstanceResource = new TargetInstance(),
            };
            Operation expectedResponse = new Operation
            {
                Id   = "id74b70bb8",
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                User = "******",
                Zone = "zone255f4ea8",
                CreationTimestamp   = "creation_timestamp235e59a1",
                StartTime           = "start_timebd8dd9c4",
                OperationGroupId    = "operation_group_idd2040cf0",
                TargetLink          = "target_link9b435dc0",
                Progress            = 278622268,
                Error               = new Error(),
                EndTime             = "end_time89285d30",
                Region              = "regionedb20d96",
                OperationType       = "operation_typeece9e153",
                Status              = Operation.Types.Status.Pending,
                HttpErrorMessage    = "http_error_messageb5ef3c7f",
                TargetId            = "target_id16dfe255",
                ClientOperationId   = "client_operation_id4e51b631",
                StatusMessage       = "status_message2c618f86",
                HttpErrorStatusCode = 1766362655,
                Description         = "description2cf9da67",
                InsertTime          = "insert_time7467185a",
                SelfLink            = "self_link7e87f12d",
                Warnings            = { new Warnings(), },
            };

            mockGrpcClient.Setup(x => x.Insert(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            TargetInstancesClient client   = new TargetInstancesClientImpl(mockGrpcClient.Object, null);
            Operation             response = client.Insert(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Example #10
0
        public async stt::Task AggregatedListRequestObjectAsync()
        {
            moq::Mock <TargetInstances.TargetInstancesClient> mockGrpcClient = new moq::Mock <TargetInstances.TargetInstancesClient>(moq::MockBehavior.Strict);
            AggregatedListTargetInstancesRequest request = new AggregatedListTargetInstancesRequest
            {
                PageToken            = "page_tokenf09e5538",
                MaxResults           = 2806814450U,
                OrderBy              = "order_byb4d33ada",
                Project              = "projectaa6ff846",
                Filter               = "filtere47ac9b2",
                IncludeAllScopes     = false,
                ReturnPartialSuccess = false,
            };
            TargetInstanceAggregatedList expectedResponse = new TargetInstanceAggregatedList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         =
                {
                    {
                        "key8a0b6e3c",
                        new TargetInstancesScopedList()
                    },
                },
                Unreachables =
                {
                    "unreachables3ca950ee",
                },
                SelfLink = "self_link7e87f12d",
            };

            mockGrpcClient.Setup(x => x.AggregatedListAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <TargetInstanceAggregatedList>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            TargetInstancesClient        client = new TargetInstancesClientImpl(mockGrpcClient.Object, null);
            TargetInstanceAggregatedList responseCallSettings = await client.AggregatedListAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            TargetInstanceAggregatedList responseCancellationToken = await client.AggregatedListAsync(request, st::CancellationToken.None);

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