Payload sent when a build has finished. See http://docs.myget.org/docs/reference/webhooks for details.
예제 #1
0
        public void BuildFinishedPayload_Roundtrips()
        {
            // Arrange
            JObject data = EmbeddedResource.ReadAsJObject("Microsoft.AspNet.WebHooks.Messages.BuildFinishedMessage.json");
            BuildFinishedPayload expected = new BuildFinishedPayload
            {
                Result = "success",
                FeedIdentifier = "sample-feed",
                FeedUrl = new Uri("https://www.myget.org/F/sample-feed/"),
                Name = "SampleBuild",
                Branch = "master",
                BuildLogUrl = new Uri("https://www.myget.org/BuildSource/List/sample-feed#d510be3d-7803-43cc-8d15-e327ba999ba7"),
            };
            expected.Packages.Add(new Package
            {
                PackageType = "NuGet",
                PackageIdentifier = "GoogleAnalyticsTracker.Core",
                PackageVersion = "1.0.0-CI00002",
            });
            expected.Packages.Add(new Package
            {
                PackageType = "NuGet",
                PackageIdentifier = "GoogleAnalyticsTracker.MVC4",
                PackageVersion = "1.0.0-CI00002",
            });

            // Act
            BuildFinishedPayload actual = data["Payload"].ToObject<BuildFinishedPayload>();

            // Assert
            string expectedJson = JsonConvert.SerializeObject(expected);
            string actualJson = JsonConvert.SerializeObject(actual);
            Assert.Equal(expectedJson, actualJson);
        }
        public void BuildFinishedPayload_Roundtrips()
        {
            // Arrange
            JObject data = EmbeddedResource.ReadAsJObject("Microsoft.AspNet.WebHooks.Messages.BuildFinishedMessage.json");
            BuildFinishedPayload expected = new BuildFinishedPayload
            {
                Result         = "success",
                FeedIdentifier = "sample-feed",
                FeedUrl        = new Uri("https://www.myget.org/F/sample-feed/"),
                Name           = "SampleBuild",
                Branch         = "main",
                BuildLogUrl    = new Uri("https://www.myget.org/BuildSource/List/sample-feed#d510be3d-7803-43cc-8d15-e327ba999ba7"),
            };

            expected.Packages.Add(new Package
            {
                PackageType       = "NuGet",
                PackageIdentifier = "GoogleAnalyticsTracker.Core",
                PackageVersion    = "1.0.0-CI00002",
            });
            expected.Packages.Add(new Package
            {
                PackageType       = "NuGet",
                PackageIdentifier = "GoogleAnalyticsTracker.MVC4",
                PackageVersion    = "1.0.0-CI00002",
            });

            // Act
            BuildFinishedPayload actual = data["Payload"].ToObject <BuildFinishedPayload>();

            // Assert
            string expectedJson = JsonConvert.SerializeObject(expected);
            string actualJson   = JsonConvert.SerializeObject(actual);

            Assert.Equal(expectedJson, actualJson);
        }
예제 #3
0
 /// <summary>
 /// Executes the incoming WebHook request.
 /// </summary>
 /// <param name="receiver">The name of the <see cref="IWebHookReceiver"/> which processed the incoming WebHook. The
 /// receiver can for example be <c>dropbox</c> or <c>github</c>.</param>
 /// <param name="context">Provides context for the <see cref="IWebHookHandler"/> for further processing the incoming WebHook.</param>
 /// <param name="payload">Strong-typed WebHook payload.</param>
 public virtual Task ExecuteAsync(string receiver, WebHookHandlerContext context, BuildFinishedPayload payload)
 {
     return Task.FromResult(true);
 }