Skip to content

Conversation

andyb1979
Copy link

@andyb1979 andyb1979 commented Sep 28, 2022

Very small change to allow get/set of MarketingStatus.

We are populating a CRM after signup from a website and need to set MarketingStatus to subscribed. For our own IntegrationTest purposes I'd like to be able to get MarketingStatus as well

Integration tests need to be added, for example I have two persons, one unsubscribed and one subscribed. This test allows me to get and update the statuses:

[IntegrationTest]
public async Task CanRetrievePersonMarketingStatus()
{
    var pipedrive = Helper.GetAuthenticatedClient();

    // Assume person with Id 123 exists and has status subscribed
    var person = await pipedrive.Person.Get(123);

    Assert.Equal("[email protected]", person.Email[0].Value);
    Assert.Equal("subscribed", person.MarketingStatus);

    // Assume person with Id 456 exists and has status no_consent
    var person2 = await pipedrive.Person.Get(456);

    Assert.Equal("[email protected]", person2.Email[0].Value);
    Assert.Equal("no_consent", person2.MarketingStatus);

    // Update person 456 
    var data = person2.ToUpdate();
    Assert.Equal(data.MarketingStatus, "no_consent");
    data.MarketingStatus = "subscribed";

    var person2Updated = await pipedrive.Person.Edit(person2.Id, data);
    Assert.Equal("subscribed", person2Updated.MarketingStatus);
}

Now question how to reset that status for the next test. Personally I'd set it back in teardown or create the person for the test. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants