Ejemplo n.º 1
0
        private IUIGridColumn GetGridColumnStub(IClassDef classDef)
        {
            IUIGridColumn gridColumn = MockRepository.GenerateStub <IUIGridColumn>();

            gridColumn.PropertyName = RandomValueGen.GetRandomString();
            gridColumn.Stub(column => column.ClassDef).Return(classDef);
            return(gridColumn);
        }
Ejemplo n.º 2
0
        public void Test_DisplayName_ShouldBeGridColumnDisplayName()
        {
            //---------------Set up test pack-------------------
            IUIGridColumn gridColumn          = GetGridColumnStub();
            var           expectedDispalyName = RandomValueGen.GetRandomString();

            gridColumn.Stub(column => column.GetHeading()).Return(expectedDispalyName);
            PropertyDescriptor propDescriptor = new PropertyDescriptorPropDef(gridColumn);

            //---------------Assert Precondition----------------
            Assert.AreEqual(expectedDispalyName, gridColumn.GetHeading());
            //---------------Execute Test ----------------------
            var actualPropDescriptorDisplayName = propDescriptor.DisplayName;

            //---------------Test Result -----------------------
            Assert.AreEqual(expectedDispalyName, actualPropDescriptorDisplayName);
        }
Ejemplo n.º 3
0
        public void Test_PropertyType_ShouldReturnPropertyTypeFromColumn()
        {
            //---------------Set up test pack-------------------
            IUIGridColumn gridColumn       = GetGridColumnStub();
            Type          expectedPropType = typeof(DateTime);

            gridColumn.Stub(column => column.GetPropertyType()).Return(expectedPropType);

            PropertyDescriptorPropDef propDescriptor = new PropertyDescriptorPropDef(gridColumn);

            //---------------Assert Precondition----------------
            Assert.AreEqual(expectedPropType, gridColumn.GetPropertyType());
            //---------------Execute Test ----------------------
            var propertyType = propDescriptor.PropertyType;

            //---------------Test Result -----------------------
            Assert.AreEqual(expectedPropType, propertyType);
        }
Ejemplo n.º 4
0
        public void Test_LookupList_WhenSetOnProp_ShouldReturnList()
        {
            //---------------Set up test pack-------------------
            IUIGridColumn gridColumn         = GetGridColumnStub();
            ILookupList   expectedLookupList = MockRepository.GenerateStub <ILookupList>();

            gridColumn.Stub(column => column.LookupList).Return(expectedLookupList);

            PropertyDescriptorPropDef propDescriptor = new PropertyDescriptorPropDef(gridColumn);

            //---------------Assert Precondition----------------
            Assert.IsNotNull(gridColumn.LookupList);
            //---------------Execute Test ----------------------
            ILookupList lookupList = propDescriptor.LookupList;

            //---------------Test Result -----------------------
            Assert.AreSame(expectedLookupList, lookupList);
        }
        public void TestInitGrid_UIDef_CurrencyFormat_DataTypeDecimal_ShouldFormatColumn()
        {
            //---------------Set up test pack-------------------
            GridBaseInitialiserSpy gridInitialiser = new GridBaseInitialiserSpy(MockRepository.GenerateStub <IGridBase>(), MockRepository.GenerateStub <IControlFactory>());

            IUIGridColumn gridColumn     = MockRepository.GenerateStub <IUIGridColumn>();
            string        expectedFormat = "fdafasdfsda";

            gridColumn.Stub(column => column.GetParameterValue("currencyFormat")).Return(expectedFormat);
            IDataGridViewColumn gridViewColumn = MockRepository.GenerateStub <IDataGridViewColumn>();

            gridViewColumn.DefaultCellStyle = MockRepository.GenerateStub <IDataGridViewCellStyle>();
            //--------------Assert PreConditions----------------
            Assert.AreNotEqual(expectedFormat, gridViewColumn.DefaultCellStyle.Format);

            //---------------Execute Test ----------------------
            gridInitialiser.CallSetupCurrencyWithParameters(typeof(Decimal), gridColumn, gridViewColumn);

            //---------------Test Result -----------------------
            Assert.AreEqual(expectedFormat, gridViewColumn.DefaultCellStyle.Format);
        }