示例#1
0
        public void CanCreateUpdateAndRetrieveSubscriber()
        {
            var expected = subscriberFactoryFixture.CreateComplexUniqueModifyDripSubscriber();

            var result = dripClientFixture.Client.CreateOrUpdateSubscriber(expected);

            DripAssert.Success(result, HttpStatusCode.OK);

            result = dripClientFixture.Client.GetSubscriber(expected.Email);
            DripAssert.Success(result, HttpStatusCode.OK);
            Assert.Equal(1, result.Subscribers.Count);

            var actual = result.Subscribers.First();

            DripAssert.Equal(expected.CustomFields, actual.CustomFields);
            DripAssert.ContainsSameItems(expected.Tags, actual.Tags);

            var oldEmail = expected.Email;

            expected.NewEmail = subscriberFactoryFixture.GetRandomEmailAddress();
            result            = dripClientFixture.Client.CreateOrUpdateSubscriber(expected);
            Assert.True(result.HasSuccessStatusCode());
            Assert.False(result.HasErrors());

            result = dripClientFixture.Client.GetSubscriber(expected.NewEmail);
            DripAssert.Success(result, HttpStatusCode.OK);
            Assert.Equal(1, result.Subscribers.Count);

            actual = result.Subscribers.First();
            Assert.Equal(expected.NewEmail, actual.Email);
            DripAssert.Equal(expected.CustomFields, actual.CustomFields);
            DripAssert.ContainsSameItems(expected.Tags, actual.Tags);
        }
示例#2
0
        public void CanTrackEventForNewUser()
        {
            //event for brand new subscriber
            var newSubscriber = subscriberFactoryFixture.GetRandomEmailAddress();
            var result        = dripClientFixture.Client.TrackEvent(new DripEvent {
                Action = "hello", Email = newSubscriber
            });

            DripAssert.Success(result, HttpStatusCode.NoContent);

            var subscriberResult = dripClientFixture.Client.GetSubscriber(newSubscriber);

            DripAssert.Success(subscriberResult);
        }
示例#3
0
        public void ApplyingTagCreatesSubscriber()
        {
            var email  = subscriberFactoryFixture.GetRandomEmailAddress();
            var tag    = Guid.NewGuid().ToString();
            var result = dripClientFixture.Client.ApplyTagToSubscriber(email, tag);

            DripAssert.Success(result, HttpStatusCode.Created);

            var subscriberResult = dripClientFixture.Client.GetSubscriber(email);

            DripAssert.Success(subscriberResult);

            var newSubscriber = subscriberResult.Subscribers.First();

            Assert.True(newSubscriber.Tags.Contains(tag));
        }
        public void CanSubscribeNewSubscriberToCampaignAndThenUnsubscribeFromAll()
        {
            var newSubscriber   = subscriberFactoryFixture.GetRandomEmailAddress();
            var campaignRequest = new ModifyDripCampaignSubscriberRequest {
                Email = newSubscriber
            };
            var result = dripClientFixture.Client.SubscribeToCampaign(TestCampaignId, campaignRequest);

            DripAssert.Success(result, HttpStatusCode.Created);

            var subscriberResult = dripClientFixture.Client.GetSubscriber(newSubscriber);

            DripAssert.Success(subscriberResult);

            subscriberResult = dripClientFixture.Client.UnsubscribeFromCampaign(newSubscriber);
            //TODO: this is a mismatch with the docs. Docs say it will be "200 OK"
            DripAssert.Success(result, HttpStatusCode.Created);
        }