本文整理汇总了C#中ApiClient.DeleteSurvey方法的典型用法代码示例。如果您正苦于以下问题:C# ApiClient.DeleteSurvey方法的具体用法?C# ApiClient.DeleteSurvey怎么用?C# ApiClient.DeleteSurvey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ApiClient
的用法示例。
在下文中一共展示了ApiClient.DeleteSurvey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create_And_Delete_Survey_And_Campaign_Json
//.........这里部分代码省略.........
var allSurveys = apiClient.GetAllSurveys();
Assert.IsTrue(allSurveys.Any(s => s.title == title));
// get survey
var survey = apiClient.GetSurvey(surveyId);
Assert.IsNotNull(survey);
Assert.AreEqual(surveyId, survey.id);
Assert.AreEqual(title, survey.title);
Assert.AreEqual("Launched", survey.status);
// create "master" campaign
var masterCampaignName = "Master";
var masterCampaignId = apiClient.CreateCampaign(surveyId, masterCampaignName);
Assert.IsTrue(masterCampaignId > 0);
// create campaign that is a copy of the "master" campaign
var campaignName = "Campaign " + testStartedAt;
var campaignId = apiClient.CreateCampaign(surveyId, campaignName, masterCampaignId);
Assert.IsTrue(campaignId > 0);
// check if the campaign is returned in the list of all campaigns
var campaigns = apiClient.GetCampaigns(surveyId);
Assert.IsNotNull(campaigns);
campaigns = campaigns.Where(c => c._subtype == "email").ToList();
// 2 email campaigns expected
Assert.AreEqual(2, campaigns.Count);
Assert.IsTrue(campaigns.Any(c => c.status == "Active" && c.name == campaignName && c.id == campaignId));
// get the campaign
var campaign = apiClient.GetCampaign(surveyId, campaignId);
Assert.IsNotNull(campaign);
Assert.AreEqual(campaignName, campaign.name);
Assert.AreEqual("Active", campaign.status);
Assert.AreEqual(campaignId, campaign.id);
// get the email messages for the campaign
var emailMessages = apiClient.GetEmailMessageList(surveyId, campaignId);
Assert.IsNotNull(emailMessages);
Assert.AreEqual(1, emailMessages.Count);
Assert.IsNotNull(emailMessages[0]);
Assert.IsNotNull(emailMessages[0].from);
Assert.IsNotNull(emailMessages[0].from.name);
// Survey Research is the default value for the "From" name
Assert.AreEqual("Survey Research", emailMessages[0].from.name);
// update the "From" name on the email message
var updatedFromName = "Updated " + testStartedAt;
emailMessages[0].from.name = updatedFromName;
var nameWasUpdated = apiClient.UpdateEmailMessage(surveyId, campaignId, emailMessages[0]);
Assert.IsTrue(nameWasUpdated);
// get the campaign again to verify that the name was actually updated
emailMessages = apiClient.GetEmailMessageList(surveyId, campaignId);
Assert.IsNotNull(emailMessages);
Assert.AreEqual(1, emailMessages.Count);
Assert.IsNotNull(emailMessages[0]);
Assert.IsNotNull(emailMessages[0].from);
Assert.IsNotNull(emailMessages[0].from.name);
Assert.AreEqual(updatedFromName, emailMessages[0].from.name);
// update the campaign name
var updatedCampaignName = campaignName + " Updated";
campaign.name = updatedCampaignName;
var campaignNameUpdatedSuccess = apiClient.UpdateCampaign(surveyId, campaign);
Assert.IsTrue(campaignNameUpdatedSuccess);
// get the campaign again to verify that the name was updated
campaign = apiClient.GetCampaign(surveyId, campaignId);
Assert.AreEqual(updatedCampaignName, campaign.name);
// create contact
var datetime = testStartedAt.ToString("yyyyMMddHHmmss");
var contactId = apiClient.CreateContact(surveyId, campaignId, "test_" + datetime + "@tntp.org", "John", "Doe", "Test Organization");
Assert.IsTrue(contactId > 0);
// verify that the contact is in the list of contacts
var campaignContactList = apiClient.GetCampaignContactList(surveyId, campaignId);
Assert.AreEqual(1, campaignContactList.Count);
Assert.IsTrue(campaignContactList.Any(c => c.id == contactId));
// update contact
var updated = apiClient.UpdateContact(surveyId, campaignId, contactId, null, null, "Smith");
Assert.IsTrue(updated);
// delete contact
var deleted = apiClient.DeleteContact(surveyId, campaignId, contactId);
Assert.IsTrue(deleted);
// delete master campaign
var campaignDeleted = apiClient.DeleteCampaign(surveyId, masterCampaignId);
Assert.IsTrue(campaignDeleted);
// delete campaign
campaignDeleted = apiClient.DeleteCampaign(surveyId, campaignId);
Assert.IsTrue(campaignDeleted);
// delete survey
var surveyDeleted = apiClient.DeleteSurvey(surveyId);
Assert.IsTrue(surveyDeleted);
}