Esempio n. 1
0
        public void BasicFunctionsShouldWork()
        {
            var my_task = MyTaskFactory.Instance.CreateTask("test_description", DateTime.Today, "test_project", "test_owner", "test_asignee", MyTask.Convert("InProgress"), "test_review");

            my_task.AssignTask(new Volunteer("Bianca"));
            my_task.ChangeStatus(MyTask.Convert("Done"));
            my_task.GiveReview(new PlainText("very well"));

            Assert.AreEqual("Bianca", my_task.Asignee.ToString());
            Assert.AreEqual(MyTask.Convert("Done"), my_task.Status);
            Assert.AreEqual("very well", my_task.Review.ToString());
        }
Esempio n. 2
0
        public void AddTaskShouldFail()
        {
            var my_task    = MyTaskFactory.Instance.CreateTask("test_description", DateTime.Today, "test_project", "test_owner", "test_asignee", MyTask.Convert("InProgress"), "test_review");
            var repository = new MyTaskRepository();

            repository.AddTask(my_task);

            Assert.That(() => repository.AddTask(my_task), Throws.TypeOf <DuplicateWaitObjectException>());
        }
Esempio n. 3
0
        public void EventSpyShouldWork()
        {
            var logMock    = new Moq.Mock <IEventLogger>();
            var my_task    = MyTaskFactory.Instance.CreateTask("test_description", DateTime.Today, "test_project", "test_owner", "test_asignee", MyTask.Convert("InProgress"), "test_review", logMock.Object);
            var repository = new MyTaskRepository();

            repository.AddTask(my_task);

            repository.UpdateTask("AssignTask", my_task, "Bianca");
            repository.UpdateTask("ChangeStatus", my_task, "Done");
            repository.UpdateTask("GiveReview", my_task, "Very well");

            logMock.Verify(_ => _.Log("Project : test_project Task : test_description was assigned to : Bianca"), Times.Once);
            logMock.Verify(_ => _.Log("Project : test_project Task : test_description status has changed to : Done"), Times.Once);
            logMock.Verify(_ => _.Log("Project : test_project Task : test_description has received a review : Very well"), Times.Once);
        }
Esempio n. 4
0
        [TestCase("2020-16-01")]  //One day after - OFF
        public void DaysLeftAsOfShouldFail(string s)
        {
            var logMock = new Moq.Mock <IEventLogger>();
            var my_task = MyTaskFactory.Instance.CreateTask("test_description", DateTime.Parse("2020-15-01"), "test_project", "test_owner", "test_asignee", MyTask.Convert("InProgress"), "test_review", logMock.Object);

            Assert.That(() => my_task.DaysLeftAsOf(DateTime.Parse(s)), Throws.TypeOf <ArgumentOutOfRangeException>());
        }
Esempio n. 5
0
        [TestCase(1, "2020-14-01")] //One day before - ON
        public void DaysLeftAsOfShouldWork(int a, string b)
        {
            var      logMock = new Moq.Mock <IEventLogger>();
            var      my_task = MyTaskFactory.Instance.CreateTask("test_description", DateTime.Parse("2020-15-01"), "test_project", "test_owner", "test_asignee", MyTask.Convert("InProgress"), "test_review", logMock.Object);
            TimeSpan ts      = new TimeSpan(a, 0, 0, 0);

            Assert.AreEqual(ts, my_task.DaysLeftAsOf(DateTime.Parse(b)));
        }