public void AddTask_Service() { var obj = new ProjectManagerAPI.Controllers.TaskController(); tblTask Ts = (new tblTask { TaskName = "Cooking", TStartDate = DateTime.Now, TEndDate = DateTime.Now, TPriority = 10, TStatus = false, ParentTaskName = "Cleaning", UserId = 0 }); IHttpActionResult result = obj.post(Ts); var contentresult = result as OkNegotiatedContentResult <string>; IHttpActionResult result1 = obj.Get(); var contentresult1 = result1 as OkNegotiatedContentResult <List <tblTask> >; Assert.IsNotNull(contentresult); Assert.Greater(contentresult1.Content.Count, 0); }
public void AddTask_Service() { var obj = new ProjectManagerAPI.Controllers.TaskController(); //Task ts = new tblTask { TaskName = "Task added", ParentName = "Parent added", Priority = 10, SDate = DateTime.Now, EDate = DateTime.Now, flag = true }; tblTask Ts = (new tblTask { TaskName = "Testtaskname", TStartDate = DateTime.Now, TEndDate = DateTime.Now, TPriority = 10, TStatus = false, ParentTaskName = "parenttask", UserId = 0 }); IHttpActionResult result = obj.post(Ts); var contentresult = result as OkNegotiatedContentResult <string>; IHttpActionResult result1 = obj.Get(); var contentresult1 = result1 as OkNegotiatedContentResult <List <tblTask> >; Assert.IsNotNull(contentresult); Assert.Greater(contentresult1.Content.Count, 0); }