public JsonResult DeleteSection(DeleteSectionViewModel model) { if (!ModelState.IsValid) //TODO: need to get modelstate transfer attribute { return(JsonError(JsonRequestBehavior.DenyGet)); } _sectionNodeService.Delete(model.Id); return(Json(JsonRequestBehavior.DenyGet)); }
public void Delete_DeletesTheSectionNode() { //arrange var sectionTemplate = new SectionTemplate { Id = 1 }; var sectionNode = new SectionNode { Id = 99 }; _dbContextMock.Setup(x => x.GetDbSet <SectionNode>()).Returns(new InMemoryDbSet <SectionNode> { sectionNode }); _sectionTemplateServiceMock.Setup(x => x.GetById(It.IsAny <int>())).Returns(sectionTemplate); //act _sectionNodeService.Delete(sectionNode.Id); //assert var foundSectionNode = _sectionNodeService.GetById(sectionNode.Id); foundSectionNode.Should().Be.Null(); }