Ejemplo n.º 1
0
        public async stt::Task ReplaceTaxonomyRequestObjectAsync()
        {
            moq::Mock <PolicyTagManagerSerialization.PolicyTagManagerSerializationClient> mockGrpcClient = new moq::Mock <PolicyTagManagerSerialization.PolicyTagManagerSerializationClient>(moq::MockBehavior.Strict);
            ReplaceTaxonomyRequest request = new ReplaceTaxonomyRequest
            {
                TaxonomyName       = TaxonomyName.FromProjectLocationTaxonomy("[PROJECT]", "[LOCATION]", "[TAXONOMY]"),
                SerializedTaxonomy = new SerializedTaxonomy(),
            };
            Taxonomy expectedResponse = new Taxonomy
            {
                TaxonomyName         = TaxonomyName.FromProjectLocationTaxonomy("[PROJECT]", "[LOCATION]", "[TAXONOMY]"),
                DisplayName          = "display_name137f65c2",
                Description          = "description2cf9da67",
                PolicyTagCount       = -1730676159,
                TaxonomyTimestamps   = new SystemTimestamps(),
                ActivatedPolicyTypes =
                {
                    Taxonomy.Types.PolicyType.Unspecified,
                },
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 2
0
        public async stt::Task ExportTaxonomiesRequestObjectAsync()
        {
            moq::Mock <PolicyTagManagerSerialization.PolicyTagManagerSerializationClient> mockGrpcClient = new moq::Mock <PolicyTagManagerSerialization.PolicyTagManagerSerializationClient>(moq::MockBehavior.Strict);
            ExportTaxonomiesRequest request = new ExportTaxonomiesRequest
            {
                ParentAsLocationName      = gagr::LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
                TaxonomiesAsTaxonomyNames =
                {
                    TaxonomyName.FromProjectLocationTaxonomy("[PROJECT]", "[LOCATION]", "[TAXONOMY]"),
                },
                SerializedTaxonomies = true,
            };
            ExportTaxonomiesResponse expectedResponse = new ExportTaxonomiesResponse
            {
                Taxonomies =
                {
                    new SerializedTaxonomy(),
                },
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 3
0
        public void ReplaceTaxonomyRequestObject()
        {
            moq::Mock <PolicyTagManagerSerialization.PolicyTagManagerSerializationClient> mockGrpcClient = new moq::Mock <PolicyTagManagerSerialization.PolicyTagManagerSerializationClient>(moq::MockBehavior.Strict);
            ReplaceTaxonomyRequest request = new ReplaceTaxonomyRequest
            {
                TaxonomyName       = TaxonomyName.FromProjectLocationTaxonomy("[PROJECT]", "[LOCATION]", "[TAXONOMY]"),
                SerializedTaxonomy = new SerializedTaxonomy(),
            };
            Taxonomy expectedResponse = new Taxonomy
            {
                TaxonomyName         = TaxonomyName.FromProjectLocationTaxonomy("[PROJECT]", "[LOCATION]", "[TAXONOMY]"),
                DisplayName          = "display_name137f65c2",
                Description          = "description2cf9da67",
                PolicyTagCount       = -1730676159,
                TaxonomyTimestamps   = new SystemTimestamps(),
                ActivatedPolicyTypes =
                {
                    Taxonomy.Types.PolicyType.Unspecified,
                },
            };

            mockGrpcClient.Setup(x => x.ReplaceTaxonomy(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            PolicyTagManagerSerializationClient client = new PolicyTagManagerSerializationClientImpl(mockGrpcClient.Object, null);
            Taxonomy response = client.ReplaceTaxonomy(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 4
0
        public void ExportTaxonomiesRequestObject()
        {
            moq::Mock <PolicyTagManagerSerialization.PolicyTagManagerSerializationClient> mockGrpcClient = new moq::Mock <PolicyTagManagerSerialization.PolicyTagManagerSerializationClient>(moq::MockBehavior.Strict);
            ExportTaxonomiesRequest request = new ExportTaxonomiesRequest
            {
                ParentAsLocationName      = gagr::LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
                TaxonomiesAsTaxonomyNames =
                {
                    TaxonomyName.FromProjectLocationTaxonomy("[PROJECT]", "[LOCATION]", "[TAXONOMY]"),
                },
                SerializedTaxonomies = true,
            };
            ExportTaxonomiesResponse expectedResponse = new ExportTaxonomiesResponse
            {
                Taxonomies =
                {
                    new SerializedTaxonomy(),
                },
            };

            mockGrpcClient.Setup(x => x.ExportTaxonomies(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            PolicyTagManagerSerializationClient client   = new PolicyTagManagerSerializationClientImpl(mockGrpcClient.Object, null);
            ExportTaxonomiesResponse            response = client.ExportTaxonomies(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 5
0
        public void ImportTaxonomiesRequestObject()
        {
            moq::Mock <PolicyTagManagerSerialization.PolicyTagManagerSerializationClient> mockGrpcClient = new moq::Mock <PolicyTagManagerSerialization.PolicyTagManagerSerializationClient>(moq::MockBehavior.Strict);
            ImportTaxonomiesRequest request = new ImportTaxonomiesRequest
            {
                ParentAsLocationName = gagr::LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
                InlineSource         = new InlineSource(),
                CrossRegionalSource  = new CrossRegionalSource(),
            };
            ImportTaxonomiesResponse expectedResponse = new ImportTaxonomiesResponse
            {
                Taxonomies = { new Taxonomy(), },
            };

            mockGrpcClient.Setup(x => x.ImportTaxonomies(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            PolicyTagManagerSerializationClient client   = new PolicyTagManagerSerializationClientImpl(mockGrpcClient.Object, null);
            ImportTaxonomiesResponse            response = client.ImportTaxonomies(request);

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