public void AddNewActivity_ShouldAddThatToDb() { var newActivity = new Activity() { Name = "NewActivity", }; var result = _activityManager.AddActivity(newActivity); Assert.AreEqual(true, result); Assert.AreEqual("NewActivity", _activityManager.GetAllActivities().SingleOrDefault(n => n.Name == "NewActivity").Name); }
public ActionResult CreateSession(int id = 0) //activityId { var allActivities = _activityManager.GetAllActivities().OrderBy(n => n.Name).ToList(); var allSessionParticipants = _personManager.GetAllParticipants().OrderBy(n => n.FirstName).ToList(); var allHrPersons = _personManager.GetAllHrPersons().OrderBy(n => n.FirstName).ToList(); var selectedActivityId = (id == 0) ? allActivities.First().Id : id; ViewBag.AllActivities = new SelectList(allActivities, "Id", "Name", selectedActivityId); ViewBag.AllSessionParticipants = new SelectList( allSessionParticipants, "Id", "FullName", allSessionParticipants.Skip(1).First().Id); // TODO: TAKE AWAY SKIP ViewBag.AllHrPersons = new SelectList(allHrPersons, "Id", "FullName"); return(View()); }
public void CreateActivity_ShouldAddThatActivity() { // Arrange ActivityController controller = new ActivityController(_activityManager, _personManager, _utilityManager); var activityToAdd = new ActivityViewModel() { Name = "New Activity" }; // Act var controllerResult = controller.CreateActivity(activityToAdd); var expected = _activityManager.GetAllActivities().SingleOrDefault(n => n.Name == "New Activity"); // Assert Assert.AreEqual(expected.Name, activityToAdd.Name); }
public async Task <ActionResult <IEnumerable <ActivitiesDTO> > > GetActivities() => await _context.GetAllActivities();