Payload sent when a package is pinned/unpinned. See http://docs.myget.org/docs/reference/webhooks for details.
예제 #1
0
        public void PackagePinnedPayload_Roundtrips()
        {
            // Arrange
            JObject data = EmbeddedResource.ReadAsJObject("Microsoft.AspNet.WebHooks.Messages.PackagePinnedMessage.json");
            PackagePinnedPayload expected = new PackagePinnedPayload
            {
                Action = "pinned",
                PackageType = "NuGet",
                PackageIdentifier = "GoogleAnalyticsTracker.Simple",
                PackageVersion = "1.0.0-CI00002",
                FeedIdentifier = "sample-feed",
                FeedUrl = new Uri("https://www.myget.org/F/sample-feed/")
            };

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

            // Assert
            string expectedJson = JsonConvert.SerializeObject(expected);
            string actualJson = JsonConvert.SerializeObject(actual);
            Assert.Equal(expectedJson, actualJson);
        }
        public void PackagePinnedPayload_Roundtrips()
        {
            // Arrange
            JObject data = EmbeddedResource.ReadAsJObject("Microsoft.AspNet.WebHooks.Messages.PackagePinnedMessage.json");
            PackagePinnedPayload expected = new PackagePinnedPayload
            {
                Action            = "pinned",
                PackageType       = "NuGet",
                PackageIdentifier = "GoogleAnalyticsTracker.Simple",
                PackageVersion    = "1.0.0-CI00002",
                FeedIdentifier    = "sample-feed",
                FeedUrl           = new Uri("https://www.myget.org/F/sample-feed/")
            };

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

            // 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, PackagePinnedPayload payload)
 {
     return Task.FromResult(true);
 }