示例#1
0
        public void DueDate(string input, int expectedMonth)
        {
            var task = new Task(input, default(DateTime));

            Expect(task.DueDate, Is.Not.Null);
            Expect(task.DueDate.Value.Month, Is.EqualTo(expectedMonth));
        }
        public ActionResult Add(string task)
        {
            var taskItem = new Task(task, DateTime.Today);

            Tasks.Add(taskItem);
            return RedirectToAction("Index");
        }
 public ActionResult Add(string task)
 {
     var taskItem = new Task(task, DateTime.Today);
     //new instance of the task class created below, with the descrpt set to whatever the user entered task is
     Tasks.Add(taskItem);
     return RedirectToAction("Index");
 }
        public void TwoDigitDay_ParseBothDigits()
        {
            var input = "Groceries apr 10";

            var task = new Task(input, default(DateTime));

            Expect(task.DueDate.Value.Day, Is.EqualTo(10));
        }
示例#5
0
        public void CreateTask_DescriptionWithALink_SetLink()
        {
            var input = "test http://www.google.com";

            var task = new Task(input, default(DateTime), new IgnoreLinkValidator());

            Expect(task.Link, Is.EqualTo("http://www.google.com"));
        }
        public void DayIsPastTheLastDayOfTheMonth_DoesNotParseDueDate()
        {
            var input = "Groceries apr 44";

            var task = new Task(input, default(DateTime));

            Expect(task.DueDate, Is.Null);
        }
        public void DoesWrapYear(string input)
        {
            var today = new DateTime(2015, 5, 31);

            var task = new Task(input, today);

            Expect(task.DueDate.Value.Year, Is.EqualTo(2016));
        }
        public void DoesNotWrapYear(string input)
        {
            var today = new DateTime(2015, 5, 4);

            var task = new Task(input, today);

            Expect(task.DueDate, Is.EqualTo(new DateTime(2015, 5, 5)));
        }
        public void MayDueDateDoesNotWrapYear()
        {
            var input = "Pick up groceries may 5 - as of 2015-05-04";
            var today = new DateTime(2015, 5, 4);

            var task = new Task(input, today);

            Expect(task.DueDate, Is.EqualTo(new DateTime(2015, 5, 5)));
        }
示例#10
0
        public void DescriptionAndNoDueDate()
        {
            var input = "Pickup the groceries";

            var task = new Task(input, default(DateTime));

            Expect(task.Description, Is.EqualTo(input));
            Expect(task.DueDate, Is.EqualTo(null));
        }
示例#11
0
        public void AddFeb29TaskInMarchOfYearBeforeLeapYear_ParsesDueDate()
        {
            var input = "Groceries feb 29";
            var today = new DateTime(2015, 3, 1);

            var task = new Task(input, today);

            Expect(task.DueDate.Value, Is.EqualTo(new DateTime(2016, 2, 29)));
        }
        public void DescriptionAndNoDueDate()
        {
            var input = "Pick up the groceries";

            var task = new Task(input, default(DateTime));

            Expect(task.Description, Is.EqualTo(input));
            NUnit.Framework.Assert.AreEqual(null, task.DueDate);
        }
        public void DescriptionAndNoDueDate()
        {
            var input = "Pick up groceries";

            var task = new Task(input, default(DateTime));

            //Assert.AreEqual(input, task.Description);
            Expect(task.Description, Is.EqualTo(input));
            //Expect(task.DueDate, Is.EqualTo(null));
            Assert.AreEqual(null, task.DueDate);
        }
示例#14
0
        private static void TestMayDueDateDoesWrapYear()
        {
            var input = "Pick up the groceries may 5 - as of 2015-05-31";
            Console.WriteLine("Scenario: " + input);
            var today = new DateTime(2015, 5, 31);

            var task = new Task(input, today);

            var dueDateShouldBe = new DateTime(2016, 5, 5);

            var success = dueDateShouldBe == task.DueDate;
            var failureMessage = "Due Date: " + task.DueDate + " should be " + dueDateShouldBe;
            PrintOutcome(success, failureMessage);
        }
示例#15
0
        private static void TestDescriptionAndNoDueDate()
        {
            var input = "Pick up the groceries";
            Console.WriteLine("Scenario: " + input);

            var task = new Task(input, default(DateTime));

            var descriptionShouldBe = input;
            DateTime? dueDateShouldBe = null;
            var success = descriptionShouldBe == task.Description && dueDateShouldBe == task.DueDate;
            var failureMessage = "Description: " + task.Description + " should be " + descriptionShouldBe
                + Environment.NewLine
                + "Due Date: " + task.DueDate + " should be " + dueDateShouldBe;

            PrintOutcome(success, failureMessage);
        }