public void CreateCampaign_HappyPath()
        {
            //given
            Campaign createdCampaign = _campaignService.AddCampaign(TestCampaign);

            Assert.NotNull(createdCampaign);
            Assert.NotEqual(createdCampaign.Id, Guid.Empty);
        }
示例#2
0
 public ActionResult CreateCampaign([Bind(Include = "CampaignId, CampaignName, CampaignDescription, CampaignDate, UserId, CampaignStatus")]  Campaign campaign)
 {
     if (Session["UserName"] != null)
     {
         string c = Session["UserName"].ToString();
         if (ModelState.IsValid)
         {
             campaign.CampaignId = cs.GetAllCampaigns().Count() + 1;
             User user = (from u in us.GetAllUsers()
                          where u.Username.Equals(c)
                          select u).FirstOrDefault <User>();
             campaign.UserId         = user.UserId;
             campaign.CampaignStatus = "not";
             cs.AddCampaign(campaign);
             //db.Campaigns.Add(campaign);
             //db.SaveChanges();
             return(RedirectToAction("Campaign"));
         }
         return(View(campaign));
     }
     else
     {
         return(RedirectToAction("Index"));
     }
 }
示例#3
0
        public async void AddCampagne_Click(object sender, EventArgs e)
        {
            var newCampagne = new Models.Campaign();

            newCampagne.Name = inputName.Text;
            await campagneService.AddCampaign(newCampagne);

            inputName.Text = null;
            LoadCampagne();
        }