public override void SetUp() { base.SetUp(); _editModeHost = new FakeEditModeHost(); _editModeHost.ID = "BocList"; _editModeHost.RowIDProvider = new FakeRowIDProvider(); _editModeHost.EditModeControlFactory = EditableRowControlFactory.CreateEditableRowControlFactory(); _editModeHost.EditModeDataSourceFactory = new EditableRowDataSourceFactory(); _editableRow = new EditableRow(_editModeHost); _editableRow.ID = "Row"; NamingContainer.Controls.Add(_editableRow); _value01 = (IBusinessObject)TypeWithAllDataTypes.Create("A", 1); _typeWithAllDataTypesClass = BindableObjectProviderTestHelper.GetBindableObjectClass(typeof(TypeWithAllDataTypes)); _typeWithAllDataTypesStringValuePath = BusinessObjectPropertyPath.CreateStatic(_typeWithAllDataTypesClass, "String"); _typeWithAllDataTypesInt32ValuePath = BusinessObjectPropertyPath.CreateStatic(_typeWithAllDataTypesClass, "Int32"); _typeWithAllDataTypesStringValueSimpleColumn = new BocSimpleColumnDefinition(); _typeWithAllDataTypesStringValueSimpleColumn.SetPropertyPath(_typeWithAllDataTypesStringValuePath); _typeWithAllDataTypesStringValueSimpleColumnAsDynamic = new BocSimpleColumnDefinition(); _typeWithAllDataTypesStringValueSimpleColumnAsDynamic.SetPropertyPath(BusinessObjectPropertyPath.CreateDynamic("StringValue")); _typeWithAllDataTypesStringValueSimpleColumnAsDynamic.IsDynamic = true; _typeWithAllDataTypesInt32ValueSimpleColumn = new BocSimpleColumnDefinition(); _typeWithAllDataTypesInt32ValueSimpleColumn.SetPropertyPath(_typeWithAllDataTypesInt32ValuePath); _typeWithAllDataTypesStringValueFirstValueCompoundColumn = new BocCompoundColumnDefinition(); _typeWithAllDataTypesStringValueFirstValueCompoundColumn.PropertyPathBindings.Add( new PropertyPathBinding(_typeWithAllDataTypesStringValuePath)); _typeWithAllDataTypesStringValueFirstValueCompoundColumn.PropertyPathBindings.Add( new PropertyPathBinding(_typeWithAllDataTypesStringValuePath)); _typeWithAllDataTypesStringValueFirstValueCompoundColumn.FormatString = "{0}, {1}"; _typeWithAllDataTypesStringValueCustomColumn = new BocCustomColumnDefinition(); _typeWithAllDataTypesStringValueCustomColumn.SetPropertyPath(_typeWithAllDataTypesStringValuePath); _typeWithAllDataTypesStringValueCustomColumn.IsSortable = true; _commandColumn = new BocCommandColumnDefinition(); _rowEditModeColumn = new BocRowEditModeColumnDefinition(); _dropDownMenuColumn = new BocDropDownMenuColumnDefinition(); }
public void GetComparer_WithPropertyPathNull() { var propertyPath1 = MockRepository.GenerateStub <IBusinessObjectPropertyPath>(); var column = new BocCompoundColumnDefinition(); column.PropertyPathBindings.Add(new PropertyPathBinding()); column.PropertyPathBindings.Add(new PropertyPathBinding(propertyPath1)); var comparer = ((IBocSortableColumnDefinition)column).CreateCellValueComparer(); Assert.That(comparer, Is.InstanceOf <CompoundComparer <BocListRow> >()); var comparers = ((CompoundComparer <BocListRow>)comparer).Comparers; Assert.That(comparers.Count, Is.EqualTo(2)); Assert.That(((BusinessObjectPropertyPathBasedComparer)comparers[0]).PropertyPath, Is.InstanceOf <NullBusinessObjectPropertyPath>()); Assert.That(((BusinessObjectPropertyPathBasedComparer)comparers[1]).PropertyPath, Is.SameAs(propertyPath1)); }