コード例 #1
0
        private void SetValues(EditableRow row, string stringValue, string int32Value)
        {
            BocTextValue stringValueField = (BocTextValue)row.GetEditControl(0);

            stringValueField.Text = stringValue;

            BocTextValue int32ValueField = (BocTextValue)row.GetEditControl(1);

            int32ValueField.Text = int32Value;
        }
        public void GetFactoriesFromOwnerControl()
        {
            EditModeHost.EditModeDataSourceFactory = new EditableRowDataSourceFactory();
            EditModeHost.EditModeControlFactory    = EditableRowControlFactory.CreateEditableRowControlFactory();

            Invoker.InitRecursive();
            Controller.SwitchRowIntoEditMode(0, Columns);
            EditableRow row = (EditableRow)Controller.Controls[0];

            Assert.That(row.DataSourceFactory, Is.SameAs(EditModeHost.EditModeDataSourceFactory));
            Assert.That(row.ControlFactory, Is.SameAs(EditModeHost.EditModeControlFactory));
        }
コード例 #3
0
        protected void SetValues(EditableRow row, string stringValue, string int32Value)
        {
            ArgumentUtility.CheckNotNull("row", row);

            BocTextValue stringValueField = (BocTextValue)row.GetEditControl(0);

            stringValueField.Text = stringValue;

            BocTextValue int32ValueField = (BocTextValue)row.GetEditControl(1);

            int32ValueField.Text = int32Value;
        }
        public void IsDirty()
        {
            Invoker.InitRecursive();
            Controller.SwitchListIntoEditMode(Columns);

            EditableRow row = (EditableRow)Controller.Controls[2];

            Remotion.ObjectBinding.Web.UI.Controls.BocTextValue stringValueField =
                (Remotion.ObjectBinding.Web.UI.Controls.BocTextValue)row.GetEditControl(0);
            stringValueField.Value = "New Value";

            Assert.That(Controller.IsDirty(), Is.True);
        }
        public void PrepareValidation()
        {
            Invoker.InitRecursive();
            Controller.SwitchRowIntoEditMode(2, Columns);

            EditableRow editableRow = (EditableRow)Controller.Controls[0];

            BocTextValue stringValueField = (BocTextValue)editableRow.GetEditControl(0);
            BocTextValue int32ValueField  = (BocTextValue)editableRow.GetEditControl(1);

            Controller.PrepareValidation();

            Assert.That(stringValueField.Text, Is.EqualTo(stringValueField.Text));
            Assert.That(int32ValueField.Text, Is.EqualTo(int32ValueField.Text));
        }
コード例 #6
0
        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 PrepareValidation()
        {
            Invoker.InitRecursive();
            Controller.SwitchRowIntoEditMode(2, Columns);

            for (int i = 0; i < Controller.Controls.Count; i++)
            {
                EditableRow editableRow = (EditableRow)Controller.Controls[i];

                BocTextValue stringValueField = (BocTextValue)editableRow.GetEditControl(0);
                BocTextValue int32ValueField  = (BocTextValue)editableRow.GetEditControl(1);

                Controller.PrepareValidation();

                Assert.AreEqual(stringValueField.Text, stringValueField.Text, "Row {0}", i);
                Assert.AreEqual(int32ValueField.Text, int32ValueField.Text, "Row {0}", i);
            }
        }
        public void SwitchRowIntoEditMode()
        {
            Invoker.InitRecursive();
            Controller.SwitchRowIntoEditMode(2, Columns);

            Assert.That(Controller.IsRowEditModeActive, Is.True);
            Assert.That(Controller.GetEditedRow().Index, Is.EqualTo(2));

            Assert.That(Controller.Controls.Count, Is.EqualTo(1));
            Assert.That(Controller.Controls[0] is EditableRow, Is.True);

            EditableRow row = (EditableRow)Controller.Controls[0];

            Assert.That(row.ID, Is.EqualTo("Controller_Row_2"));

            Assert.That(ActualEvents.Count, Is.EqualTo(0));
            Assert.That(EditModeHost.FocusedControl, Is.Not.Null);
            Assert.That(EditModeHost.FocusedControl.FocusID, Is.EqualTo("NamingContainer_Controller_Row_2_0_Value"));
        }
        public void AddAndEditRow()
        {
            Invoker.InitRecursive();

            Assert.That(Controller.AddAndEditRow(NewValues[0], Columns), Is.True);

            Assert.That(Controller.IsRowEditModeActive, Is.True);
            Assert.That(Controller.GetEditedRow().Index, Is.EqualTo(5));
            Assert.That(EditModeHost.Value.Count, Is.EqualTo(6));
            Assert.That(EditModeHost.Value[5], Is.SameAs(NewValues[0]));

            Assert.That(Controller.Controls.Count, Is.EqualTo(1));
            Assert.That(Controller.Controls[0] is EditableRow, Is.True);

            EditableRow row = (EditableRow)Controller.Controls[0];

            Assert.That(row.ID, Is.EqualTo("Controller_Row_5"));

            Assert.That(ActualEvents.Count, Is.EqualTo(0));
            Assert.That(EditModeHost.FocusedControl, Is.Not.Null);
            Assert.That(EditModeHost.FocusedControl.FocusID, Is.EqualTo("NamingContainer_Controller_Row_5_0_Value"));
        }