private void LoadGoals() { var list = new GoalServices().GetByReviewID(Convert.ToInt32(HttpContext.Current.Request.Url.Segments[HttpContext.Current.Request.Url.Segments.Count() - 1])); dlComments.DataSource = list; dlComments.DataBind(); }
public void Test_UpsertGoalsService_Exception() { var goalsService = new GoalServices(_goalsRepository.Object); Assert.ThrowsAsync <Exception>(() => goalsService.UpsertGoalsService(new List <GoalModel>() { new GoalModel() { Id = 1, Amount = 5, TargetAmount = 50, GoalName = "Name", GoalSummary = "Summary", StartDate = DateTime.Now, EndDate = DateTime.Now }, new GoalModel() { Id = 1, UserId = 5, Amount = 5, TargetAmount = 50, GoalName = "Name", GoalSummary = "Summary", StartDate = DateTime.Now, EndDate = DateTime.Now } } )); _goalsRepository.Verify(g => g.UpsertGoals(It.IsAny <List <Goal> >()), Times.Never); }
public async Task Test_UpsertGoalsService_Success() { _goalsRepository.Setup(g => g.UpsertGoals(It.IsAny <List <Goal> >())) .Returns(Task.CompletedTask); var goalsService = new GoalServices(_goalsRepository.Object); await goalsService.UpsertGoalsService(new List <GoalModel>() { new GoalModel() { Id = 1, UserId = 5, Amount = 5, TargetAmount = 50, GoalName = "Name", GoalSummary = "Summary", StartDate = DateTime.Now, EndDate = DateTime.Now }, new GoalModel() { Id = 1, UserId = 5, Amount = 5, TargetAmount = 50, GoalName = "Name", GoalSummary = "Summary", StartDate = DateTime.Now, EndDate = DateTime.Now } } ); _goalsRepository.Verify(g => g.UpsertGoals(It.IsAny <List <Goal> >()), Times.Once); }
protected async Task DeleteGoal(GoalViewModel goal) { System.Console.WriteLine($"Deleting goal {goal.Id}"); await GoalServices.DeleteAsync(goal); await OnInitializedAsync(); }
private GoalServices CreateGoalServices() { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new GoalServices(userId); return(service); }
// GET: Goal public ActionResult Index() { var userId = Guid.Parse(User.Identity.GetUserId()); var service = new GoalServices(userId); var model = service.GetGoals(); return(View(model)); }
// GET: AddItem public AddItemController() { _teamServices = new TeamServices(); _workstreamServices = new WorkstreamServices(); _categoryServices = new CategoryServices(); _subCategoryServices = new SubcategoryServices(); _goalServices = new GoalServices(); }
public void Test_UpsertGoalsService_BadArgument() { var goalsService = new GoalServices(_goalsRepository.Object); Assert.ThrowsAsync <ArgumentException>(() => goalsService.UpsertGoalsService(null)); _goalsRepository.Verify(g => g.UpsertGoals(It.IsAny <List <Goal> >()), Times.Never); }
public void UpdateGoalWeight(IList <GoalWeight> weights) { foreach (var w in weights) { var goal = new GoalServices().GetByID(w.ID); goal.Weight = w.Weight; new GoalServices().Save(goal); } }
public async Task Test_GetGoalsService_Success() { _goalsRepository.Setup(g => g.GetGoals(It.IsAny <long>())) .ReturnsAsync(new List <Goal>()); var goalsService = new GoalServices(_goalsRepository.Object); await goalsService.GetGoalsService(1); _goalsRepository.Verify(g => g.GetGoals(It.IsAny <long>()), Times.Once); }
public void Test_GetGoalsService_Exception() { _goalsRepository.Setup(g => g.GetGoals(It.IsAny <long>())); var goalsService = new GoalServices(_goalsRepository.Object); Assert.ThrowsAsync <Exception>(() => goalsService.GetGoalsService(1)); _goalsRepository.Verify(g => g.GetGoals(It.IsAny <long>()), Times.Once); }
protected async Task SaveGoal() { System.Console.WriteLine($"Saving goal {CurrentGoal.Id.ToString()}"); await GoalServices.SaveAsync(CurrentGoal, Updating); // Refresh list and reset the form Updating = false; CurrentGoal = new GoalViewModel(); await OnInitializedAsync(); }
public void Test_GetGoalsService_ArgumentException() { _goalsRepository.Setup(g => g.GetGoals(It.IsAny <long>())) .ReturnsAsync(new List <Goal>()); var goalsService = new GoalServices(_goalsRepository.Object); Assert.ThrowsAsync <ArgumentException>(() => goalsService.GetGoalsService(0)); _goalsRepository.Verify(g => g.GetGoals(It.IsAny <long>()), Times.Never); }
private void LoadTemplates() { PagedDataSource pd = new PagedDataSource(); var list = new GoalServices().GetTemplates().OrderBy(o => o.DateCreated).ToList <Goal>(); pd.DataSource = list; pd.AllowPaging = true; pd.PageSize = 50; pd.CurrentPageIndex = CurrentPage; lblCurrentPage.Text = "Page: " + (CurrentPage + 1).ToString() + " of " + pd.PageCount.ToString(); cmdPrev.Enabled = !pd.IsFirstPage; cmdNext.Enabled = !pd.IsLastPage; dlPeople.DataSource = pd; dlPeople.DataBind(); }
protected void DeleteGoalClicked(object o, EventArgs e) { var goal = new GoalServices().GetByID(Convert.ToInt32(((LinkButton)o).Attributes["itemid"])); foreach (var milestone in goal.Milestones) { new GoalMilestoneServices().Delete(milestone); } foreach (var subscriber in goal.Managers) { new GoalManagerServices().Delete(subscriber); } foreach (var note in goal.Communication) { new GoalCommunicationServices().Delete(note); } new GoalServices().Delete(goal); Response.Redirect(SecurityContextManager.Current.CurrentURL); }
protected void DeleteGoalClicked(object o, EventArgs e) { var item = (IdeaSeed.Web.UI.LinkButton)o; var goal = new GoalServices().GetByID(Convert.ToInt32(item.Attributes["itemid"])); foreach (var ms in new GoalMilestoneServices().GetByGoalID(goal.ID)) { new GoalMilestoneServices().Delete(ms); } foreach (var communication in new GoalCommunicationServices().GetByGoalID(goal.ID)) { new GoalCommunicationServices().Delete(communication); } foreach (var manager in new GoalManagerServices().GetByGoalID(goal.ID)) { new GoalManagerServices().Delete(manager); } new GoalServices().Delete(goal); LoadGoals(); }
public GoalsBase(GoalServices goalServices) { GoalServices = goalServices; }
protected override async Task OnInitializedAsync() { Goals = (await GoalServices.GetAllAsync()).ToList(); }