public void DocumentTypeEditorControllerTests_DocumentType_Create()
        {
            //Arrange
            var controller = new DocumentTypeEditorController(GetBackOfficeRequestContext());
            controller.InjectDependencies(new Dictionary<string, string>(), new Dictionary<string, string>(), GetBackOfficeRequestContext(), false);

            //Act
            var model = new CreateDocumentTypeModel
                            {
                                Name = "Hello",
                                SelectedDocumentTypeId = FixedHiveIds.ContentRootSchema,
                                CreateTemplate = false
                            };

            var result = controller.CreateNewForm(model);

            //Assert

            Assert.IsTrue(result is RedirectToRouteResult);
            //get the new id from the route values
            var newId = ((RedirectToRouteResult)result).RouteValues["id"];
            Assert.AreEqual(typeof(HiveId), newId.GetType());

            using (var uow = UmbracoApplicationContext.Hive.OpenReader<IContentStore>())
            {
                var entity = uow.Repositories.Schemas.Get<EntitySchema>((HiveId)newId);
                if (entity == null)
                    Assert.Fail("no entity found");

                Assert.AreEqual("hello", entity.Alias);
                Assert.AreEqual("Hello", entity.Name.Value);
                Assert.IsTrue(DateTimeOffset.UtcNow.Subtract(entity.UtcCreated) < new TimeSpan(0, 1, 0));
                Assert.IsTrue(DateTimeOffset.UtcNow.Subtract(entity.UtcModified) < new TimeSpan(0, 1, 0));

                Assert.IsTrue(entity.AttributeGroups.Any(x => x.Alias == FixedGroupDefinitions.GeneralGroupAlias));
            }
        }
        public void DocumentTypeEditorControllerTests_Create_New_Wizard_Step_Bound_And_Invalidated()
        {
            //Arrange

            var parentDocTypeId = Guid.NewGuid();
            var selectedDocTypeId = Guid.NewGuid();
            var createModel = new CreateDocumentTypeModel
                                  {
                                      Name = "",
                                      //CreateTemplate = true,
                                      //ParentId = parentDocTypeId,
                                      SelectedDocumentTypeId = new HiveId(selectedDocTypeId)
                                  };

            var controller = new ContentEditorController(GetBackOfficeRequestContext());
            controller.InjectDependencies(new Dictionary<string, string>(), new Dictionary<string, string>
                                              {
                                                  //{ "ParentId", parentDocTypeId.ToString("N") },
                                                  { "Name", "" },
                                                  { "SelectedDocumentTypeId", selectedDocTypeId.ToString("N") },
                                                  { "CreateTemplate", true.ToString() }
                                              }, GetBackOfficeRequestContext());

            //Act

            var result = (ViewResult)controller.CreateNewForm(createModel);

            //Assert

            Assert.IsFalse(controller.ModelState.IsValidField("Name"));

        }