コード例 #1
0
        public async Task UpdateExclusionAsync2()
        {
            Mock <ConfigServiceV2.ConfigServiceV2Client> mockGrpcClient = new Mock <ConfigServiceV2.ConfigServiceV2Client>(MockBehavior.Strict);
            UpdateExclusionRequest request = new UpdateExclusionRequest
            {
                ExclusionNameOneof = ExclusionNameOneof.From(new ExclusionName("[PROJECT]", "[EXCLUSION]")),
                Exclusion          = new LogExclusion(),
                UpdateMask         = new FieldMask(),
            };
            LogExclusion expectedResponse = new LogExclusion
            {
                Name        = "name2-1052831874",
                Description = "description-1724546052",
                Filter      = "filter-1274492040",
                Disabled    = true,
            };

            mockGrpcClient.Setup(x => x.UpdateExclusionAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <LogExclusion>(Task.FromResult(expectedResponse), null, null, null, null));
            ConfigServiceV2Client client   = new ConfigServiceV2ClientImpl(mockGrpcClient.Object, null);
            LogExclusion          response = await client.UpdateExclusionAsync(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #2
0
        public async Task GetSinkAsync()
        {
            Mock <ConfigServiceV2.ConfigServiceV2Client> mockGrpcClient = new Mock <ConfigServiceV2.ConfigServiceV2Client>(MockBehavior.Strict);
            GetSinkRequest expectedRequest = new GetSinkRequest
            {
                SinkNameAsSinkNameOneof = SinkNameOneof.From(new SinkName("[PROJECT]", "[SINK]")),
            };
            LogSink expectedResponse = new LogSink
            {
                Name = "name3373707",
                DestinationAsResourceName = new BillingName("[BILLING_ACCOUNT]"),
                Filter          = "filter-1274492040",
                WriterIdentity  = "writerIdentity775638794",
                IncludeChildren = true,
            };

            mockGrpcClient.Setup(x => x.GetSinkAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <LogSink>(Task.FromResult(expectedResponse), null, null, null, null));
            ConfigServiceV2Client client   = new ConfigServiceV2ClientImpl(mockGrpcClient.Object, null);
            SinkNameOneof         sinkName = SinkNameOneof.From(new SinkName("[PROJECT]", "[SINK]"));
            LogSink response = await client.GetSinkAsync(sinkName);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #3
0
        public void UpdateExclusion()
        {
            Mock <ConfigServiceV2.ConfigServiceV2Client> mockGrpcClient = new Mock <ConfigServiceV2.ConfigServiceV2Client>(MockBehavior.Strict);
            UpdateExclusionRequest expectedRequest = new UpdateExclusionRequest
            {
                ExclusionNameOneof = ExclusionNameOneof.From(new ExclusionName("[PROJECT]", "[EXCLUSION]")),
                Exclusion          = new LogExclusion(),
                UpdateMask         = new FieldMask(),
            };
            LogExclusion expectedResponse = new LogExclusion
            {
                Name        = "name2-1052831874",
                Description = "description-1724546052",
                Filter      = "filter-1274492040",
                Disabled    = true,
            };

            mockGrpcClient.Setup(x => x.UpdateExclusion(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            ConfigServiceV2Client client     = new ConfigServiceV2ClientImpl(mockGrpcClient.Object, null);
            ExclusionNameOneof    name       = ExclusionNameOneof.From(new ExclusionName("[PROJECT]", "[EXCLUSION]"));
            LogExclusion          exclusion  = new LogExclusion();
            FieldMask             updateMask = new FieldMask();
            LogExclusion          response   = client.UpdateExclusion(name, exclusion, updateMask);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #4
0
        public async Task CreateExclusionAsync()
        {
            Mock <ConfigServiceV2.ConfigServiceV2Client> mockGrpcClient = new Mock <ConfigServiceV2.ConfigServiceV2Client>(MockBehavior.Strict);
            CreateExclusionRequest expectedRequest = new CreateExclusionRequest
            {
                ParentAsParentNameOneof = ParentNameOneof.From(new ProjectName("[PROJECT]")),
                Exclusion = new LogExclusion(),
            };
            LogExclusion expectedResponse = new LogExclusion
            {
                Name        = "name3373707",
                Description = "description-1724546052",
                Filter      = "filter-1274492040",
                Disabled    = true,
            };

            mockGrpcClient.Setup(x => x.CreateExclusionAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <LogExclusion>(Task.FromResult(expectedResponse), null, null, null, null));
            ConfigServiceV2Client client    = new ConfigServiceV2ClientImpl(mockGrpcClient.Object, null);
            ParentNameOneof       parent    = ParentNameOneof.From(new ProjectName("[PROJECT]"));
            LogExclusion          exclusion = new LogExclusion();
            LogExclusion          response  = await client.CreateExclusionAsync(parent, exclusion);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #5
0
        public void UpdateSink3()
        {
            Mock <ConfigServiceV2.ConfigServiceV2Client> mockGrpcClient = new Mock <ConfigServiceV2.ConfigServiceV2Client>(MockBehavior.Strict);
            UpdateSinkRequest request = new UpdateSinkRequest
            {
                SinkNameAsSinkNameOneof = SinkNameOneof.From(new SinkName("[PROJECT]", "[SINK]")),
                Sink = new LogSink(),
            };
            LogSink expectedResponse = new LogSink
            {
                Name = "name3373707",
                DestinationAsResourceName = new BillingName("[BILLING_ACCOUNT]"),
                Filter          = "filter-1274492040",
                WriterIdentity  = "writerIdentity775638794",
                IncludeChildren = true,
            };

            mockGrpcClient.Setup(x => x.UpdateSink(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            ConfigServiceV2Client client = new ConfigServiceV2ClientImpl(mockGrpcClient.Object, null);
            LogSink response             = client.UpdateSink(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #6
0
        public async Task CreateSinkAsync2()
        {
            Mock <ConfigServiceV2.ConfigServiceV2Client> mockGrpcClient = new Mock <ConfigServiceV2.ConfigServiceV2Client>(MockBehavior.Strict);
            CreateSinkRequest request = new CreateSinkRequest
            {
                ParentAsParentNameOneof = ParentNameOneof.From(new ProjectName("[PROJECT]")),
                Sink = new LogSink(),
            };
            LogSink expectedResponse = new LogSink
            {
                Name = "name3373707",
                DestinationAsResourceName = new ProjectName("[PROJECT]"),
                Filter          = "filter-1274492040",
                WriterIdentity  = "writerIdentity775638794",
                IncludeChildren = true,
            };

            mockGrpcClient.Setup(x => x.CreateSinkAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <LogSink>(Task.FromResult(expectedResponse), null, null, null, null));
            ConfigServiceV2Client client = new ConfigServiceV2ClientImpl(mockGrpcClient.Object, null);
            LogSink response             = await client.CreateSinkAsync(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #7
0
        public void CreateSink()
        {
            Mock <ConfigServiceV2.ConfigServiceV2Client> mockGrpcClient = new Mock <ConfigServiceV2.ConfigServiceV2Client>(MockBehavior.Strict);
            CreateSinkRequest expectedRequest = new CreateSinkRequest
            {
                ParentAsParentNameOneof = ParentNameOneof.From(new ProjectName("[PROJECT]")),
                Sink = new LogSink(),
            };
            LogSink expectedResponse = new LogSink
            {
                Name = "name3373707",
                DestinationAsResourceName = new BillingName("[BILLING_ACCOUNT]"),
                Filter          = "filter-1274492040",
                Description     = "description-1724546052",
                Disabled        = true,
                WriterIdentity  = "writerIdentity775638794",
                IncludeChildren = true,
            };

            mockGrpcClient.Setup(x => x.CreateSink(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            ConfigServiceV2Client client = new ConfigServiceV2ClientImpl(mockGrpcClient.Object, null);
            ParentNameOneof       parent = ParentNameOneof.From(new ProjectName("[PROJECT]"));
            LogSink sink     = new LogSink();
            LogSink response = client.CreateSink(parent, sink);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #8
0
        public async Task DeleteExclusionAsync2()
        {
            Mock <ConfigServiceV2.ConfigServiceV2Client> mockGrpcClient = new Mock <ConfigServiceV2.ConfigServiceV2Client>(MockBehavior.Strict);
            DeleteExclusionRequest request = new DeleteExclusionRequest
            {
                ExclusionNameOneof = ExclusionNameOneof.From(new ExclusionName("[PROJECT]", "[EXCLUSION]")),
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteExclusionAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null));
            ConfigServiceV2Client client = new ConfigServiceV2ClientImpl(mockGrpcClient.Object, null);
            await client.DeleteExclusionAsync(request);

            mockGrpcClient.VerifyAll();
        }
コード例 #9
0
        public void DeleteExclusion2()
        {
            Mock <ConfigServiceV2.ConfigServiceV2Client> mockGrpcClient = new Mock <ConfigServiceV2.ConfigServiceV2Client>(MockBehavior.Strict);
            DeleteExclusionRequest request = new DeleteExclusionRequest
            {
                ExclusionNameOneof = ExclusionNameOneof.From(new ExclusionName("[PROJECT]", "[EXCLUSION]")),
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteExclusion(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            ConfigServiceV2Client client = new ConfigServiceV2ClientImpl(mockGrpcClient.Object, null);

            client.DeleteExclusion(request);
            mockGrpcClient.VerifyAll();
        }
コード例 #10
0
        public async Task DeleteSinkAsync()
        {
            Mock <ConfigServiceV2.ConfigServiceV2Client> mockGrpcClient = new Mock <ConfigServiceV2.ConfigServiceV2Client>(MockBehavior.Strict);
            DeleteSinkRequest expectedRequest = new DeleteSinkRequest
            {
                SinkNameAsSinkNameOneof = SinkNameOneof.From(new SinkName("[PROJECT]", "[SINK]")),
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteSinkAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null));
            ConfigServiceV2Client client   = new ConfigServiceV2ClientImpl(mockGrpcClient.Object, null);
            SinkNameOneof         sinkName = SinkNameOneof.From(new SinkName("[PROJECT]", "[SINK]"));
            await client.DeleteSinkAsync(sinkName);

            mockGrpcClient.VerifyAll();
        }
コード例 #11
0
        public void DeleteSink()
        {
            Mock <ConfigServiceV2.ConfigServiceV2Client> mockGrpcClient = new Mock <ConfigServiceV2.ConfigServiceV2Client>(MockBehavior.Strict);
            DeleteSinkRequest expectedRequest = new DeleteSinkRequest
            {
                SinkNameAsSinkNameOneof = SinkNameOneof.From(new SinkName("[PROJECT]", "[SINK]")),
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteSink(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            ConfigServiceV2Client client   = new ConfigServiceV2ClientImpl(mockGrpcClient.Object, null);
            SinkNameOneof         sinkName = SinkNameOneof.From(new SinkName("[PROJECT]", "[SINK]"));

            client.DeleteSink(sinkName);
            mockGrpcClient.VerifyAll();
        }
コード例 #12
0
        public async Task UpdateCmekSettingsAsync()
        {
            Mock <ConfigServiceV2.ConfigServiceV2Client> mockGrpcClient = new Mock <ConfigServiceV2.ConfigServiceV2Client>(MockBehavior.Strict);
            UpdateCmekSettingsRequest request = new UpdateCmekSettingsRequest();
            CmekSettings expectedResponse     = new CmekSettings
            {
                Name             = "name3373707",
                KmsKeyName       = "kmsKeyName2094986649",
                ServiceAccountId = "serviceAccountId-111486921",
            };

            mockGrpcClient.Setup(x => x.UpdateCmekSettingsAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <CmekSettings>(Task.FromResult(expectedResponse), null, null, null, null));
            ConfigServiceV2Client client   = new ConfigServiceV2ClientImpl(mockGrpcClient.Object, null);
            CmekSettings          response = await client.UpdateCmekSettingsAsync(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #13
0
        public void UpdateCmekSettings()
        {
            Mock <ConfigServiceV2.ConfigServiceV2Client> mockGrpcClient = new Mock <ConfigServiceV2.ConfigServiceV2Client>(MockBehavior.Strict);
            UpdateCmekSettingsRequest request = new UpdateCmekSettingsRequest();
            CmekSettings expectedResponse     = new CmekSettings
            {
                Name             = "name3373707",
                KmsKeyName       = "kmsKeyName2094986649",
                ServiceAccountId = "serviceAccountId-111486921",
            };

            mockGrpcClient.Setup(x => x.UpdateCmekSettings(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            ConfigServiceV2Client client   = new ConfigServiceV2ClientImpl(mockGrpcClient.Object, null);
            CmekSettings          response = client.UpdateCmekSettings(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #14
0
        public void CreateExclusion2()
        {
            Mock <ConfigServiceV2.ConfigServiceV2Client> mockGrpcClient = new Mock <ConfigServiceV2.ConfigServiceV2Client>(MockBehavior.Strict);
            CreateExclusionRequest request = new CreateExclusionRequest
            {
                ParentAsParentNameOneof = ParentNameOneof.From(new ProjectName("[PROJECT]")),
                Exclusion = new LogExclusion(),
            };
            LogExclusion expectedResponse = new LogExclusion
            {
                Name        = "name3373707",
                Description = "description-1724546052",
                Filter      = "filter-1274492040",
                Disabled    = true,
            };

            mockGrpcClient.Setup(x => x.CreateExclusion(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            ConfigServiceV2Client client   = new ConfigServiceV2ClientImpl(mockGrpcClient.Object, null);
            LogExclusion          response = client.CreateExclusion(request);

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