public void Create_DisplayNameIsNullOrEmpty_ThrowsException()
        {
            //arrange
            var sectionTemplate = new SectionTemplate {
                Id = 1
            };
            var displayName = string.Empty;

            //act + assert
            Assert.That(() => _sectionNodeService.CreateSectionNode(sectionTemplate.Id, displayName, "Foobar"),
                        Throws.Exception.TypeOf <ArgumentException>()
                        .With.Message.EqualTo(string.Format(Ensure.ArgumentIsNullOrEmptyMessageFormat, "displayName")));
        }
        public JsonResult CreateSection(CreateSectionViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(JsonError(JsonRequestBehavior.DenyGet));
            }

            var newSectionNode =
                _mapper.Map <SectionNode, SectionNodeViewModel>(_sectionNodeService.CreateSectionNode(model.SectionTemplateId,
                                                                                                      model.DisplayName, model.UrlName));

            return(Json(newSectionNode, JsonRequestBehavior.DenyGet));
        }