public async stt::Task GetGroupRequestObjectAsync()
        {
            moq::Mock <ErrorGroupService.ErrorGroupServiceClient> mockGrpcClient = new moq::Mock <ErrorGroupService.ErrorGroupServiceClient>(moq::MockBehavior.Strict);
            GetGroupRequest request = new GetGroupRequest
            {
                GroupNameAsErrorGroupName = ErrorGroupName.FromProjectGroup("[PROJECT]", "[GROUP]"),
            };
            ErrorGroup expectedResponse = new ErrorGroup
            {
                ErrorGroupName = ErrorGroupName.FromProjectGroup("[PROJECT]", "[GROUP]"),
                GroupId        = "group_id4f9a930e",
                TrackingIssues =
                {
                    new TrackingIssue(),
                },
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public void GetGroup()
        {
            moq::Mock <ErrorGroupService.ErrorGroupServiceClient> mockGrpcClient = new moq::Mock <ErrorGroupService.ErrorGroupServiceClient>(moq::MockBehavior.Strict);
            GetGroupRequest request = new GetGroupRequest
            {
                GroupNameAsErrorGroupName = ErrorGroupName.FromProjectGroup("[PROJECT]", "[GROUP]"),
            };
            ErrorGroup expectedResponse = new ErrorGroup
            {
                ErrorGroupName = ErrorGroupName.FromProjectGroup("[PROJECT]", "[GROUP]"),
                GroupId        = "group_id4f9a930e",
                TrackingIssues =
                {
                    new TrackingIssue(),
                },
                ResolutionStatus = ResolutionStatus.Muted,
            };

            mockGrpcClient.Setup(x => x.GetGroup(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ErrorGroupServiceClient client = new ErrorGroupServiceClientImpl(mockGrpcClient.Object, null);
            ErrorGroup response            = client.GetGroup(request.GroupName);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Ejemplo n.º 3
0
 /// <summary>Snippet for GetGroup</summary>
 public void GetGroup_ResourceNames()
 {
     // Snippet: GetGroup(ErrorGroupName, CallSettings)
     // Create client
     ErrorGroupServiceClient errorGroupServiceClient = ErrorGroupServiceClient.Create();
     // Initialize request argument(s)
     ErrorGroupName groupName = new ErrorGroupName("[PROJECT]", "[GROUP]");
     // Make the request
     ErrorGroup response = errorGroupServiceClient.GetGroup(groupName);
     // End snippet
 }
Ejemplo n.º 4
0
        /// <summary>Snippet for GetGroupAsync</summary>
        public async Task GetGroupAsync_ResourceNames()
        {
            // Snippet: GetGroupAsync(ErrorGroupName, CallSettings)
            // Additional: GetGroupAsync(ErrorGroupName, CancellationToken)
            // Create client
            ErrorGroupServiceClient errorGroupServiceClient = await ErrorGroupServiceClient.CreateAsync();

            // Initialize request argument(s)
            ErrorGroupName groupName = new ErrorGroupName("[PROJECT]", "[GROUP]");
            // Make the request
            ErrorGroup response = await errorGroupServiceClient.GetGroupAsync(groupName);

            // End snippet
        }
 /// <summary>Snippet for GetGroup</summary>
 public void GetGroupRequestObject()
 {
     // Snippet: GetGroup(GetGroupRequest, CallSettings)
     // Create client
     ErrorGroupServiceClient errorGroupServiceClient = ErrorGroupServiceClient.Create();
     // Initialize request argument(s)
     GetGroupRequest request = new GetGroupRequest
     {
         GroupNameAsErrorGroupName = ErrorGroupName.FromProjectGroup("[PROJECT]", "[GROUP]"),
     };
     // Make the request
     ErrorGroup response = errorGroupServiceClient.GetGroup(request);
     // End snippet
 }
        /// <summary>Snippet for GetGroupAsync</summary>
        public async Task GetGroupRequestObjectAsync()
        {
            // Snippet: GetGroupAsync(GetGroupRequest, CallSettings)
            // Additional: GetGroupAsync(GetGroupRequest, CancellationToken)
            // Create client
            ErrorGroupServiceClient errorGroupServiceClient = await ErrorGroupServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetGroupRequest request = new GetGroupRequest
            {
                GroupNameAsErrorGroupName = ErrorGroupName.FromProjectGroup("[PROJECT]", "[GROUP]"),
            };
            // Make the request
            ErrorGroup response = await errorGroupServiceClient.GetGroupAsync(request);

            // End snippet
        }