public void Test_GetUIFormField_WhenBool_ShouldCreateCheckBox() { //---------------Set up test pack------------------- IPropDef propDef = new PropDefFake(typeof(bool)); var formCreator = new UIFormCreatorSpy(GetFactory()); //---------------Assert Precondition---------------- Assert.AreSame(typeof(bool), propDef.PropertyType); //---------------Execute Test ---------------------- var formField = formCreator.CallGetUIFormField(propDef); //---------------Test Result ----------------------- Assert.AreEqual("System.Windows.Forms", formField.ControlAssemblyName, "Should create a windows control"); Assert.AreEqual("CheckBox", formField.ControlTypeName); }
public void Test_GetUIFormField_Lookup_ShouldBeComboBoxColumnType() { //---------------Set up test pack------------------- IPropDef propDef = new PropDefFake { LookupList = new SimpleLookupList(new Dictionary <string, string>()) }; var formCreator = new UIFormCreatorSpy(GetFactory()); //---------------Assert Precondition---------------- Assert.IsTrue(propDef.HasLookupList(), "Prop Def should have lookupList"); //---------------Execute Test ---------------------- var formField = formCreator.CallGetUIFormField(propDef); //---------------Test Result ----------------------- Assert.AreEqual("System.Windows.Forms", formField.ControlAssemblyName, "Should create a windows control"); Assert.AreEqual("ComboBox", formField.ControlTypeName); }
public void Test_GetUIFormField_Lookup_ShouldBeComboBoxColumnType() { //---------------Set up test pack------------------- IPropDef propDef = new PropDefFake { LookupList = new SimpleLookupList(new Dictionary<string, string>()) }; var formCreator = new UIFormCreatorSpy(GetFactory()); //---------------Assert Precondition---------------- Assert.IsTrue(propDef.HasLookupList(), "Prop Def should have lookupList"); //---------------Execute Test ---------------------- var formField = formCreator.CallGetUIFormField(propDef); //---------------Test Result ----------------------- Assert.AreEqual("System.Windows.Forms", formField.ControlAssemblyName, "Should create a windows control"); Assert.AreEqual("ComboBox", formField.ControlTypeName); }
public void Test_GetUIFormField_WhenDateTime_ShouldCreateDateTimePicker() { //---------------Set up test pack------------------- var propType = typeof (DateTime); IPropDef propDef = new PropDefFake(propType); var formCreator = new UIFormCreatorSpy(GetFactory()); //---------------Assert Precondition---------------- Assert.AreSame(propType, propDef.PropertyType); //---------------Execute Test ---------------------- var formField = formCreator.CallGetUIFormField(propDef); //---------------Test Result ----------------------- Assert.AreEqual("System.Windows.Forms", formField.ControlAssemblyName, "Should create a windows control"); Assert.AreEqual("DateTimePicker", formField.ControlTypeName); }