コード例 #1
0
	public void run()
	{
		Exception exp = null;
		ProtectedTestClass dt = new ProtectedTestClass(); 

		EventRaised = false;
		dt.OnColumnChanging_Test();
		try
		{
			BeginCase("OnColumnChanging Event 1");
			Compare(EventRaised ,false );
		}
		catch(Exception ex)	{exp = ex;}
		finally	{EndCase(exp); exp = null;}
		EventRaised = false;
		EventValues = false;
		dt.ColumnChanging  += new DataColumnChangeEventHandler(OnColumnChanging_Handler);
		dt.OnColumnChanging_Test();
		try
		{
			BeginCase("OnColumnChanging Event 2");
			Compare(EventRaised ,true );
		}
		catch(Exception ex)	{exp = ex;}
		finally	{EndCase(exp); exp = null;}
		try
		{
			BeginCase("OnColumnChanging Values");
			Compare(EventValues ,true );
		}
		catch(Exception ex)	{exp = ex;}
		finally	{EndCase(exp); exp = null;}
		dt.ColumnChanging -= new DataColumnChangeEventHandler(OnColumnChanging_Handler);

	}
コード例 #2
0
        public void run()
        {
            Exception          exp = null;
            ProtectedTestClass dt  = new ProtectedTestClass();

            EventRaised = false;
            dt.OnColumnChanging_Test();
            try
            {
                BeginCase("OnColumnChanging Event 1");
                Compare(EventRaised, false);
            }
            catch (Exception ex)     { exp = ex; }
            finally { EndCase(exp); exp = null; }
            EventRaised        = false;
            EventValues        = false;
            dt.ColumnChanging += new DataColumnChangeEventHandler(OnColumnChanging_Handler);
            dt.OnColumnChanging_Test();
            try
            {
                BeginCase("OnColumnChanging Event 2");
                Compare(EventRaised, true);
            }
            catch (Exception ex)     { exp = ex; }
            finally { EndCase(exp); exp = null; }
            try
            {
                BeginCase("OnColumnChanging Values");
                Compare(EventValues, true);
            }
            catch (Exception ex)     { exp = ex; }
            finally { EndCase(exp); exp = null; }
            dt.ColumnChanging -= new DataColumnChangeEventHandler(OnColumnChanging_Handler);
        }
コード例 #3
0
        public void ProtectedClassTest()
        {
            var o  = new ProtectedTestClass();
            var pi = CreatePI <int, ProtectedTestClass>("Int");

            pi.Set(o, 50);
            Assert.AreEqual(50, o.Int);
            Assert.AreEqual(50, pi.Get(o));
        }
コード例 #4
0
        public void IsImmutable_object_ProtectedTestClass()
        {
            //Arrange
            var    validator = new ImmutableValidator();
            object target    = new ProtectedTestClass();

            //Act
            var actual = validator.IsImmutable(target);

            //Assert
            Assert.True(actual);
        }
コード例 #5
0
	//Activate This Construntor to log All To Standard output
	//public TestClass():base(true){}

	//Activate this constructor to log Failures to a log file
	//public TestClass(System.IO.TextWriter tw):base(tw, false){}


	//Activate this constructor to log All to a log file
	//public TestClass(System.IO.TextWriter tw):base(tw, true){}

	//BY DEFAULT LOGGING IS DONE TO THE STANDARD OUTPUT ONLY FOR FAILURES

	public void run()
	{
		Exception exp = null;

		try
		{
			BeginCase("CreateInstance");
			ProtectedTestClass C = new ProtectedTestClass();
			DataTable dt = C.CreateInstance_Test();
			Compare(dt != null ,true );
		}
		catch(Exception ex)	{exp = ex;}
		finally	{EndCase(exp); exp = null;}
	}
コード例 #6
0
        //Activate This Construntor to log All To Standard output
        //public TestClass():base(true){}

        //Activate this constructor to log Failures to a log file
        //public TestClass(System.IO.TextWriter tw):base(tw, false){}


        //Activate this constructor to log All to a log file
        //public TestClass(System.IO.TextWriter tw):base(tw, true){}

        //BY DEFAULT LOGGING IS DONE TO THE STANDARD OUTPUT ONLY FOR FAILURES

        public void run()
        {
            Exception exp = null;

            try
            {
                BeginCase("CreateInstance");
                ProtectedTestClass C  = new ProtectedTestClass();
                DataTable          dt = C.CreateInstance_Test();
                Compare(dt != null, true);
            }
            catch (Exception ex)     { exp = ex; }
            finally { EndCase(exp); exp = null; }
        }
コード例 #7
0
        //Activate This Construntor to log All To Standard output
        //public TestClass():base(true){}

        //Activate this constructor to log Failures to a log file
        //public TestClass(System.IO.TextWriter tw):base(tw, false){}


        //Activate this constructor to log All to a log file
        //public TestClass(System.IO.TextWriter tw):base(tw, true){}

        //BY DEFAULT LOGGING IS DONE TO THE STANDARD OUTPUT ONLY FOR FAILURES

        //private DataRowAction drExpectedAction;
        public void run()
        {
            Exception          exp = null;
            ProtectedTestClass dt  = new ProtectedTestClass();

            try
            {
                Exception tmpEx = null;
                base.BeginCase("OnRemoveColumn ");
                try
                {
                    dt.OnRemoveColumn_Test();
                }
                catch (Exception ex)     { tmpEx = ex; }
                finally
                {
                    base.Compare(tmpEx, null);
                }
            }
            catch (Exception ex)     { exp = ex; }
            finally { base.EndCase(exp); exp = null; }
        }
コード例 #8
0
	//Activate This Construntor to log All To Standard output
	//public TestClass():base(true){}

	//Activate this constructor to log Failures to a log file
	//public TestClass(System.IO.TextWriter tw):base(tw, false){}


	//Activate this constructor to log All to a log file
	//public TestClass(System.IO.TextWriter tw):base(tw, true){}

	//BY DEFAULT LOGGING IS DONE TO THE STANDARD OUTPUT ONLY FOR FAILURES

	//private DataRowAction drExpectedAction;
	public void run()
	{
		Exception exp = null;
		ProtectedTestClass dt = new ProtectedTestClass(); 

		try
		{
			Exception tmpEx = null;
			base.BeginCase("OnRemoveColumn ");
			try
			{
				dt.OnRemoveColumn_Test();
			}
			catch(Exception ex)	{tmpEx = ex;}
			finally	
			{
				base.Compare(tmpEx ,null);
			} 
		}
		catch(Exception ex)	{exp = ex;}
		finally	{base.EndCase(exp); exp = null;}
	}
コード例 #9
0
		public void OnRemoveColumn ()
		{
			ProtectedTestClass dt = new ProtectedTestClass();
			dt.OnRemoveColumn_Test();
		}
コード例 #10
0
		public void OnColumnChanging ()
		{
			ProtectedTestClass dt = new ProtectedTestClass ();

			EventRaised = false;
			dt.OnColumnChanging_Test ();
			// OnColumnChanging Event 1
			Assert.AreEqual (false, EventRaised, "DT92");
			EventRaised = false;
			EventValues = false;
			dt.ColumnChanging  += new DataColumnChangeEventHandler(OnColumnChanging_Handler);
			dt.OnColumnChanging_Test();
			// OnColumnChanging Event 2
			Assert.AreEqual (true, EventRaised, "DT93");
			// OnColumnChanging Values
			Assert.AreEqual (true, EventValues, "DT94");
			dt.ColumnChanging -= new DataColumnChangeEventHandler (OnColumnChanging_Handler);
		}
コード例 #11
0
		public void OnColumnChanged ()
		{
			ProtectedTestClass dt = new ProtectedTestClass();

			EventRaised = false;
			dt.OnColumnChanged_Test ();
			// OnColumnChanged Event 1
			Assert.AreEqual (false, EventRaised, "DT89");
			EventRaised = false;
			EventValues = false;
			dt.ColumnChanged += new DataColumnChangeEventHandler (OnColumnChanged_Handler);
			dt.OnColumnChanged_Test();
			// OnColumnChanged Event 2
			Assert.AreEqual (true, EventRaised, "DT90");
			// OnColumnChanged Values
			Assert.AreEqual (true, EventValues, "DT91");
			dt.ColumnChanged -= new DataColumnChangeEventHandler (OnColumnChanged_Handler);
		}
コード例 #12
0
		public void CreateInstance ()
		{
			// CreateInstance
			ProtectedTestClass C = new ProtectedTestClass();
			DataTable dt = C.CreateInstance_Test();
			Assert.IsNotNull(dt, "DT36");
		}
コード例 #13
0
		public void OnRowDeleting ()
		{
			ProtectedTestClass dt = new ProtectedTestClass();

			EventRaised = false;
			dt.OnRowDeleting_Test (DataRowAction.Nothing);

			Assert.IsFalse (EventRaised, "DT190");

			dt.RowDeleting += new DataRowChangeEventHandler(OnRowDeleting_Handler);
			foreach (int i in Enum.GetValues (typeof(DataRowAction))) {
				EventRaised = false;
				EventValues = false;
				drExpectedAction = (DataRowAction) i;
				dt.OnRowDeleting_Test (drExpectedAction);

				Assert.IsTrue (EventRaised, "DT191");
				Assert.IsTrue (EventValues, "DT192");
			}
			dt.RowDeleting -= new DataRowChangeEventHandler(OnRowDeleting_Handler);
		}