Esempio n. 1
0
        public async stt::Task ListAsync()
        {
            moq::Mock <ZoneOperations.ZoneOperationsClient> mockGrpcClient = new moq::Mock <ZoneOperations.ZoneOperationsClient>(moq::MockBehavior.Strict);
            ListZoneOperationsRequest request = new ListZoneOperationsRequest
            {
                Zone    = "zone255f4ea8",
                Project = "projectaa6ff846",
            };
            OperationList expectedResponse = new OperationList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         = { new Operation(), },
                SelfLink      = "self_link7e87f12d",
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Esempio n. 2
0
        public void List()
        {
            moq::Mock <ZoneOperations.ZoneOperationsClient> mockGrpcClient = new moq::Mock <ZoneOperations.ZoneOperationsClient>(moq::MockBehavior.Strict);
            ListZoneOperationsRequest request = new ListZoneOperationsRequest
            {
                Zone    = "zone255f4ea8",
                Project = "projectaa6ff846",
            };
            OperationList expectedResponse = new OperationList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         = { new Operation(), },
                SelfLink      = "self_link7e87f12d",
            };

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

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Esempio n. 3
0
        public void ListRequestObject()
        {
            moq::Mock <ZoneOperations.ZoneOperationsClient> mockGrpcClient = new moq::Mock <ZoneOperations.ZoneOperationsClient>(moq::MockBehavior.Strict);
            ListZoneOperationsRequest request = new ListZoneOperationsRequest
            {
                Zone                 = "zone255f4ea8",
                PageToken            = "page_tokenf09e5538",
                MaxResults           = 2806814450U,
                Filter               = "filtere47ac9b2",
                OrderBy              = "order_byb4d33ada",
                Project              = "projectaa6ff846",
                ReturnPartialSuccess = false,
            };
            OperationList expectedResponse = new OperationList
            {
                Id            = "id74b70bb8",
                Kind          = "kindf7aa39d9",
                Warning       = new Warning(),
                NextPageToken = "next_page_tokendbee0940",
                Items         = { new Operation(), },
                SelfLink      = "self_link7e87f12d",
            };

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

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Esempio n. 4
0
        public async stt::Task WaitAsync()
        {
            moq::Mock <ZoneOperations.ZoneOperationsClient> mockGrpcClient = new moq::Mock <ZoneOperations.ZoneOperationsClient>(moq::MockBehavior.Strict);
            WaitZoneOperationRequest request = new WaitZoneOperationRequest
            {
                Zone      = "zone255f4ea8",
                Operation = "operation615a23f7",
                Project   = "projectaa6ff846",
            };
            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.WaitAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Operation>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            ZoneOperationsClient client = new ZoneOperationsClientImpl(mockGrpcClient.Object, null);
            Operation            responseCallSettings = await client.WaitAsync(request.Project, request.Zone, request.Operation, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public void Wait()
        {
            moq::Mock <ZoneOperations.ZoneOperationsClient> mockGrpcClient = new moq::Mock <ZoneOperations.ZoneOperationsClient>(moq::MockBehavior.Strict);
            WaitZoneOperationRequest request = new WaitZoneOperationRequest
            {
                Zone      = "zone255f4ea8",
                Operation = "operation615a23f7",
                Project   = "projectaa6ff846",
            };
            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.Wait(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ZoneOperationsClient client   = new ZoneOperationsClientImpl(mockGrpcClient.Object, null);
            Operation            response = client.Wait(request.Project, request.Zone, request.Operation);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Esempio n. 6
0
        public void Delete()
        {
            moq::Mock <ZoneOperations.ZoneOperationsClient> mockGrpcClient = new moq::Mock <ZoneOperations.ZoneOperationsClient>(moq::MockBehavior.Strict);
            DeleteZoneOperationRequest request = new DeleteZoneOperationRequest
            {
                Zone      = "zone255f4ea8",
                Operation = "operation615a23f7",
                Project   = "projectaa6ff846",
            };
            DeleteZoneOperationResponse expectedResponse = new DeleteZoneOperationResponse {
            };

            mockGrpcClient.Setup(x => x.Delete(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ZoneOperationsClient        client   = new ZoneOperationsClientImpl(mockGrpcClient.Object, null);
            DeleteZoneOperationResponse response = client.Delete(request.Project, request.Zone, request.Operation);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Esempio n. 7
0
        public async stt::Task DeleteAsync()
        {
            moq::Mock <ZoneOperations.ZoneOperationsClient> mockGrpcClient = new moq::Mock <ZoneOperations.ZoneOperationsClient>(moq::MockBehavior.Strict);
            DeleteZoneOperationRequest request = new DeleteZoneOperationRequest
            {
                Zone      = "zone255f4ea8",
                Operation = "operation615a23f7",
                Project   = "projectaa6ff846",
            };
            DeleteZoneOperationResponse expectedResponse = new DeleteZoneOperationResponse {
            };

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

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

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