public async stt::Task DeleteLogAsync()
        {
            moq::Mock <LoggingServiceV2.LoggingServiceV2Client> mockGrpcClient = new moq::Mock <LoggingServiceV2.LoggingServiceV2Client>(moq::MockBehavior.Strict);
            DeleteLogRequest request = new DeleteLogRequest
            {
                LogNameAsLogName = LogName.FromProjectLog("[PROJECT]", "[LOG]"),
            };
            wkt::Empty expectedResponse = new wkt::Empty {
            };

            mockGrpcClient.Setup(x => x.DeleteLogAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            LoggingServiceV2Client client = new LoggingServiceV2ClientImpl(mockGrpcClient.Object, null);
            await client.DeleteLogAsync(request.LogName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            await client.DeleteLogAsync(request.LogName, st::CancellationToken.None);

            mockGrpcClient.VerifyAll();
        }
Esempio n. 2
0
        public async Task DeleteLogAsync2()
        {
            Mock <LoggingServiceV2.LoggingServiceV2Client> mockGrpcClient = new Mock <LoggingServiceV2.LoggingServiceV2Client>(MockBehavior.Strict);
            DeleteLogRequest request = new DeleteLogRequest
            {
                LogNameAsLogNameOneof = LogNameOneof.From(new LogName("[PROJECT]", "[LOG]")),
            };
            Empty expectedResponse = new Empty();

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

            mockGrpcClient.VerifyAll();
        }