public void PrepareValidation()
        {
            Invoker.InitRecursive();

            _editableRow.DataSourceFactory = new EditableRowDataSourceFactory();
            _editableRow.ControlFactory    = EditableRowControlFactory.CreateEditableRowControlFactory();

            BocColumnDefinition[] columns = new BocColumnDefinition[3];
            columns[0] = _typeWithAllDataTypesStringValueSimpleColumn;
            columns[1] = _typeWithAllDataTypesInt32ValueSimpleColumn;
            columns[2] = _commandColumn;

            _editableRow.CreateControls(_value01, columns);
            _editableRow.EnsureValidatorsRestored();

            IBusinessObjectReferenceDataSource dataSource = _editableRow.GetDataSource();

            dataSource.LoadValues(false);

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

            _editableRow.PrepareValidation();

            Assert.That(stringValueField.Text, Is.EqualTo(stringValueField.Text));
            Assert.That(int32ValueField.Text, Is.EqualTo(int32ValueField.Text));
        }
        public void IsDirty()
        {
            Invoker.InitRecursive();

            _editableRow.DataSourceFactory = new EditableRowDataSourceFactory();
            _editableRow.ControlFactory    = EditableRowControlFactory.CreateEditableRowControlFactory();

            BocColumnDefinition[] columns = new BocColumnDefinition[3];
            columns[0] = _typeWithAllDataTypesStringValueSimpleColumn;
            columns[1] = _typeWithAllDataTypesInt32ValueSimpleColumn;
            columns[2] = _commandColumn;

            _editableRow.CreateControls(_value01, columns);

            IBusinessObjectReferenceDataSource dataSource = _editableRow.GetDataSource();

            dataSource.LoadValues(false);

            Assert.That(_editableRow.IsDirty(), Is.False);

            BocTextValue textBoxStringValue = (BocTextValue)_editableRow.GetEditControl(0);

            textBoxStringValue.Value = "a";

            Assert.That(_editableRow.IsDirty(), Is.True);
        }
        public void GetTrackedIDs()
        {
            Invoker.InitRecursive();

            _editableRow.DataSourceFactory = new EditableRowDataSourceFactory();
            _editableRow.ControlFactory    = EditableRowControlFactory.CreateEditableRowControlFactory();

            BocColumnDefinition[] columns = new BocColumnDefinition[3];
            columns[0] = _typeWithAllDataTypesStringValueSimpleColumn;
            columns[1] = _typeWithAllDataTypesInt32ValueSimpleColumn;
            columns[2] = _commandColumn;

            _editableRow.CreateControls(_value01, columns);

            IBusinessObjectReferenceDataSource dataSource = _editableRow.GetDataSource();

            dataSource.LoadValues(false);

            string id = "NamingContainer_Row_{0}_Value";

            string[] trackedIDs = new string[2];
            trackedIDs[0] = string.Format(id, 0);
            trackedIDs[1] = string.Format(id, 1);

            Assert.That(_editableRow.GetTrackedClientIDs(), Is.EqualTo(trackedIDs));
        }
        public void SaveValue()
        {
            Invoker.InitRecursive();

            _editableRow.DataSourceFactory = new EditableRowDataSourceFactory();
            _editableRow.ControlFactory    = EditableRowControlFactory.CreateEditableRowControlFactory();

            BocColumnDefinition[] columns = new BocColumnDefinition[2];
            columns[0] = _typeWithAllDataTypesStringValueSimpleColumn;
            columns[1] = _typeWithAllDataTypesInt32ValueSimpleColumn;

            _editableRow.CreateControls(_value01, columns);

            IBusinessObjectReferenceDataSource dataSource = _editableRow.GetDataSource();

            dataSource.LoadValues(false);

            BocTextValue textBoxStringValue = (BocTextValue)_editableRow.GetEditControl(0);
            BocTextValue textBoxInt32Value  = (BocTextValue)_editableRow.GetEditControl(1);

            Assert.That(textBoxStringValue.Value, Is.EqualTo("A"));
            Assert.That(textBoxInt32Value.Value, Is.EqualTo(1));

            textBoxStringValue.Value = "New Value A";
            textBoxInt32Value.Value  = "100";

            dataSource.SaveValues(false);

            Assert.That(((TypeWithAllDataTypes)_value01).String, Is.EqualTo("New Value A"));
            Assert.That(((TypeWithAllDataTypes)_value01).Int32, Is.EqualTo(100));
        }
        public void ValidateWithInvalidValues()
        {
            Invoker.InitRecursive();

            _editableRow.DataSourceFactory = new EditableRowDataSourceFactory();
            _editableRow.ControlFactory    = EditableRowControlFactory.CreateEditableRowControlFactory();

            BocColumnDefinition[] columns = new BocColumnDefinition[3];
            columns[0] = _typeWithAllDataTypesStringValueSimpleColumn;
            columns[1] = _typeWithAllDataTypesInt32ValueSimpleColumn;
            columns[2] = _commandColumn;

            _editableRow.CreateControls(_value01, columns);
            _editableRow.EnsureValidatorsRestored();

            IBusinessObjectReferenceDataSource dataSource = _editableRow.GetDataSource();

            dataSource.LoadValues(false);

            SetValues(_editableRow, "A", "");

            Assert.That(_editableRow.Validate(), Is.False);
        }