Model representing the create new wizard view for a data type
        public void DataTypeEditorControllerTests_Create_New_Wizard_Step_Bound_And_Validated()
        {
            //Arrange

            var propEditor = new MandatoryPropertyEditor();
            var createModel = new CreateDataTypeModel { Name = "test", PropertyEditorId = propEditor.Id };

            //create data type in persistence layer
            var dataTypeEntity = HiveModelCreationHelper.CreateAttributeType("test", "Test", "");
            dataTypeEntity.RenderTypeProvider = propEditor.Id.ToString();
            RebelApplicationContext.AddPersistenceData(dataTypeEntity);

            var controller = new DataTypeEditorController(GetBackOfficeRequestContext());
            controller.InjectDependencies(GetBackOfficeRequestContext());

            //Act

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

            //Assert

            Assert.IsTrue(controller.ModelState.IsValidField("Name"));
            Assert.IsTrue(controller.ModelState.IsValidField("PropertyEditorId"));

            Assert.AreEqual("test", model.Name);
            Assert.AreEqual(propEditor.Id, model.PropertyEditorId);
        }
        public virtual ActionResult CreateNewForm(CreateDataTypeModel createModel)
        {

            if (!TryValidateModel(createModel))
            {
                EnsurePropEditorListViewBagData();
                return View(createModel);
            }

            var propertyEditor = _propertyEditors.Where(x => x.Metadata.Id == createModel.PropertyEditorId).Single();
            var dataType = new DataType(string.Empty, string.Empty, propertyEditor.Value);
            var dataTypeEditorViewModel = BackOfficeRequestContext.Application.FrameworkContext.TypeMappers.Map<DataType, DataTypeEditorModel>(dataType);

            return ProcessSubmit(dataTypeEditorViewModel, null);

            return RedirectToAction("Create", new { propertyEditorId = createModel.PropertyEditorId, name = createModel.Name });
        }
        public void DataTypeEditorControllerTests_Create_New_Wizard_Step_Bound_And_Invalidated()
        {
            //Arrange

            var createModel = new CreateDataTypeModel { Name = "", PropertyEditorId = Guid.Empty };

            //create data type in persistence layer
            var dataTypeEntity = HiveModelCreationHelper.CreateAttributeType("test", "Test", "");
            RebelApplicationContext.AddPersistenceData(dataTypeEntity);

            var controller = new DataTypeEditorController(GetBackOfficeRequestContext());
            controller.InjectDependencies(GetBackOfficeRequestContext());

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

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

        }