public void FixtureSetup()
        {
            HttpClientMock = MockRepository.GenerateMock<IHttpClient>();
            Client = new RestSubscriptionClient(HttpClientMock);

            SubscriptionId = 1;
            SubscriptionFilter = new CfSubscriptionSubscriptionFilter(1, 5, "fromNumber", "toNumber", true);
            Subscription = new CfSubscription(SubscriptionId, true, "endPoint", CfNotificationFormat.Soap,
                CfSubscriptionTriggerEvent.CampaignStarted, SubscriptionFilter);
            SubscriptionRequest = new CfSubscriptionRequest("requestId", Subscription);

            var notificationFormat = EnumeratedMapper.ToSoapEnumerated<NotificationFormat>(Subscription.NotificationFormat.ToString());
            var triggerEvent = EnumeratedMapper.ToSoapEnumerated<SubscriptionTriggerEvent>(Subscription.TriggerEvent.ToString());

            HttpClientMock
                .Stub(j => j.Send(Arg<string>.Is.Equal(String.Format("/subscription/{0}", SubscriptionId)),
                    Arg<HttpMethod>.Is.Equal(HttpMethod.Put),
                    Arg<SubscriptionRequest>.Matches(x => x.RequestId == SubscriptionRequest.RequestId &&
                                                          x.Subscription.id == Subscription.Id &&
                                                          x.Subscription.Enabled == Subscription.Enabled &&
                                                          x.Subscription.Endpoint == Subscription.Endpoint &&
                                                          x.Subscription.NotificationFormat == notificationFormat &&
                                                          x.Subscription.TriggerEvent == triggerEvent &&
                                                          x.Subscription.SubscriptionFilter.BroadcastId == SubscriptionFilter.BroadcastId &&
                                                          x.Subscription.SubscriptionFilter.BatchId == SubscriptionFilter.BatchId &&
                                                          x.Subscription.SubscriptionFilter.FromNumber == SubscriptionFilter.FromNumber &&
                                                          x.Subscription.SubscriptionFilter.ToNumber == SubscriptionFilter.ToNumber &&
                                                          x.Subscription.SubscriptionFilter.Inbound == SubscriptionFilter.Inbound)))
                .Return(string.Empty);
        }
        public void FixtureSetup()
        {
            SubscriptionServiceMock = MockRepository.GenerateStub<ISubscriptionServicePortTypeClient>();
            Client = new SoapSubscriptionClient(SubscriptionServiceMock);

            SubscriptionId = 1;
            SubscriptionFilter = new CfSubscriptionSubscriptionFilter(1, 5, "fromNumber", "toNumber", true);
            Subscription = new CfSubscription(SubscriptionId, true, "endPoint", CfNotificationFormat.Soap, CfSubscriptionTriggerEvent.CampaignStarted, SubscriptionFilter);
            SubscriptionRequest = new CfSubscriptionRequest("requestId", Subscription);

            var notificationFormat = EnumeratedMapper.ToSoapEnumerated<NotificationFormat>(Subscription.NotificationFormat.ToString());
            var triggerEvent = EnumeratedMapper.ToSoapEnumerated<SubscriptionTriggerEvent>(Subscription.TriggerEvent.ToString());
            SubscriptionServiceMock.Stub(b => b.CreateSubscription(
                Arg<SubscriptionRequest>.Matches(x => x.RequestId == SubscriptionRequest.RequestId &&
                                                      x.Subscription.id == Subscription.Id &&
                                                      x.Subscription.Enabled == Subscription.Enabled &&
                                                      x.Subscription.Endpoint == Subscription.Endpoint &&
                                                      x.Subscription.NotificationFormat == notificationFormat &&
                                                      x.Subscription.TriggerEvent == triggerEvent &&
                                                      x.Subscription.SubscriptionFilter.BroadcastId == SubscriptionFilter.BroadcastId &&
                                                      x.Subscription.SubscriptionFilter.BatchId == SubscriptionFilter.BatchId &&
                                                      x.Subscription.SubscriptionFilter.FromNumber == SubscriptionFilter.FromNumber &&
                                                      x.Subscription.SubscriptionFilter.ToNumber == SubscriptionFilter.ToNumber &&
                                                      x.Subscription.SubscriptionFilter.Inbound == SubscriptionFilter.Inbound)))
                .Return(SubscriptionId);
        }
        public void FixtureSetup()
        {
            HttpClientMock = MockRepository.GenerateMock<IHttpClient>();
            Client = new RestSubscriptionClient(HttpClientMock);

            SubscriptionId = 14561;
            SubscriptionFilter = new CfSubscriptionSubscriptionFilter(1, 5, "fromNumber", "toNumber", true);
            Subscription = new CfSubscription(SubscriptionId, true, "endPoint", CfNotificationFormat.Soap,
                CfSubscriptionTriggerEvent.CampaignStarted, SubscriptionFilter);
            SubscriptionRequest = new CfSubscriptionRequest("requestId", Subscription);

            var notificationFormat = EnumeratedMapper.ToSoapEnumerated<NotificationFormat>(Subscription.NotificationFormat.ToString());
            var triggerEvent = EnumeratedMapper.ToSoapEnumerated<SubscriptionTriggerEvent>(Subscription.TriggerEvent.ToString());

            var response = string.Format("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" +
                        "<r:ResourceReference xmlns=\"http://api.callfire.com/data\" xmlns:r=\"http://api.callfire.com/resource\">" +
                              "<r:Id>{0}</r:Id>" +
                              "<r:Location>https://www.callfire.com/api/1.1/rest/subscription/{0}</r:Location>" +
                        "</r:ResourceReference>", SubscriptionId);

            HttpClientMock
                .Stub(j => j.Send(Arg<string>.Is.Equal("/subscription"), Arg<HttpMethod>.Is.Equal(HttpMethod.Post),
                    Arg<SubscriptionRequest>.Matches(x => x.RequestId == SubscriptionRequest.RequestId &&
                                                          x.Subscription.id == Subscription.Id &&
                                                          x.Subscription.Enabled == Subscription.Enabled &&
                                                          x.Subscription.Endpoint == Subscription.Endpoint &&
                                                          x.Subscription.NotificationFormat == notificationFormat &&
                                                          x.Subscription.TriggerEvent == triggerEvent &&
                                                          x.Subscription.SubscriptionFilter.BroadcastId == SubscriptionFilter.BroadcastId &&
                                                          x.Subscription.SubscriptionFilter.BatchId == SubscriptionFilter.BatchId &&
                                                          x.Subscription.SubscriptionFilter.FromNumber == SubscriptionFilter.FromNumber &&
                                                          x.Subscription.SubscriptionFilter.ToNumber == SubscriptionFilter.ToNumber &&
                                                          x.Subscription.SubscriptionFilter.Inbound == SubscriptionFilter.Inbound)))
                            .Return(response);
        }
Beispiel #4
0
 public CfSubscription(long?id, bool?enabled, string endpoint, CfNotificationFormat notificationFormat,
                       CfSubscriptionTriggerEvent?triggerEvent, CfSubscriptionSubscriptionFilter subscriptionFilter)
 {
     Id                 = id;
     Enabled            = enabled;
     Endpoint           = endpoint;
     NotificationFormat = notificationFormat;
     TriggerEvent       = triggerEvent;
     SubscriptionFilter = subscriptionFilter;
 }
        public void FixtureSetup()
        {
            SubscriptionServiceMock = MockRepository.GenerateStub<ISubscriptionServicePortTypeClient>();
            Client = new SoapSubscriptionClient(SubscriptionServiceMock);

            SubscriptionFilter = new CfSubscriptionSubscriptionFilter(1, 5, "fromNumber", "toNumber", true);
            Subscription = new CfSubscription(1, true, "endPoint", CfNotificationFormat.Soap,
                CfSubscriptionTriggerEvent.CampaignStarted, SubscriptionFilter);
            GenerateMock(Subscription, 1);

            var subscription = new CfSubscription(2, true, "endPoint", CfNotificationFormat.Soap,
                CfSubscriptionTriggerEvent.CampaignStarted, null);
            GenerateMock(subscription, 2);
        }
        public void FixtureSetup()
        {
            Client = new RestSubscriptionClient(MockClient.User(), MockClient.Password());

            var subscriptionFilter = new CfSubscriptionSubscriptionFilter(1, 5, "fromNumber", "toNumber", true);
            CfSubscription = new CfSubscription(1, true, "endPoint", CfNotificationFormat.Soap,
                CfSubscriptionTriggerEvent.CampaignStarted, subscriptionFilter);
            CfSubscriptionRequest = new CfSubscriptionRequest("", CfSubscription);

            QuerySubscription = new CfQuery();

            var subscription = new CfSubscription(140553001, true, "endPoint", CfNotificationFormat.Soap, 
                CfSubscriptionTriggerEvent.CampaignStopped, subscriptionFilter);
            CfUpdateSubscription = new CfSubscriptionRequest("", subscription);
        }
        public void FixtureSetup()
        {
            HttpClientMock = MockRepository.GenerateMock<IHttpClient>();
            Client = new RestSubscriptionClient(HttpClientMock);

            SubscriptionId = 1;
            SubscriptionFilter = new CfSubscriptionSubscriptionFilter(1, 5, "fromNumber", "toNumber", true);
            Subscription = new CfSubscription(SubscriptionId, true, "endPoint", CfNotificationFormat.Soap,
                CfSubscriptionTriggerEvent.CampaignStarted, SubscriptionFilter);
            GenerateMock(Subscription);

            SubscriptionId = 2;
            var subscription = new CfSubscription(SubscriptionId, true, "endPoint", CfNotificationFormat.Soap,
                CfSubscriptionTriggerEvent.CampaignStarted, null);
            GenerateMock(subscription);
        }
 public SubscriptionSubscriptionFilter(CfSubscriptionSubscriptionFilter source)
 {
     if (source.BroadcastId.HasValue)
     {
         BroadcastId = source.BroadcastId.Value;
         BroadcastIdSpecified = true;
     }
     if (source.BatchId.HasValue)
     {
         BatchId = source.BatchId.Value;
         BatchIdSpecified = true;
     }
     FromNumber = source.FromNumber;
     ToNumber = source.ToNumber;
     if (source.Inbound.HasValue)
     {
         Inbound = source.Inbound.Value;
         InboundSpecified = true;
     }
 }
        public void FixtureSetup()
        {
            SubscriptionServiceMock = MockRepository.GenerateStub<ISubscriptionServicePortTypeClient>();
            Client = new SoapSubscriptionClient(SubscriptionServiceMock);

            Query = new CfQuery(100, 0);

            SubscriptionFilter = new CfSubscriptionSubscriptionFilter(1, 5, "fromNumber", "toNumber", true);
            Subscription = new CfSubscription(1, true, "endPoint", CfNotificationFormat.Soap,
                CfSubscriptionTriggerEvent.CampaignStarted, SubscriptionFilter);

            var subscriptions = new CfSubscription[1];
            subscriptions[0] = Subscription;
            SubscriptionQueryResult = new CfSubscriptionQueryResult(1, subscriptions);

            GenerateMock(SubscriptionQueryResult, Query);

            subscriptions[0] = null;
            var subscriptionQueryResult = new CfSubscriptionQueryResult(1, subscriptions);
            var query = new CfQuery(100, 1);
            GenerateMock(subscriptionQueryResult, query);
        }
 public CfSubscription(long? id, bool? enabled, string endpoint, CfNotificationFormat notificationFormat,
     CfSubscriptionTriggerEvent? triggerEvent, CfSubscriptionSubscriptionFilter subscriptionFilter)
 {
     Id = id;
     Enabled = enabled;
     Endpoint = endpoint;
     NotificationFormat = notificationFormat;
     TriggerEvent = triggerEvent;
     SubscriptionFilter = subscriptionFilter;
 }
 internal static SubscriptionSubscriptionFilter ToSoapSubscriptionSubscriptionFilter(CfSubscriptionSubscriptionFilter source)
 {
     return source == null ? null : new SubscriptionSubscriptionFilter(source);
 }