public void CreateTaskTest3() { string input = "#LT ^2011-11-01 @Luuk2 =3.5h Nou dit werkt goed"; var actual = TaskBuilder.CreateTask(input); Assert.AreEqual("LT", actual.Project); Assert.AreEqual(new DateTime(2011, 11, 01), actual.DueDate); Assert.AreEqual("Luuk2", actual.AssignedTo); Assert.AreEqual(new TimeSpan(0, 3, 30), actual.EstimatedTime); Assert.AreEqual("Nou dit werkt goed", actual.TaskDescription); }
public void CreateTaskTest2() { string input = "#LT1 ^2011-01-24 @Luuk =5m Nou dit werkt goed"; var actual = TaskBuilder.CreateTask(input); Assert.AreEqual("LT1", actual.Project); Assert.AreEqual(new DateTime(2011, 01, 24), actual.DueDate); Assert.AreEqual("Luuk", actual.AssignedTo); Assert.AreEqual(new TimeSpan(0, 0, 5), actual.EstimatedTime); Assert.AreEqual("Nou dit werkt goed", actual.TaskDescription); }
public void CreateTaskTest1() { string input = "#LT ^2011-01-01 @Luuk ! =3h Aanmoedigen om te testen"; var actual = TaskBuilder.CreateTask(input); Assert.AreEqual("LT", actual.Project); Assert.AreEqual(new DateTime(2011, 01, 01), actual.DueDate); Assert.AreEqual("Luuk", actual.AssignedTo); Assert.AreEqual(new TimeSpan(0, 3, 0), actual.EstimatedTime); Assert.AreEqual("Aanmoedigen om te testen", actual.TaskDescription); }
public JsonResult Add(string rawtask) { var task = TaskBuilder.CreateTask(rawtask); using (var db = new LessThanDatabase()) { task.DateCreated = DateTime.Now; task.CreatorId = db.UserProfileLogins.First(a => a.UniqueIdentifier == User.Identity.Name).UserProfileId ?? 0; db.Tasks.AddObject(task); db.SaveChanges(); } IConnection connection = Connection.GetConnection <SignalREndPoint>(); connection.Broadcast(new { func = "Add", task }); return(Json(task.ToJson())); }
public void CreateTask_ReturnsCorrect_DueDateAndSubjectAndTags() { string[] args = "Köp vin till festen -p -tm".Split(' '); var argumentsParserMock = new Mock<IArgumentParser>(); argumentsParserMock.Setup(a => a.GetSubject(It.IsAny<string[]>())).Returns("Köp vin till festen"); var optionsParserMock = new Mock<IOptionsParser>(); optionsParserMock.SetupGet(o => o.DueDate).Returns(DateTime.Parse("2012-11-16")); optionsParserMock.SetupGet(o => o.Tags).Returns(new List<string> {"Personal"}); ITaskBuilder tb = new TaskBuilder(args, argumentsParserMock.Object, optionsParserMock.Object); ITaskDTO task = tb.CreateTask(); Assert.Equal(DateTime.Parse("2012-11-16"), task.DueDate); Assert.Equal("Köp vin till festen", task.Subject); argumentsParserMock.VerifyAll(); optionsParserMock.VerifyAll(); }
private static void Main(string[] args) { ContainerBootstrapper.BootstrapStructureMap(args); IContainer container = ObjectFactory.Container; IList<ITaskManager> taskManagers = container.GetAllInstances<ITaskManager>(); if (ShouldUsageBeShown(args)) { ShowUsage(taskManagers); return; } var argumentParser = ObjectFactory.GetInstance<IArgumentParser>(); var optionParser = ObjectFactory.GetInstance<IOptionsParser>(); ITaskBuilder taskBuilder = new TaskBuilder(args, argumentParser, optionParser); ITaskDTO taskDto = taskBuilder.CreateTask(); bool taskCreated = false; ITaskManager taskManagerToRun = ProviderMatcher.GetMatchingTaskManager(args, taskManagers); taskManagerToRun.CreateTask(taskDto); }
public void CreateTask_ReturnsCorrect_DueDateAndSubjectAndTags() { string[] args = "Köp vin till festen -p -tm".Split(' '); var argumentsParserMock = new Mock <IArgumentParser>(); argumentsParserMock.Setup(a => a.GetSubject(It.IsAny <string[]>())).Returns("Köp vin till festen"); var optionsParserMock = new Mock <IOptionsParser>(); optionsParserMock.SetupGet(o => o.DueDate).Returns(DateTime.Parse("2012-11-16")); optionsParserMock.SetupGet(o => o.Tags).Returns(new List <string> { "Personal" }); ITaskBuilder tb = new TaskBuilder(args, argumentsParserMock.Object, optionsParserMock.Object); ITaskDTO task = tb.CreateTask(); Assert.Equal(DateTime.Parse("2012-11-16"), task.DueDate); Assert.Equal("Köp vin till festen", task.Subject); argumentsParserMock.VerifyAll(); optionsParserMock.VerifyAll(); }
private static void Main(string[] args) { ContainerBootstrapper.BootstrapStructureMap(args); IContainer container = ObjectFactory.Container; IList <ITaskManager> taskManagers = container.GetAllInstances <ITaskManager>(); if (ShouldUsageBeShown(args)) { ShowUsage(taskManagers); return; } var argumentParser = ObjectFactory.GetInstance <IArgumentParser>(); var optionParser = ObjectFactory.GetInstance <IOptionsParser>(); ITaskBuilder taskBuilder = new TaskBuilder(args, argumentParser, optionParser); ITaskDTO taskDto = taskBuilder.CreateTask(); bool taskCreated = false; ITaskManager taskManagerToRun = ProviderMatcher.GetMatchingTaskManager(args, taskManagers); taskManagerToRun.CreateTask(taskDto); }