Exemplo n.º 1
0
        public async stt::Task ListAsync()
        {
            moq::Mock <InterconnectLocations.InterconnectLocationsClient> mockGrpcClient = new moq::Mock <InterconnectLocations.InterconnectLocationsClient>(moq::MockBehavior.Strict);
            ListInterconnectLocationsRequest request = new ListInterconnectLocationsRequest
            {
                Project = "projectaa6ff846",
            };
            InterconnectLocationList expectedResponse = new InterconnectLocationList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         =
                {
                    new InterconnectLocation(),
                },
                SelfLink = "self_link7e87f12d",
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 2
0
        public void ListRequestObject()
        {
            moq::Mock <InterconnectLocations.InterconnectLocationsClient> mockGrpcClient = new moq::Mock <InterconnectLocations.InterconnectLocationsClient>(moq::MockBehavior.Strict);
            ListInterconnectLocationsRequest request = new ListInterconnectLocationsRequest
            {
                PageToken            = "page_tokenf09e5538",
                MaxResults           = 2806814450U,
                Filter               = "filtere47ac9b2",
                OrderBy              = "order_byb4d33ada",
                Project              = "projectaa6ff846",
                ReturnPartialSuccess = false,
            };
            InterconnectLocationList expectedResponse = new InterconnectLocationList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         =
                {
                    new InterconnectLocation(),
                },
                SelfLink = "self_link7e87f12d",
            };

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

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 3
0
        public void List()
        {
            moq::Mock <InterconnectLocations.InterconnectLocationsClient> mockGrpcClient = new moq::Mock <InterconnectLocations.InterconnectLocationsClient>(moq::MockBehavior.Strict);
            ListInterconnectLocationsRequest request = new ListInterconnectLocationsRequest
            {
                Project = "projectaa6ff846",
            };
            InterconnectLocationList expectedResponse = new InterconnectLocationList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         =
                {
                    new InterconnectLocation(),
                },
                SelfLink = "self_link7e87f12d",
            };

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

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 4
0
        public async stt::Task GetRequestObjectAsync()
        {
            moq::Mock <InterconnectLocations.InterconnectLocationsClient> mockGrpcClient = new moq::Mock <InterconnectLocations.InterconnectLocationsClient>(moq::MockBehavior.Strict);
            GetInterconnectLocationRequest request = new GetInterconnectLocationRequest
            {
                Project = "projectaa6ff846",
                InterconnectLocation = "interconnect_location365a00f5",
            };
            InterconnectLocation expectedResponse = new InterconnectLocation
            {
                Id   = 11672635353343658936UL,
                City = "cityead2d54e",
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                CreationTimestamp          = "creation_timestamp235e59a1",
                SupportsPzs                = false,
                FacilityProviderFacilityId = "facility_provider_facility_id936c09db",
                Continent        = "continent4ee8200e",
                AvailabilityZone = "availability_zone1778d0ba",
                Status           = "status5444cb9a",
                RegionInfos      =
                {
                    new InterconnectLocationRegionInfo(),
                },
                Description         = "description2cf9da67",
                SelfLink            = "self_link7e87f12d",
                Address             = "address04984d88",
                FacilityProvider    = "facility_provider3fff5132",
                PeeringdbFacilityId = "peeringdb_facility_idcce67e85",
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public void GetRequestObject()
        {
            moq::Mock <InterconnectLocations.InterconnectLocationsClient> mockGrpcClient = new moq::Mock <InterconnectLocations.InterconnectLocationsClient>(moq::MockBehavior.Strict);
            GetInterconnectLocationRequest request = new GetInterconnectLocationRequest
            {
                Project = "projectaa6ff846",
                InterconnectLocation = "interconnect_location365a00f5",
            };
            InterconnectLocation expectedResponse = new InterconnectLocation
            {
                Id   = 11672635353343658936UL,
                City = "cityead2d54e",
                Kind = "kindf7aa39d9",
                Name = "name1c9368b0",
                CreationTimestamp          = "creation_timestamp235e59a1",
                SupportsPzs                = false,
                FacilityProviderFacilityId = "facility_provider_facility_id936c09db",
                Continent        = InterconnectLocation.Types.Continent.CAfrica,
                AvailabilityZone = "availability_zone1778d0ba",
                Status           = InterconnectLocation.Types.Status.Closed,
                RegionInfos      =
                {
                    new InterconnectLocationRegionInfo(),
                },
                Description         = "description2cf9da67",
                SelfLink            = "self_link7e87f12d",
                Address             = "address04984d88",
                FacilityProvider    = "facility_provider3fff5132",
                PeeringdbFacilityId = "peeringdb_facility_idcce67e85",
            };

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

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