public void PostDnclistsTest() { // TODO: add unit test for the method 'PostDnclists' DncList body = null; // TODO: replace null with proper value var response = instance.PostDnclists(body); Assert.IsInstanceOf <DncList> (response, "response is DncList"); }
public void PutDnclistsDnclistIdTest() { // TODO: add unit test for the method 'PutDnclistsDnclistId' string dncListId = null; // TODO: replace null with proper value DncList body = null; // TODO: replace null with proper value var response = instance.PutDnclistsDnclistId(dncListId, body); Assert.IsInstanceOf <DncList> (response, "response is DncList"); }
public void GetDnc() { string expectedJson = GetJsonPayload("/contacts/dncApi/response/getDncList.json"); var restRequest = MockRestResponse(expectedJson); DncList dncList = Client.DncListsApi.Get(TEST_LONG, FIELDS); Assert.NotNull(dncList); Assert.That(Serializer.Serialize(dncList), Is.EqualTo(expectedJson)); Assert.AreEqual(Method.GET, restRequest.Value.Method); Assert.That(restRequest.Value.Parameters, Has.Some.Matches <Parameter>(p => p.Name.Equals("fields") && p.Value.Equals(FIELDS))); }
public void Create() { string requestJson = GetJsonPayload("/contacts/dncApi/request/createDncList.json"); string responseJson = GetJsonPayload("/contacts/dncApi/response/createDncList.json"); var restRequest = MockRestResponse(responseJson); DncList dncList = new DncList { Id = TEST_LONG, CampaignId = TEST_LONG, Size = unchecked ((int)TEST_LONG), Name = TEST_STRING }; ResourceId res = Client.DncListsApi.Create(dncList); Assert.That(Serializer.Serialize(res), Is.EqualTo(responseJson)); Assert.AreEqual(Method.POST, restRequest.Value.Method); var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.That(requestBodyParam.Value, Is.EqualTo(requestJson)); }
public void TestDncContactListWithItemsCRUD() { //test add and get dnc list DncList dncList = new DncList { Name = "dncList1" }; ResourceId dncListId = Client.DncListsApi.Create(dncList); DncList created = Client.DncListsApi.Get(dncListId.Id); Assert.AreEqual("dncList1", created.Name); Assert.Greater(created.Created, DateTime.Now.AddMinutes(-3)); //test find dnc list FindDncListsRequest findRequest = new FindDncListsRequest { Name = "dncList1" }; Page <DncList> doNotCallLists = Client.DncListsApi.Find(findRequest); Assert.Greater(doNotCallLists.TotalCount, 0); Console.WriteLine("Page of dnc list:" + doNotCallLists); //test add dnc list items DoNotContact dnc1 = new DoNotContact { Number = "12135543211", Text = true, Call = false }; DoNotContact dnc2 = new DoNotContact { Number = "12135543212", Text = true, Call = false }; DoNotContact dnc3 = new DoNotContact { Number = "12135543213", Text = true, Call = false }; AddDncListItemsRequest <DoNotContact> addItemsRequest = new AddDncListItemsRequest <DoNotContact> { ContactListId = dncListId.Id, Contacts = new List <DoNotContact> { dnc1, dnc2, dnc3 } }; Client.DncListsApi.AddListItems(addItemsRequest); //test get dnc list items GetByIdRequest getItemsRequest = new GetByIdRequest { Id = dncListId.Id }; Page <DoNotContact> dncListItems = Client.DncListsApi.GetListItems(getItemsRequest); IList <DoNotContact> items = dncListItems.Items; Assert.AreEqual(3, items.Count); //test remove dnc list items Client.DncListsApi.RemoveListItem(dncListId.Id, "12135543211"); dncListItems = Client.DncListsApi.GetListItems(getItemsRequest); items = dncListItems.Items; Assert.AreEqual(2, items.Count); Client.DncListsApi.RemoveListItems(dncListId.Id, new List <string> { "12135543212", "12135543213" }); dncListItems = Client.DncListsApi.GetListItems(getItemsRequest); Assert.AreEqual(null, dncListItems.Items); Assert.AreEqual(0, dncListItems.TotalCount); // test delete dnc list Client.DncListsApi.Delete(dncListId.Id); // test get UniversalDncNumber IList <UniversalDnc> universalDncNumber = Client.DncListsApi.GetUniversalDncNumber("12135543212"); Console.WriteLine("universal:" + universalDncNumber); }
public void Init() { instance = new DncList(); }
/// <summary> /// Create do not contact (DNC) list. /// </summary> /// <param name="dncList">list to create</param> /// <returns>newly created dnc list id</returns> /// <exception cref="BadRequestException"> in case HTTP response code is 400 - Bad request, the request was formatted improperly.</exception> /// <exception cref="UnauthorizedException"> in case HTTP response code is 401 - Unauthorized, API Key missing or invalid.</exception> /// <exception cref="AccessForbiddenException"> in case HTTP response code is 403 - Forbidden, insufficient permissions.</exception> /// <exception cref="ResourceNotFoundException"> in case HTTP response code is 404 - NOT FOUND, the resource requested does not exist.</exception> /// <exception cref="InternalServerErrorException"> in case HTTP response code is 500 - Internal Server Error.</exception> /// <exception cref="CallfireApiException"> in case HTTP response code is something different from codes listed above.</exception> /// <exception cref="CallfireClientException"> in case error has occurred in client.</exception> public ResourceId Create(DncList dncList) { return(Client.Post <ResourceId>(DNC_LISTS_PATH, dncList)); }