public void GetChangelog()
        {
            moq::Mock <Changelogs.ChangelogsClient> mockGrpcClient = new moq::Mock <Changelogs.ChangelogsClient>(moq::MockBehavior.Strict);
            GetChangelogRequest request = new GetChangelogRequest
            {
                ChangelogName = ChangelogName.FromProjectLocationAgentChangelog("[PROJECT]", "[LOCATION]", "[AGENT]", "[CHANGELOG]"),
            };
            Changelog expectedResponse = new Changelog
            {
                ChangelogName = ChangelogName.FromProjectLocationAgentChangelog("[PROJECT]", "[LOCATION]", "[AGENT]", "[CHANGELOG]"),
                UserEmail     = "user_emaildc7bc240",
                Resource      = "resource164eab96",
                CreateTime    = new wkt::Timestamp(),
                DisplayName   = "display_name137f65c2",
                Type          = "typee2cc9d59",
                Action        = "action09558c41",
            };

            mockGrpcClient.Setup(x => x.GetChangelog(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ChangelogsClient client   = new ChangelogsClientImpl(mockGrpcClient.Object, null);
            Changelog        response = client.GetChangelog(request.Name);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public async stt::Task GetChangelogRequestObjectAsync()
        {
            moq::Mock <Changelogs.ChangelogsClient> mockGrpcClient = new moq::Mock <Changelogs.ChangelogsClient>(moq::MockBehavior.Strict);
            GetChangelogRequest request = new GetChangelogRequest
            {
                ChangelogName = ChangelogName.FromProjectLocationAgentChangelog("[PROJECT]", "[LOCATION]", "[AGENT]", "[CHANGELOG]"),
            };
            Changelog expectedResponse = new Changelog
            {
                ChangelogName = ChangelogName.FromProjectLocationAgentChangelog("[PROJECT]", "[LOCATION]", "[AGENT]", "[CHANGELOG]"),
                UserEmail     = "user_emaildc7bc240",
                Resource      = "resource164eab96",
                CreateTime    = new wkt::Timestamp(),
                DisplayName   = "display_name137f65c2",
                Type          = "typee2cc9d59",
                Action        = "action09558c41",
            };

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

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

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
示例#3
0
        private Task fetchListing()
        {
            if (initialFetchTask != null)
            {
                return(initialFetchTask);
            }

            return(initialFetchTask = Task.Run(async() =>
            {
                var tcs = new TaskCompletionSource <bool>();

                var req = new GetChangelogRequest();
                req.Success += res =>
                {
                    // remap streams to builds to ensure model equality
                    res.Builds.ForEach(b => b.UpdateStream = res.Streams.Find(s => s.Id == b.UpdateStream.Id));
                    res.Streams.ForEach(s => s.LatestBuild.UpdateStream = res.Streams.Find(s2 => s2.Id == s.LatestBuild.UpdateStream.Id));

                    builds = res.Builds;
                    streams = res.Streams;

                    header.Streams.Populate(res.Streams);

                    tcs.SetResult(true);
                };
                req.Failure += _ => initialFetchTask = null;
                req.Perform(API);

                await tcs.Task;
            }));
        }
 /// <summary>Snippet for GetChangelog</summary>
 public void GetChangelogRequestObject()
 {
     // Snippet: GetChangelog(GetChangelogRequest, CallSettings)
     // Create client
     ChangelogsClient changelogsClient = ChangelogsClient.Create();
     // Initialize request argument(s)
     GetChangelogRequest request = new GetChangelogRequest
     {
         ChangelogName = ChangelogName.FromProjectLocationAgentChangelog("[PROJECT]", "[LOCATION]", "[AGENT]", "[CHANGELOG]"),
     };
     // Make the request
     Changelog response = changelogsClient.GetChangelog(request);
     // End snippet
 }
        /// <summary>Snippet for GetChangelogAsync</summary>
        public async Task GetChangelogRequestObjectAsync()
        {
            // Snippet: GetChangelogAsync(GetChangelogRequest, CallSettings)
            // Additional: GetChangelogAsync(GetChangelogRequest, CancellationToken)
            // Create client
            ChangelogsClient changelogsClient = await ChangelogsClient.CreateAsync();

            // Initialize request argument(s)
            GetChangelogRequest request = new GetChangelogRequest
            {
                ChangelogName = ChangelogName.FromProjectLocationAgentChangelog("[PROJECT]", "[LOCATION]", "[AGENT]", "[CHANGELOG]"),
            };
            // Make the request
            Changelog response = await changelogsClient.GetChangelogAsync(request);

            // End snippet
        }
示例#6
0
        private Task fetchListing()
        {
            if (initialFetchTask != null)
            {
                return(initialFetchTask);
            }

            return(initialFetchTask = Task.Run(async() =>
            {
                var tcs = new TaskCompletionSource <bool>();

                var req = new GetChangelogRequest();

                req.Success += res => Schedule(() =>
                {
                    // remap streams to builds to ensure model equality
                    res.Builds.ForEach(b => b.UpdateStream = res.Streams.Find(s => s.Id == b.UpdateStream.Id));
                    res.Streams.ForEach(s => s.LatestBuild.UpdateStream = res.Streams.Find(s2 => s2.Id == s.LatestBuild.UpdateStream.Id));

                    builds = res.Builds;
                    Streams = res.Streams;

                    Header.Populate(res.Streams);

                    tcs.SetResult(true);
                });

                req.Failure += e =>
                {
                    initialFetchTask = null;
                    tcs.SetException(e);
                };

                await API.PerformAsync(req).ConfigureAwait(false);

                return tcs.Task;
            }).Unwrap());
        }
 /// <summary>
 /// Retrieves the specified Changelog.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public override stt::Task <Changelog> GetChangelogAsync(GetChangelogRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_GetChangelogRequest(ref request, ref callSettings);
     return(_callGetChangelog.Async(request, callSettings));
 }
 /// <summary>
 /// Retrieves the specified Changelog.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>The RPC response.</returns>
 public override Changelog GetChangelog(GetChangelogRequest request, gaxgrpc::CallSettings callSettings = null)
 {
     Modify_GetChangelogRequest(ref request, ref callSettings);
     return(_callGetChangelog.Sync(request, callSettings));
 }
 partial void Modify_GetChangelogRequest(ref GetChangelogRequest request, ref gaxgrpc::CallSettings settings);
 /// <summary>
 /// Retrieves the specified Changelog.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public virtual stt::Task <Changelog> GetChangelogAsync(GetChangelogRequest request, st::CancellationToken cancellationToken) =>
 GetChangelogAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
 /// <summary>
 /// Retrieves the specified Changelog.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>A Task containing the RPC response.</returns>
 public virtual stt::Task <Changelog> GetChangelogAsync(GetChangelogRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();
 /// <summary>
 /// Retrieves the specified Changelog.
 /// </summary>
 /// <param name="request">The request object containing all of the parameters for the API call.</param>
 /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
 /// <returns>The RPC response.</returns>
 public virtual Changelog GetChangelog(GetChangelogRequest request, gaxgrpc::CallSettings callSettings = null) =>
 throw new sys::NotImplementedException();