Beispiel #1
0
        public void addLoadedCampaign(string name, string t, string currentDate)
        {
            // since the constructor of campaign requires start date (then adds a note of start date)
            // we have to start a blank campaign and add to that, kinda gross but whatev
            Campaign loadedCampaign = new Campaign(IDManager);

            loadedCampaign.Name        = name;
            loadedCampaign.Tag         = t;
            loadedCampaign.CurrentDate = currentDate;
            CampaignList.Add(loadedCampaign);
        }
 public ActionResult CreateEdit(Campaign campaign)
 {
     if (ModelState.IsValid)
     {
         if (campaign.Id > 0)
         {
             campaignList.Update(campaign);
         }
         else
         {
             campaignList.Add(campaign);
         }
         return(RedirectToAction("Index"));
     }
     return(View(nameof(CreateEdit), campaign));
 }
Beispiel #3
0
        public void When_add_new_campaign_then_it_exists_in_db()
        {
            var campaign = new Campaign()
            {
                Id = 12345
            };

            repoMock
            .Setup(r => r.Get(It.IsAny <int>()))
            .Returns(campaign);
            repoMock
            .Setup(r => r.Add(It.IsAny <Campaign>()));

            campaignList.Add(campaign);

            repoMock.Verify(r => r.Add(It.IsAny <Campaign>()), Times.Once);
        }
Beispiel #4
0
        public void addNewCampaign(string name, string t, string startDate)
        {
            Campaign newCampaign = new Campaign(name, t, startDate, IDManager);

            CampaignList.Add(newCampaign);
        }
Beispiel #5
0
 public void AddCampaign(Campaign c)
 {
     CampaignList.Add(c);
 }