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);

	}
        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);
        }
        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; }
        }
        //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; }
        }
	//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;}
	}
		public void OnRemoveColumn ()
		{
			ProtectedTestClass dt = new ProtectedTestClass();
			dt.OnRemoveColumn_Test();
		}
		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);
		}
		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);
		}
		public void CreateInstance ()
		{
			// CreateInstance
			ProtectedTestClass C = new ProtectedTestClass();
			DataTable dt = C.CreateInstance_Test();
			Assert.IsNotNull(dt, "DT36");
		}
		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);
		}