http://docs.myget.org/docs/reference/webhooks
public void BuildStartedPayload_Roundtrips() { // Arrange JObject data = EmbeddedResource.ReadAsJObject("Microsoft.AspNet.WebHooks.Messages.BuildStartedMessage.json"); BuildStartedPayload expected = new BuildStartedPayload { FeedIdentifier = "sample-feed", FeedUrl = new Uri("https://www.myget.org/F/sample-feed/"), Name = "SampleBuild", Branch = "master" }; // Act BuildStartedPayload actual = data["Payload"].ToObject<BuildStartedPayload>(); // Assert string expectedJson = JsonConvert.SerializeObject(expected); string actualJson = JsonConvert.SerializeObject(actual); Assert.Equal(expectedJson, actualJson); }
public void BuildStartedPayload_Roundtrips() { // Arrange JObject data = EmbeddedResource.ReadAsJObject("Microsoft.AspNet.WebHooks.Messages.BuildStartedMessage.json"); BuildStartedPayload expected = new BuildStartedPayload { FeedIdentifier = "sample-feed", FeedUrl = new Uri("https://www.myget.org/F/sample-feed/"), Name = "SampleBuild", Branch = "master" }; // Act BuildStartedPayload actual = data["Payload"].ToObject <BuildStartedPayload>(); // Assert string expectedJson = JsonConvert.SerializeObject(expected); string actualJson = JsonConvert.SerializeObject(actual); Assert.Equal(expectedJson, actualJson); }
/// <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, BuildStartedPayload payload) { return Task.FromResult(true); }