public void ContentEditorControllerTests_Create_New_Wizard_Step_Bound_And_Validated()
        {
            //Arrange

            var selectedDocTypeId = new HiveId("content", "", new HiveIdValue(Guid.NewGuid()));
            var createModel = new CreateContentModel { Name = "test", SelectedDocumentTypeId = selectedDocTypeId };
            // Get the parent content schema
            using (var writer = RebelApplicationContext.Hive.OpenWriter<IContentStore>())
            {
                var contentSchemaRoot = writer.Repositories.Schemas.Get<EntitySchema>(FixedHiveIds.ContentRootSchema);
                //create doc type in persistence layer
                var schema = HiveModelCreationHelper.CreateEntitySchema("test", "Test", new AttributeDefinition[] { });
                schema.Id = selectedDocTypeId;
                schema.RelationProxies.EnlistParent(contentSchemaRoot, FixedRelationTypes.DefaultRelationType);
                writer.Repositories.Schemas.AddOrUpdate(schema);
                writer.Complete();
            }
            
            var controller = new ContentEditorController(GetBackOfficeRequestContext());
            controller.InjectDependencies(new Dictionary<string, string>(), new Dictionary<string, string>
                                              {
                                                  { "Name", "test" },
                                                  { "SelectedDocumentTypeId", selectedDocTypeId.ToString() }
                                              }, GetBackOfficeRequestContext());

            //Act

            var result = (ViewResult)controller.CreateNewForm(createModel);
            var model = (CreateContentModel)result.Model;

            //Assert

            Assert.IsTrue(controller.ModelState.IsValidField("Name"),
                string.Join("; ", controller.ModelState["Name"].Errors.Select(x => x.ErrorMessage)));
            Assert.IsTrue(controller.ModelState.IsValidField("SelectedDocumentTypeId"), 
                string.Join("; ", controller.ModelState["SelectedDocumentTypeId"].Errors.Select(x => x.ErrorMessage)));

            Assert.AreEqual("test", model.Name);
            Assert.AreEqual((Guid)selectedDocTypeId.Value, (Guid)model.SelectedDocumentTypeId.Value);
        }
        public void ContentEditorControllerTests_Create_New_Wizard_Step_Bound_And_Invalidated()
        {
            //Arrange

            var selectedDocTypeId = Guid.NewGuid();
            var createModel = new CreateContentModel { Name = "", SelectedDocumentTypeId = new HiveId(selectedDocTypeId) };

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

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

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

        }