public void MapToOriginalEntityLongAsId() { //Arrange //See ctor //Act var entity = UModelMapper.MapToEntity <TestClassLong>(this._uModelIdAsLong, Bootstrap.Config <TestClassLong>()); //Assert Assert.AreEqual(this._testClassIdsLong.Id, entity.Id); Assert.AreEqual(this._testClassIdsLong.Name, entity.Name); Assert.AreEqual(this._testClassIdsLong.Summary, entity.Summary); Assert.AreEqual(this._testClassIdsLong.Boolean, entity.Boolean); Assert.AreEqual(this._testClassIdsLong.Dropdown, entity.Dropdown); }
public void MapToUModelContent() { //Arrange //See ctor //Act var uModel = UModelMapper.MapToUModel(Bootstrap.Config <TestClassGuid>(), this._testClass); //Assert Assert.AreEqual(1, uModel.Tabs.Count); Assert.AreEqual("Profile", uModel.Tabs[0].Label); Assert.AreEqual(5, uModel.Tabs[0].Properties.Count); //AddTextBox Assert.AreEqual("My label", uModel.Tabs[0].Properties[0].Label); Assert.AreEqual("My description", uModel.Tabs[0].Properties[0].Description); Assert.AreEqual(this._testClass.Name, uModel.Tabs[0].Properties[0].Value); Assert.AreEqual(false, uModel.Tabs[0].Properties[0].IsReadOnly); Assert.AreEqual(50, uModel.Tabs[0].Properties[0].Config["maxChars"]); Assert.AreEqual(true, uModel.Tabs[0].Properties[0].Validation["mandatory"]); Assert.AreEqual("^[A-z]{9}$", uModel.Tabs[0].Properties[0].Validation["pattern"]); Assert.AreEqual("Umbraco.Textbox", uModel.Tabs[0].Properties[0].Editor); Assert.AreEqual("textbox", uModel.Tabs[0].Properties[0].View); //AddTextBox Assert.AreEqual("My label", uModel.Tabs[0].Properties[1].Label); Assert.AreEqual("Should be readonly", uModel.Tabs[0].Properties[1].Description); Assert.AreEqual(this._testClass.Name, uModel.Tabs[0].Properties[1].Value); Assert.AreEqual(true, uModel.Tabs[0].Properties[1].IsReadOnly); Assert.AreEqual(500, uModel.Tabs[0].Properties[1].Config["maxChars"]);//default max chars value for textbox Assert.AreEqual(false, uModel.Tabs[0].Properties[1].Validation["mandatory"]); Assert.AreEqual(null, uModel.Tabs[0].Properties[2].Validation["pattern"]); Assert.AreEqual("Umbraco.Textbox", uModel.Tabs[0].Properties[1].Editor); Assert.AreEqual("textbox", uModel.Tabs[0].Properties[1].View); //AddTextArea Assert.AreEqual("Summary", uModel.Tabs[0].Properties[2].Label); Assert.AreEqual("My short summary", uModel.Tabs[0].Properties[2].Description); Assert.AreEqual(this._testClass.Summary, uModel.Tabs[0].Properties[2].Value); Assert.AreEqual(false, uModel.Tabs[0].Properties[2].IsReadOnly); Assert.AreEqual(false, uModel.Tabs[0].Properties[2].Config["maxChars"]); Assert.AreEqual(true, uModel.Tabs[0].Properties[2].Validation["mandatory"]); Assert.AreEqual(null, uModel.Tabs[0].Properties[2].Validation["pattern"]); Assert.AreEqual("Umbraco.Textarea", uModel.Tabs[0].Properties[2].Editor); Assert.AreEqual("textarea", uModel.Tabs[0].Properties[2].View); //AddCheckbox Assert.AreEqual("Active", uModel.Tabs[0].Properties[3].Label); Assert.AreEqual(null, uModel.Tabs[0].Properties[3].Description); Assert.AreEqual("1", uModel.Tabs[0].Properties[3].Value); Assert.AreEqual(false, uModel.Tabs[0].Properties[3].IsReadOnly); Assert.AreEqual("Umbraco.TrueFalse", uModel.Tabs[0].Properties[3].Editor); Assert.AreEqual("boolean", uModel.Tabs[0].Properties[3].View); //AddDropdown Assert.AreEqual("Select", uModel.Tabs[0].Properties[4].Label); Assert.AreEqual(null, uModel.Tabs[0].Properties[4].Description); Assert.AreEqual("A", uModel.Tabs[0].Properties[4].Value); Assert.AreEqual(false, uModel.Tabs[0].Properties[4].IsReadOnly); Assert.AreEqual(true, uModel.Tabs[0].Properties[4].Validation["mandatory"]); Assert.AreEqual("Umbraco.Flexible", uModel.Tabs[0].Properties[4].Editor); Assert.AreEqual("dropdownFlexible", uModel.Tabs[0].Properties[4].View); Assert.AreEqual(this._testClass.Id, uModel.Id); Assert.AreEqual(this._testClass.Name, uModel.Name); }