public void WhenCreateSubscriptionWithSameEventNameAndUrl_ThenThrowsConflict()
            {
                client.Post(new CreateSubscription
                {
                    Name   = "aname",
                    Events = new List <string> {
                        "anevent1", "anevent2"
                    },
                    Config = new SubscriptionConfig
                    {
                        Url = "http://localhost:3333"
                    }
                });

                Assert.That(() => client.Post(new CreateSubscription
                {
                    Name   = "aname",
                    Events = new List <string> {
                        "anevent3", "anevent2"
                    },
                    Config = new SubscriptionConfig
                    {
                        Url = "http://localhost:3333"
                    }
                }), ThrowsWebServiceException.WithStatusCode(HttpStatusCode.Conflict));
            }
 public void WhenSearchSubscriptions_ThenThrowsForbidden()
 {
     Assert.That(() => client.Get(new SearchSubscriptions
     {
         EventName = "aneventname"
     }), ThrowsWebServiceException.WithStatusCode(HttpStatusCode.Forbidden));
 }
 public void WhenUpdateSubscription_ThenThrowsForbidden()
 {
     Assert.That(() => client.Put(new UpdateSubscription
     {
         Id = DataFormats.CreateEntityIdentifier()
     }), ThrowsWebServiceException.WithStatusCode(HttpStatusCode.Forbidden));
 }
 public void WhenUpdateSubscriptionWithUnknownId_ThenThrowsNotFound()
 {
     Assert.That(() => client.Put(new UpdateSubscription
     {
         Id = DataFormats.CreateEntityIdentifier()
     }), ThrowsWebServiceException.WithStatusCode(HttpStatusCode.NotFound));
 }
            public void WhenDeleteSubscription_ThenDeletesSubscription()
            {
                var subscription = client.Post(new CreateSubscription
                {
                    Name   = "aname",
                    Events = new List <string> {
                        "anevent1"
                    },
                    Config = new SubscriptionConfig
                    {
                        Url = "http://localhost:3333"
                    }
                }).Subscriptions
                                   .First();

                client.Delete(new DeleteSubscription
                {
                    Id = subscription.Id
                });

                Assert.That(() => client.Get(new GetSubscription
                {
                    Id = subscription.Id
                }), ThrowsWebServiceException.WithStatusCode(HttpStatusCode.NotFound));
            }
 public void WhenCreateSubscriptionWithNullConfig_ThenThrowsBadRequest()
 {
     Assert.That(() => client.Post(new CreateSubscription
     {
         Name   = "aname",
         Events = new List <string> {
             "aneventname"
         },
         Config = null
     }), ThrowsWebServiceException.WithStatusCode(HttpStatusCode.BadRequest));
 }
 public void WhenCreateSubscriptionWithNullEvents_ThenThrowsBadRequest()
 {
     Assert.That(() => client.Post(new CreateSubscription
     {
         Name   = "aname",
         Events = null,
         Config = new SubscriptionConfig
         {
             Url = "http://localhost:3333"
         }
     }), ThrowsWebServiceException.WithStatusCode(HttpStatusCode.BadRequest));
 }
 public void WhenCreateSubscription_ThenThrowsForbidden()
 {
     Assert.That(() => client.Post(new CreateSubscription
     {
         Name   = "aname",
         Events = new List <string> {
             "anevent1", "anevent2"
         },
         Config = new SubscriptionConfig
         {
             Url = "http://localhost:3333"
         }
     }), ThrowsWebServiceException.WithStatusCode(HttpStatusCode.Forbidden));
 }
 public void WhenListSubscription_ThenThrowsForbidden()
 {
     Assert.That(() => client.Get(new ListSubscriptions()), ThrowsWebServiceException.WithStatusCode(HttpStatusCode.Forbidden));
 }
 public void WhenUpdateSubscriptionHistory_ThenThrowsForbidden()
 {
     Assert.That(() => client.Put(new UpdateSubscriptionHistory()), ThrowsWebServiceException.WithStatusCode(HttpStatusCode.Forbidden));
 }