public void Test_GetUIFormField_WhenBool_ShouldCreateCheckBox() { //---------------Set up test pack------------------- IPropDef propDef = new PropDefFake(typeof(bool)); var gridCreator = new UIGridCreatorSpy(GetFactory()); //---------------Assert Precondition---------------- Assert.AreSame(typeof(bool), propDef.PropertyType); //---------------Execute Test ---------------------- var gridColumn = gridCreator.CallGetUIGridColumn(propDef); //---------------Test Result ----------------------- AssertGridColumnTypeIsCheckBox(gridColumn); }
public void Test_GetUIFormField_WhenDateTime_ShouldCreateDateTimePicker() { //---------------Set up test pack------------------- var propType = typeof(DateTime); IPropDef propDef = new PropDefFake(propType); var gridCreator = new UIGridCreatorSpy(GetFactory()); //---------------Assert Precondition---------------- Assert.AreSame(propType, propDef.PropertyType); //---------------Execute Test ---------------------- var gridColumn = gridCreator.CallGetUIGridColumn(propDef); //---------------Test Result ----------------------- AssertGridColumnTypeIsDateTime(gridColumn); }
public void Test_GetUIFormField_WhenString_ShouldHaveTextBoxPropertyAndColumnType() { //---------------Set up test pack------------------- IPropDef propDef = new PropDefFake(typeof(string)); var gridCreator = new UIGridCreatorSpy(GetFactory()); //---------------Assert Precondition---------------- Assert.AreSame(typeof(string), propDef.PropertyType); //---------------Execute Test ---------------------- var gridColumn = gridCreator.CallGetUIGridColumn(propDef); //---------------Test Result ----------------------- Assert.IsNotNull(gridColumn); Assert.IsNotNull(gridColumn.PropertyName); AssertGridColumnTypeIsTextBox(gridColumn); }
public void Test_GetUIFormField_Lookup_ShouldBeComboBoxColumnType() { //---------------Set up test pack------------------- IPropDef propDef = new PropDefFake { LookupList = new SimpleLookupList(new Dictionary <string, string>()) }; var gridCreator = new UIGridCreatorSpy(GetFactory()); //---------------Assert Precondition---------------- Assert.IsTrue(propDef.HasLookupList(), "Prop Def should have lookupList"); //---------------Execute Test ---------------------- var gridColumn = gridCreator.CallGetUIGridColumn(propDef); //---------------Test Result ----------------------- AssertGridColumnTypeIsComboBox(gridColumn); }
public void Test_GetUIFormField_WhenPropNull_ShouldRaiseError() { //---------------Set up test pack------------------- var gridCreator = new UIGridCreatorSpy(GetFactory()); //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- try { gridCreator.CallGetUIGridColumn(null); Assert.Fail("expected ArgumentNullException"); } //---------------Test Result ----------------------- catch (ArgumentNullException ex) { StringAssert.Contains("Value cannot be null", ex.Message); StringAssert.Contains("propDef", ex.ParamName); } }
public void Test_GetUIFormField_Lookup_ShouldBeComboBoxColumnType() { //---------------Set up test pack------------------- IPropDef propDef = new PropDefFake { LookupList = new SimpleLookupList(new Dictionary<string, string>()) }; var gridCreator = new UIGridCreatorSpy(GetFactory()); //---------------Assert Precondition---------------- Assert.IsTrue(propDef.HasLookupList(), "Prop Def should have lookupList"); //---------------Execute Test ---------------------- var gridColumn = gridCreator.CallGetUIGridColumn(propDef); //---------------Test Result ----------------------- AssertGridColumnTypeIsComboBox(gridColumn); }