public void CreateCampaign() { //Act //IFacebookClient client = new FacebookClient("2.9", "1057652130914324", "9ffc28c2a12d447cb5132995656ac92c", "client_credentials"); IFacebookClient client = new FacebookClient("2.9", "EAANOERzv1jEBAHr5S7bGsX8G6fht6BE8NEm2tOAcI8k6tWTIA1GzwSlOh1U9ZAghSIivmmMtZBYlkaIQGV3FXAaK6e6R3WH1rxmGgo2UPLcts2v5TLH3ccUtEZAN1UDZBABLmd85x1EmcG1sJaywpxA0VZCa76j8ZD"); //Services ICampaignService campaignService = new CampaignService(client); //The Campaign Test Campaign model = new Campaign(); model.Name = "Test from new API Engagement"; model.Status = JAM.Facebook.Models.Enums.Status.PAUSED; model.Objective = JAM.Facebook.Models.Enums.Objective.POST_ENGAGEMENT; model.SpendCap = 10000; var response = campaignService.Create("10155310538728783", model); Assert.AreNotSame("", response); }
public void Create_GivenValidModel_ReturnSuccess() { _repository.Setup(c => c.Add(It.IsAny <Campaign>())); _context.Setup(c => c.CampaignRepository).Returns(_repository.Object); var service = new CampaignService(_context.Object, _timeService.Object); var data = new CampaignDto { Name = "Phone Campaign", ProductCode = "P11", Duration = 10, PriceManipulationLimit = 20, TargetSalesCount = 1000 }; var response = service.Create(data); Assert.NotNull(response); Assert.True(response.Success); }
public int CreateCampaign(string accessId, CampaignDTO campaignDTO) { try { return(CampaignService.Create(campaignDTO)); } catch (TimeoutException) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.RequestTimeout) { Content = new StringContent("An error occurred, please try again or contact the administrator."), ReasonPhrase = "Critical Exception" }); } catch (Exception) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError) { Content = new StringContent("An error occurred, please try again or contact the administrator."), ReasonPhrase = "Critical Exception" }); } }
public void CreateCampaignService() { var uow = new UnitOfWork(new DigitalSignageDbContext("Test")); CampaignService cS = new CampaignService(); CampaignDTO campaignDTO = new CampaignDTO(); campaignDTO.Name = "nueva campaña"; campaignDTO.Description = "qsy"; campaignDTO.InitDate = new DateTime().AddYears(2018); campaignDTO.EndDate = new DateTime().AddYears(2018); campaignDTO.InitTime = new TimeSpan(); campaignDTO.EndTime = new TimeSpan(); try { cS.Create(campaignDTO); } catch (Exception e) { Assert.Fail(e.Message); } }
public async Task <ActionResult <Campaign> > Create([FromBody] Campaign new_capaign) { await _campaignService.Create(new_capaign); return(CreatedAtRoute("Get", new { id = new_capaign.Id.ToString() }, new_capaign)); }
public ActionResult <Campaign> Create(Campaign campaign) { _campaignService.Create(campaign); return(CreatedAtRoute("CreateCampaign", new { id = campaign.Id.ToString() }, campaign)); }