示例#1
0
        public void Test_CreateUIFilterProperty_ShouldReturnIFilterPropertyDef()
        {
            //---------------Set up test pack-------------------
            var      uiFilterCreator = GetUIFilterCreator();
            IPropDef propDef         = new PropDefFake(typeof(string));
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var filterPropertyDef = uiFilterCreator.CreateUIFilterProperty(propDef);

            //---------------Test Result -----------------------
            Assert.IsNotNull(filterPropertyDef);
        }
示例#2
0
        public void Test_CreateUIFilterProperty_When_PropertyType_IsNonSpecific_ShouldHaveFilterClauseOperator_OpLike()
        {
            //---------------Set up test pack-------------------
            var      uiFilterCreator = GetUIFilterCreator();
            IPropDef propDef         = new PropDefFake(typeof(object));

            //---------------Assert Precondition----------------
            Assert.AreSame(typeof(object), propDef.PropertyType);
            //---------------Execute Test ----------------------
            var filterPropertyDef = uiFilterCreator.CreateUIFilterProperty(propDef);

            //---------------Test Result -----------------------
            Assert.AreEqual(FilterClauseOperator.OpLike, filterPropertyDef.FilterClauseOperator);
        }
        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);
        }
示例#4
0
        public void Test_CreateUIFilterProperty_When_PropertyType_IsNoSpecific_ShouldHaveTextBox()
        {
            //---------------Set up test pack-------------------
            var      uiFilterCreator = GetUIFilterCreator();
            IPropDef propDef         = new PropDefFake(typeof(object));

            //---------------Assert Precondition----------------
            Assert.AreSame(typeof(object), propDef.PropertyType);
            //---------------Execute Test ----------------------
            var filterPropertyDef = uiFilterCreator.CreateUIFilterProperty(propDef);

            //---------------Test Result -----------------------
            AssertIsControlOfType("StringTextBoxFilter", "Habanero.Faces.Base", filterPropertyDef);
        }
示例#5
0
        public void Test_CreateUIFilterProperty_When_PropertyType_IsDateTime_ShouldHaveDateTimePicker()
        {
            //---------------Set up test pack-------------------
            var      uiFilterCreator = GetUIFilterCreator();
            IPropDef propDef         = new PropDefFake(typeof(DateTime));

            //---------------Assert Precondition----------------
            Assert.AreSame(typeof(DateTime), propDef.PropertyType);
            //---------------Execute Test ----------------------
            var filterPropertyDef = uiFilterCreator.CreateUIFilterProperty(propDef);

            //---------------Test Result -----------------------
            AssertIsControlOfType("DateTimePickerFilter", "Habanero.Faces.Base", filterPropertyDef);
        }
示例#6
0
        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_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);
        }
示例#10
0
        public void Test_CreateUIFilterProperty_When_PropertyType_HasLookupList_ShouldHaveComboBox()
        {
            //---------------Set up test pack-------------------
            var      uiFilterCreator = GetUIFilterCreator();
            IPropDef propDef         = new PropDefFake
            {
                LookupList = new SimpleLookupList(new Dictionary <string, string>())
            };

            //---------------Assert Precondition----------------
            Assert.IsTrue(propDef.HasLookupList(), "Prop Def should have lookupList");
            //---------------Execute Test ----------------------
            var filterPropertyDef = uiFilterCreator.CreateUIFilterProperty(propDef);

            //---------------Test Result -----------------------
            AssertIsControlOfType("StringComboBoxFilter", "Habanero.Faces.Base", filterPropertyDef);
        }
示例#11
0
        public void Test_CreateUIFilterProperty_When_PropertyType_HasLookupList_ShouldHaveFilterClauseOperator_OpEquals()
        {
            //---------------Set up test pack-------------------
            var      uiFilterCreator = GetUIFilterCreator();
            IPropDef propDef         = new PropDefFake
            {
                LookupList = new SimpleLookupList(new Dictionary <string, string>())
            };

            //---------------Assert Precondition----------------
            Assert.IsTrue(propDef.HasLookupList(), "Prop Def should have lookupList");
            //---------------Execute Test ----------------------
            var filterPropertyDef = uiFilterCreator.CreateUIFilterProperty(propDef);

            //---------------Test Result -----------------------
            Assert.AreEqual(FilterClauseOperator.OpEquals, filterPropertyDef.FilterClauseOperator);
        }
示例#12
0
        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_CreateUIFilterProperty_When_PropertyType_HasLookupList_ShouldHaveComboBox()
 {
     //---------------Set up test pack-------------------
     var uiFilterCreator = GetUIFilterCreator();
     IPropDef propDef = new PropDefFake
     {
         LookupList = new SimpleLookupList(new Dictionary<string, string>())
     };
     //---------------Assert Precondition----------------
     Assert.IsTrue(propDef.HasLookupList(), "Prop Def should have lookupList");
     //---------------Execute Test ----------------------
     var filterPropertyDef = uiFilterCreator.CreateUIFilterProperty(propDef);
     //---------------Test Result -----------------------
     AssertIsControlOfType("StringComboBoxFilter", "Habanero.Faces.Base", filterPropertyDef);
 }
 public void Test_CreateUIFilterProperty_When_PropertyType_IsNoSpecific_ShouldHaveTextBox()
 {
     //---------------Set up test pack-------------------
     var uiFilterCreator = GetUIFilterCreator();
     IPropDef propDef = new PropDefFake(typeof(object));
     //---------------Assert Precondition----------------
     Assert.AreSame(typeof(object), propDef.PropertyType);
     //---------------Execute Test ----------------------
     var filterPropertyDef = uiFilterCreator.CreateUIFilterProperty(propDef);
     //---------------Test Result -----------------------
     AssertIsControlOfType("StringTextBoxFilter", "Habanero.Faces.Base", filterPropertyDef);
 }
 public void Test_CreateUIFilterProperty_When_PropertyType_IsDateTime_ShouldHaveDateTimePicker()
 {
     //---------------Set up test pack-------------------
     var uiFilterCreator = GetUIFilterCreator();
     IPropDef propDef = new PropDefFake(typeof(DateTime));
     //---------------Assert Precondition----------------
     Assert.AreSame(typeof(DateTime), propDef.PropertyType);
     //---------------Execute Test ----------------------
     var filterPropertyDef = uiFilterCreator.CreateUIFilterProperty(propDef);
     //---------------Test Result -----------------------
     AssertIsControlOfType("DateTimePickerFilter", "Habanero.Faces.Base", filterPropertyDef);
 }
        public void Test_CreateUIFilterProperty_ShouldReturnIFilterPropertyDef()
        {
            //---------------Set up test pack-------------------
            var uiFilterCreator = GetUIFilterCreator();
            IPropDef propDef = new PropDefFake(typeof(string));
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var filterPropertyDef = uiFilterCreator.CreateUIFilterProperty(propDef);
            //---------------Test Result -----------------------
            Assert.IsNotNull(filterPropertyDef);
        }
 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_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);
 }
 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_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_CreateUIFilterProperty_When_PropertyType_IsNonSpecific_ShouldHaveFilterClauseOperator_OpLike()
 {
     //---------------Set up test pack-------------------
     var uiFilterCreator = GetUIFilterCreator();
     IPropDef propDef = new PropDefFake(typeof(object));
     //---------------Assert Precondition----------------
     Assert.AreSame(typeof(object), propDef.PropertyType);
     //---------------Execute Test ----------------------
     var filterPropertyDef = uiFilterCreator.CreateUIFilterProperty(propDef);
     //---------------Test Result -----------------------
     Assert.AreEqual(FilterClauseOperator.OpLike, filterPropertyDef.FilterClauseOperator);
 }
 public void Test_CreateUIFilterProperty_When_PropertyType_HasLookupList_ShouldHaveFilterClauseOperator_OpEquals()
 {
     //---------------Set up test pack-------------------
     var uiFilterCreator = GetUIFilterCreator();
     IPropDef propDef = new PropDefFake
     {
         LookupList = new SimpleLookupList(new Dictionary<string, string>())
     };
     //---------------Assert Precondition----------------
     Assert.IsTrue(propDef.HasLookupList(), "Prop Def should have lookupList");
     //---------------Execute Test ----------------------
     var filterPropertyDef = uiFilterCreator.CreateUIFilterProperty(propDef);
     //---------------Test Result -----------------------
     Assert.AreEqual(FilterClauseOperator.OpEquals, filterPropertyDef.FilterClauseOperator);
 }
 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);
 }