public void When_DeleteProject_Then_VerifyResults()
        {
            var result = controller.DeleteProject(1);

            Assert.NotNull(result);

            result = controller.DeleteProject(0);
            Assert.NotNull(result);
        }
Exemplo n.º 2
0
        public void TestWebApiDeleteProject()
        {
            //Act
            IHttpActionResult actionResult = projectObj.DeleteProject(projectId);
            var contentResult = actionResult as NegotiatedContentResult <List <Project> >;

            // Assert
            Assert.IsNotNull(contentResult);
            Assert.AreEqual(HttpStatusCode.OK, contentResult.StatusCode);
            Assert.IsNotNull(contentResult.Content);
        }
Exemplo n.º 3
0
        public void TestDeleteProject()
        {
            ProjectManagerController taskManagerController = new ProjectManagerController();

            taskManagerController.AddProject(new Models.Project()
            {
                Name = "ProjectDelete", StartDate = DateTime.Now.ToShortDateString(), EndDate = DateTime.Now.AddDays(10).ToShortDateString(), Priority = 10
            });
            IEnumerable <Project> projects = taskManagerController.GetAllProjects();

            Assert.IsNotNull(projects);
            int projectId = projects.Where(p => p.Name == "ProjectDelete").FirstOrDefault().ProjectId;

            taskManagerController.DeleteProject(projectId);
            Project project = taskManagerController.GetProject(projectId);

            Assert.IsNull(project);
        }