public void TestStatusNew() { // Arrange ////////////////////////////////////////// // Act //create project project = CreateProject(); //create task task = CreateTask(project.ID); //create action action = CreateAction(task.ID); ////////////////////////////////////////// // Assert //project status Assert.IsTrue(project.Status == Status.Active); //task status Assert.IsTrue(task.Status == Status.Active); //action status Assert.IsTrue(action.Status == Status.Active); }
public void DashboardActiveItemCounts() { // Arrange //dashboard (active) counts LayoutController lc = new LayoutController(); lc.TestUser = user; DashboardViewModel dashboard = (DashboardViewModel)lc.Dashboard().ViewData.Model; int lProjectCount = dashboard.ActiveProjects.Count(); int lTaskCount = dashboard.ActiveTasks.Count(); int lActionCount = dashboard.ActiveActions.Count(); ////////////////////////////////////////// // Act //create project project = CreateProject(); //create task task = CreateTask(project.ID); //create action action = CreateAction(task.ID); ////////////////////////////////////////// //Assert Assert.AreEqual <int>(db.GetMyProjects(user).Count(), lProjectCount + 1); Assert.AreEqual <int>(db.GetMyTasks(user).Count(), lTaskCount + 1); Assert.AreEqual <int>(db.GetMyActions(user).Count(), lActionCount + 1); }
public void DbItemCounts() { // Arrange int dbProjectCount = db.GetMyProjects(user).Count(); int dbTaskCount = db.GetMyTasks(user).Count(); int dbActionCount = db.GetMyActions(user).Count(); ////////////////////////////////////////// // Act //create project project = CreateProject(); //create task task = CreateTask(project.ID); //create action action = CreateAction(task.ID); ////////////////////////////////////////// // Assert Assert.AreEqual <int>(db.GetMyProjects(user).Count(), dbProjectCount + 1); Assert.AreEqual <int>(db.GetMyTasks(user).Count(), dbTaskCount + 1); Assert.AreEqual <int>(db.GetMyActions(user).Count(), dbActionCount + 1); }
public void CreationDateTime() { // Arrange DateTime dtBeforeCreatingProject = DateTime.Now; Thread.Sleep(500); ////////////////////////////////////////// // Act //create project project = CreateProject(); Thread.Sleep(500); DateTime dtAfterCreatingProject = DateTime.Now; Thread.Sleep(500); //create task task = CreateTask(project.ID); Thread.Sleep(500); DateTime dtAfterCreatingTask = DateTime.Now; Thread.Sleep(500); //create action action = CreateAction(task.ID); Thread.Sleep(500); DateTime dtAfterCreatingAction = DateTime.Now; ////////////////////////////////////////// // Assert //project creation date Assert.IsTrue(project.CreationDate > dtBeforeCreatingProject); Assert.IsTrue(project.CreationDate < dtAfterCreatingProject); //task creation date Assert.IsTrue(task.CreationDate > dtAfterCreatingProject); Assert.IsTrue(task.CreationDate < dtAfterCreatingTask); //action creation date Assert.IsTrue(action.CreationDate > dtAfterCreatingTask); Assert.IsTrue(action.CreationDate < dtAfterCreatingAction); }
public Task CreateTask(int projectID) { // Arrange ////////////////////////////////////////// // Act Task task = new Task() { Code = "Test", Name = "Test Task", ProjectID = projectID }; ActionResult taskResult = projectController.CreateTask(task); ////////////////////////////////////////// // Assert Assert.IsNotNull(taskResult); return(task); }
//// //// GET: /Account/Register //[AllowAnonymous] //public ActionResult Register() //{ // return View(); //} private void CreateDefaultItems(string userId) { //create default project Project project = new Project(); //set owner UserManager <ApplicationUser> manager = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(db)); project.User = manager.FindById(userId); project.SetCode("Default"); project.Name = "Default Project"; project.CreationDate = DateTime.UtcNow; db.Projects.Add(project); //create default task Task task = new Task(); task.SetCode("Default"); task.Name = "Default Task"; project.CreationDate = DateTime.UtcNow; db.Tasks.Add(task); //create default action Action action = new Action(); action.SetName("Default Action"); action.CreationDate = DateTime.UtcNow; action.Estimate = 1; db.Actions.Add(action); db.SaveChanges(); //set current action project.User.ActionID = action.ID; db.Entry(project.User).State = EntityState.Modified; db.SaveChanges(); }