public void TestManagerSetDataSourceWithEmptyStyle()
        {
            TestDataGrid dg = new TestDataGrid();

            dg.BindingContext = new BindingContext();

            DataSet   ds = new DataSet("DataSet");
            DataTable dt = new DataTable("MyTable");

            dt.Columns.Add("A", typeof(string));
            dt.NewRow();
            ds.Tables.Add(dt);

            // Add the style for the table we have, but leave it empty
            // - this is, no column styles
            DataGridTableStyle table_style = new DataGridTableStyle();

            table_style.MappingName = "MyTable";
            dg.TableStyles.Add(table_style);

            Assert.AreEqual(0, table_style.GridColumnStyles.Count, "#A1");

            dg.DataSource = dt;

            Assert.AreEqual(1, table_style.GridColumnStyles.Count, "#B1");
        }
        public void TestManagerSetDataSourceAfterSetBindingContext()
        {
            TestDataGrid dg = new TestDataGrid();

            data_source_changed_count = 0;
            dg.DataSourceChanged     += new EventHandler(OnDataSourceChanged);

            /* set our datasource to something */
            dg = new TestDataGrid();
            DataSet   ds = new DataSet("DataSet");
            DataTable dt = new DataTable("DataTable");

            ds.Tables.Add(dt);

            dg.DataMember = "DataTable";

            dg.BindingContext = new BindingContext();
            Assert.AreEqual(0, data_source_changed_count, "A1");

            CurrencyManager mgr = dg.Manager;

            dg.DataSource = ds;
            Assert.IsNotNull(dg.Manager, "A2");
            Assert.IsTrue(mgr != dg.Manager, "A3");
            Assert.AreEqual(0, data_source_changed_count, "A4");
        }
        public void TestManagerSetDataSourceAfterSetBindingContextWithHandle()
        {
            TestDataGrid dg = new TestDataGrid();

            data_source_changed_count = 0;
            dg.DataSourceChanged     += new EventHandler(OnDataSourceChanged);

            /* set our datasource to something */
            dg = new TestDataGrid();
            DataSet   ds = new DataSet("DataSet");
            DataTable dt = new DataTable("DataTable");

            ds.Tables.Add(dt);

            /* cause the control to create its handle and
             * see if that does anything */
            Assert.IsNotNull(dg.Handle, "A1");

            dg.DataSource = new ArrayList();

            dg.BindingContext = new BindingContext();
            Assert.AreEqual(0, data_source_changed_count, "A2");

            dg.DataSource = ds;
            Assert.AreEqual(0, data_source_changed_count, "A3");
        }
        public void TestManagerSetDataMember()
        {
            TestDataGrid dg = new TestDataGrid();

            data_source_changed_count = 0;
            dg.DataSourceChanged     += new EventHandler(OnDataSourceChanged);

            /* set the datamember to something */
            dg.DataMember = "hi there";
            Assert.IsNull(dg.Manager, "A1");
            // NotWorking Assert.AreEqual (0, data_source_changed_count, "A2");
        }
        public void TestManager1()
        {
            TestDataGrid dg = new TestDataGrid();

            data_source_changed_count = 0;
            dg.DataSourceChanged     += new EventHandler(OnDataSourceChanged);

            /* make sure everything is fine to start with */
            Assert.IsNull(dg.Manager, "A1");
            Assert.IsNull(dg.DataSource, "A2");
            Assert.AreEqual(dg.DataMember, "", "A3");
            // NotWorking Assert.AreEqual (0, data_source_changed_count, "A4");
        }
        public void TestManagerSetBindingContext()
        {
            TestDataGrid dg = new TestDataGrid();

            data_source_changed_count = 0;
            dg.DataSourceChanged     += new EventHandler(OnDataSourceChanged);

            /* set our datasource to something */
            dg = new TestDataGrid();
            DataSet   ds = new DataSet("DataSet");
            DataTable dt = new DataTable("DataTable");

            ds.Tables.Add(dt);

            dg.DataSource = ds;
            dg.DataMember = "DataTable";

            /* now set the BindingContext and see if something changes */
            dg.BindingContext = new BindingContext();
            Assert.IsNotNull(dg.Manager, "A1");
            Assert.AreEqual(0, data_source_changed_count, "A2");
        }
        public void TestManagerSetDataSource()
        {
            TestDataGrid dg = new TestDataGrid();

            data_source_changed_count = 0;
            dg.DataSourceChanged     += new EventHandler(OnDataSourceChanged);

            /* set our datasource to something */
            dg = new TestDataGrid();
            DataSet   ds = new DataSet("DataSet");
            DataTable dt = new DataTable("DataTable");

            ds.Tables.Add(dt);

            dg.DataSource = ds;
            Assert.IsNull(dg.Manager, "A1");

            /* set the datamember to something as well.. anything yet? */
            dg.DataMember = "DataTable";
            Assert.IsNull(dg.Manager, "A2");
            Assert.AreEqual(0, data_source_changed_count, "A3");
        }
Exemple #8
0
		public void TestManagerSetDataSourceAfterSetBindingContextWithHandle ()
		{
			TestDataGrid dg = new TestDataGrid ();

			data_source_changed_count = 0;
			dg.DataSourceChanged += new EventHandler (OnDataSourceChanged);

			/* set our datasource to something */
			dg = new TestDataGrid ();
			DataSet ds = new DataSet ("DataSet");
			DataTable dt = new DataTable ("DataTable");
			ds.Tables.Add (dt);

			/* cause the control to create its handle and
			 * see if that does anything */
			Assert.IsNotNull (dg.Handle, "A1");

			dg.DataSource = new ArrayList ();

			dg.BindingContext = new BindingContext ();
			Assert.AreEqual (0, data_source_changed_count, "A2");

			dg.DataSource = ds;
			Assert.AreEqual (0, data_source_changed_count, "A3");
		}
Exemple #9
0
		public void TestManagerSetDataSourceWithEmptyStyle ()
		{
			TestDataGrid dg = new TestDataGrid ();
			dg.BindingContext = new BindingContext ();

			DataSet ds = new DataSet ("DataSet");
			DataTable dt = new DataTable ("MyTable");
			dt.Columns.Add ("A", typeof (string));
			dt.NewRow ();
			ds.Tables.Add (dt);

			// Add the style for the table we have, but leave it empty
			// - this is, no column styles
			DataGridTableStyle table_style = new DataGridTableStyle ();
			table_style.MappingName = "MyTable";
			dg.TableStyles.Add (table_style);

			Assert.AreEqual (0, table_style.GridColumnStyles.Count, "#A1");

			dg.DataSource = dt;

			Assert.AreEqual (1, table_style.GridColumnStyles.Count, "#B1");
		}
Exemple #10
0
		public void TestManagerSetDataSourceAfterSetBindingContext ()
		{
			TestDataGrid dg = new TestDataGrid ();

			data_source_changed_count = 0;
			dg.DataSourceChanged += new EventHandler (OnDataSourceChanged);

			/* set our datasource to something */
			dg = new TestDataGrid ();
			DataSet ds = new DataSet ("DataSet");
			DataTable dt = new DataTable ("DataTable");
			ds.Tables.Add (dt);

			dg.DataMember = "DataTable";

			dg.BindingContext = new BindingContext ();
			Assert.AreEqual (0, data_source_changed_count, "A1");

			CurrencyManager mgr = dg.Manager;

			dg.DataSource = ds;
			Assert.IsNotNull (dg.Manager, "A2");
			Assert.IsTrue (mgr != dg.Manager, "A3");
			Assert.AreEqual (0, data_source_changed_count, "A4");
		}
Exemple #11
0
		public void TestManagerSetBindingContext ()
		{
			TestDataGrid dg = new TestDataGrid ();

			data_source_changed_count = 0;
			dg.DataSourceChanged += new EventHandler (OnDataSourceChanged);

			/* set our datasource to something */
			dg = new TestDataGrid ();
			DataSet ds = new DataSet ("DataSet");
			DataTable dt = new DataTable ("DataTable");
			ds.Tables.Add (dt);

			dg.DataSource = ds;
			dg.DataMember = "DataTable";

			/* now set the BindingContext and see if something changes */
			dg.BindingContext = new BindingContext ();
			Assert.IsNotNull (dg.Manager, "A1");
			Assert.AreEqual (0, data_source_changed_count, "A2");
		}
Exemple #12
0
		public void TestManagerSetDataSource ()
		{
			TestDataGrid dg = new TestDataGrid ();

			data_source_changed_count = 0;
			dg.DataSourceChanged += new EventHandler (OnDataSourceChanged);

			/* set our datasource to something */
			dg = new TestDataGrid ();
			DataSet ds = new DataSet ("DataSet");
			DataTable dt = new DataTable ("DataTable");
			ds.Tables.Add (dt);

			dg.DataSource = ds;
			Assert.IsNull (dg.Manager, "A1");

			/* set the datamember to something as well.. anything yet? */
			dg.DataMember = "DataTable";
			Assert.IsNull (dg.Manager, "A2");
			Assert.AreEqual (0, data_source_changed_count, "A3");
		}
Exemple #13
0
		public void TestManagerSetDataMember ()
		{
			TestDataGrid dg = new TestDataGrid ();

			data_source_changed_count = 0;
			dg.DataSourceChanged += new EventHandler (OnDataSourceChanged);

			/* set the datamember to something */
			dg.DataMember = "hi there";
			Assert.IsNull (dg.Manager, "A1");
			// NotWorking Assert.AreEqual (0, data_source_changed_count, "A2");
		}
Exemple #14
0
		public void TestManager1 ()
		{
			TestDataGrid dg = new TestDataGrid ();

			data_source_changed_count = 0;
			dg.DataSourceChanged += new EventHandler (OnDataSourceChanged);

			/* make sure everything is fine to start with */
			Assert.IsNull (dg.Manager, "A1");
			Assert.IsNull (dg.DataSource, "A2");
			Assert.AreEqual (dg.DataMember, "", "A3");
			// NotWorking Assert.AreEqual (0, data_source_changed_count, "A4");
		}