pipedrive-dotnet icon indicating copy to clipboard operation
pipedrive-dotnet copied to clipboard

Adding MarketingStatus field to Person and PersonUpdate, allowing you…

Open andyb1979 opened this issue 3 years ago • 0 comments

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?

andyb1979 avatar Sep 28 '22 17:09 andyb1979