diff --git a/DripDotNet/Resources/DripSubscriber.cs b/DripDotNet/Resources/DripSubscriber.cs index 9085c54..53fca7a 100644 --- a/DripDotNet/Resources/DripSubscriber.cs +++ b/DripDotNet/Resources/DripSubscriber.cs @@ -39,6 +39,11 @@ public class DripSubscriber /// public string Email { get; set; } + /// + /// The subscriber's user id (a unique identifier for the user, such as a primary key). + /// + public string UserId { get; set; } + /// /// The subscriber's time zone (in Olsen format). Defaults to Etc/UTC /// @@ -108,6 +113,11 @@ public class ModifyDripSubscriberRequest /// public string Email { get; set; } + /// + /// The subscriber's user id (a unique identifier for the user, such as a primary key). + /// + public string UserId { get; set; } + /// /// The subscriber's time zone (in Olsen format). Defaults to Etc/UTC /// diff --git a/DripDotNetTests/CampaignTests.cs b/DripDotNetTests/CampaignTests.cs index fa432db..b721eaa 100644 --- a/DripDotNetTests/CampaignTests.cs +++ b/DripDotNetTests/CampaignTests.cs @@ -35,7 +35,7 @@ namespace DripDotNetTests public class CampaignTests: IClassFixture, IClassFixture { //TODO: put this in a configuration file - const string TestCampaignId = "3057996"; //This is a test campaign in my test account + const string TestCampaignId = "3057996"; //This is a test campaign in my test account. Replace this with a Campaign Id from your account before running tests. DripClientFixture dripClientFixture; SubscriberFactoryFixture subscriberFactoryFixture; diff --git a/DripDotNetTests/SubscriberFactoryFixture.cs b/DripDotNetTests/SubscriberFactoryFixture.cs index fc9b7e9..db91dce 100644 --- a/DripDotNetTests/SubscriberFactoryFixture.cs +++ b/DripDotNetTests/SubscriberFactoryFixture.cs @@ -44,6 +44,7 @@ public ModifyDripSubscriberRequest CreateComplexUniqueModifyDripSubscriber() var result = new ModifyDripSubscriberRequest { Email = GetRandomEmailAddress(), + UserId = IntUtil.Random(1001,9999).ToString(), CustomFields = new Dictionary { {"id", Guid.NewGuid().ToString("n")}, @@ -70,4 +71,23 @@ public void Dispose() { } } + + /* + This support class is used to generate a random integer for the UserId field. + */ + public static class IntUtil + { + private static Random random; + + private static void Init() + { + if (random == null) random = new Random(); + } + + public static int Random(int min, int max) + { + Init(); + return random.Next(min, max); + } + } } diff --git a/DripDotNetTests/SubscriberTests.cs b/DripDotNetTests/SubscriberTests.cs index 48ad3d1..968cd80 100644 --- a/DripDotNetTests/SubscriberTests.cs +++ b/DripDotNetTests/SubscriberTests.cs @@ -56,6 +56,7 @@ public void CanCreateUpdateAndRetrieveSubscriber() Assert.Equal(1, result.Subscribers.Count); var actual = result.Subscribers.First(); + Assert.Equal(expected.UserId, actual.UserId); DripAssert.Equal(expected.CustomFields, actual.CustomFields); DripAssert.ContainsSameItems(expected.Tags, actual.Tags); @@ -90,6 +91,7 @@ public async Task CanCreateUpdateAndRetrieveSubscriberAsync() var actual = result.Subscribers.First(); Assert.Equal(expected.Email, actual.Email); + Assert.Equal(expected.UserId, actual.UserId); DripAssert.Equal(expected.CustomFields, actual.CustomFields); DripAssert.ContainsSameItems(expected.Tags, actual.Tags);