Example #1
0
        private static void VerifyPriority(string levelString, string levelPriorityString)
        {
            levelPriorityString = levelPriorityString.Substring(2, levelPriorityString.Length - 2);

            Level           level                = TestTools.StringToLevel(levelString);
            GraphSearchData gsData               = new GraphSearchData(level);
            GoalGraph       goalGraph            = new GoalGraph(gsData, level.InitialState, level);
            var             actualGoalPriority   = new GoalPriority(level, goalGraph, new CancellationToken());
            var             actualPriorityString = actualGoalPriority.ToLevelString(level);

            string expectedLevel = TestTools.RemoveInvisibleCharacters(levelPriorityString);
            string actualLevel   = TestTools.RemoveInvisibleCharacters(actualPriorityString);

            Assert.IsTrue(expectedLevel == actualLevel, $"{Environment.NewLine}Expected:{Environment.NewLine}{levelPriorityString}{Environment.NewLine}{Environment.NewLine}Actual:{Environment.NewLine}{actualPriorityString}");
        }
Example #2
0
        public async Task UpdateTitleTest(string title, string description,
                                          int goalNumber, int projectId, GoalState state, GoalPriority priority)
        {
            //Arrange
            int goalId = 1;
            var vmGoal = new VmGoal
            {
                Id          = goalId,
                Title       = title,
                Description = description,
                ProjectId   = projectId,
                State       = state,
                Priority    = priority,
                GoalNumber  = goalNumber,
                IsRemoved   = true
            };

            //Act
            await _service.Update(_currentUser, vmGoal);

            var goal = _dataContext.Goals.First(g => g.Id == goalId);

            //Assert
            Assert.AreEqual(title, goal.Title);
            Assert.AreEqual(description, goal.Description);
            Assert.AreEqual(projectId, goal.ProjectId);
            Assert.AreEqual(priority, goal.Priority);
            Assert.AreEqual(state, goal.State);
            Assert.AreEqual(0, (goal.CreationDate - DateTime.Now).TotalMinutes, 1);
            Assert.IsFalse(goal.IsRemoved);
        }