Example #1
0
        public void AddSubtaskTest()
        {
            // Arrange
            var task = new TaskMother().Build();
            var subTask = new TaskMother().Build();
            var originalCount = task.GetSubtasks().Count();
            var expected = 1;

            // Act
            task.AddSubtask(subTask);
            var actual = task.GetSubtasks().Count();

            // Assert
            Assert.AreEqual(expected, actual);
            Assert.AreNotEqual(originalCount, actual);
        }
Example #2
0
        public void AddAlreadyExistantSubtaskShouldFail()
        {
            // Arrange
            var task = new TaskMother().Build();
            var subTask = new TaskMother().Build();
            var expected = 1;

            // Act
            try
            {
                task.AddSubtask(subTask);
                task.AddSubtask(subTask);
            }
            catch (Exception)
            {
                var actual = task.GetSubtasks().Count();

                // Assert
                Assert.AreEqual(expected, actual);
                throw;
            }
        }