public void TestAddRowP_RowValueDBNull_BOProp_DateTime_NUll_ShouldNotRaiseException_FIXBUG()
        {
            //---------------Set up test pack-------------------
            BORegistry.DataAccessor = new DataAccessorInMemory();
            SetupTestData();
            BusinessObjectCollection <MyBO> boCollection = new BusinessObjectCollection <MyBO>();

            _dataSetProvider = new EditableDataSetProvider(boCollection);
            BOMapper mapper = new BOMapper(boCollection.ClassDef.CreateNewBusinessObject());

            itsTable = _dataSetProvider.GetDataTable(mapper.GetUIDef().UIGrid);

            //--------------Assert PreConditions----------------
            Assert.AreEqual(0, boCollection.Count);
            Assert.AreEqual(0, boCollection.PersistedBusinessObjects.Count, "Should be no created items to start");
//            Assert.AreEqual(0, boCollection.CreatedBusinessObjects.Count, "Should be no created items to start");

            //---------------Execute Test ----------------------
            itsTable.Rows.Add(new object[] { DBNull.Value, DBNull.Value, DBNull.Value });
            //---------------Test Result -----------------------
            Assert.AreEqual
                (1, boCollection.PersistedBusinessObjects.Count,
                "Adding a row to the table should use the collection to create the object");
//            Assert.AreEqual
//                (1, boCollection.CreatedBusinessObjects.Count,
//                 "Adding a row to the table should use the collection to create the object");
            Assert.AreEqual(1, boCollection.Count, "Adding a row to the table should add a bo to the main collection");
        }
        public void TestAddRowP_RowValueDBNull_VirtualProp_NUll_ShouldNotRaiseException_FIXBUG()
        {
            //---------------Set up test pack-------------------
            BORegistry.DataAccessor = new DataAccessorInMemory();
            ClassDef.ClassDefs.Clear();
            IClassDef classDef = MyBO.LoadClassDefWithUIAllDataTypes();

            classDef.UIDefCol["default"].UIGrid.Add(new UIGridColumn("VirtualProp", "-TestProp-", typeof(DataGridViewTextBoxColumn), true, 100, PropAlignment.left, new Hashtable()));
            BusinessObjectCollection <MyBO> boCollection = new BusinessObjectCollection <MyBO>();

            _dataSetProvider = new EditableDataSetProvider(boCollection);
            BOMapper mapper = new BOMapper(boCollection.ClassDef.CreateNewBusinessObject());

            itsTable = _dataSetProvider.GetDataTable(mapper.GetUIDef().UIGrid);

            //--------------Assert PreConditions----------------
            Assert.AreEqual(0, boCollection.Count);
            Assert.AreEqual(0, boCollection.PersistedBusinessObjects.Count, "Should be no created items to start");
            //            Assert.AreEqual(0, boCollection.CreatedBusinessObjects.Count, "Should be no created items to start");

            //---------------Execute Test ----------------------
            itsTable.Rows.Add(new object[] { DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value, DBNull.Value });
            //---------------Test Result -----------------------
            Assert.IsFalse(itsTable.Rows[0].HasErrors);
            //Behaviour has been changed to persist the business object
            Assert.AreEqual
                (1, boCollection.PersistedBusinessObjects.Count,
                "Adding a row to the table should use the collection to create the object");
            //            Assert.AreEqual
            //                (1, boCollection.CreatedBusinessObjects.Count,
            //                 "Adding a row to the table should use the collection to create the object");
            Assert.AreEqual(1, boCollection.Count, "Adding a row to the table should add a bo to the main collection");
        }
        public void TestAddRowCreatesBusinessObjectThroughCollection()
        {
            SetupTestData();
            //---------------Set up test pack-------------------
            BusinessObjectCollection <MyBO> boCollection = new BusinessObjectCollection <MyBO>();
            MyBO bo = new MyBO();

            bo.SetPropertyValue("TestProp", "bo1prop1");
            bo.SetPropertyValue("TestProp2", "s1");
            bo.Save();
            boCollection.Add(bo);

            MyBO bo2 = new MyBO();

            bo2.SetPropertyValue("TestProp", "bo2prop1");
            bo2.SetPropertyValue("TestProp2", "s2");
            bo2.Save();
            boCollection.Add(bo2);

            _dataSetProvider = new EditableDataSetProvider(boCollection);
            BOMapper mapper = new BOMapper(boCollection.ClassDef.CreateNewBusinessObject());

            itsTable = _dataSetProvider.GetDataTable(mapper.GetUIDef().UIGrid);


            //--------------Assert PreConditions----------------
            Assert.AreEqual(2, boCollection.Count);
            Assert.AreEqual(0, boCollection.CreatedBusinessObjects.Count, "Should be no created items to start");

            //---------------Execute Test ----------------------
            itsTable.Rows.Add(new object[] { null, "bo3prop1", "bo3prop2" });

            //---------------Test Result -----------------------
            Assert.AreEqual
                (1, boCollection.CreatedBusinessObjects.Count,
                "Adding a row to the table should use the collection to create the object");
            //Assert.AreEqual(2, boCollection.Count, "Adding a row to the table should not add a bo to the main collection");
            Assert.AreEqual(3, boCollection.Count, "Adding a row to the table should add a bo to the main collection");
        }