コード例 #1
0
        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();
        }
コード例 #2
0
        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;
            }));
        }
コード例 #4
0
 /// <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
 }
コード例 #5
0
        /// <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
ファイル: ChangelogOverlay.cs プロジェクト: Wieku/osu
        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());
        }
コード例 #7
0
 /// <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));
 }
コード例 #8
0
 /// <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));
 }
コード例 #9
0
 partial void Modify_GetChangelogRequest(ref GetChangelogRequest request, ref gaxgrpc::CallSettings settings);
コード例 #10
0
 /// <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));
コード例 #11
0
 /// <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();
コード例 #12
0
 /// <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();