Example #1
0
 //=====================
 // Equality
 //=====================
 public override bool Equals(Object obj)
 {
     //Check for null and compare run-time types.
     if ((obj == null) || !this.GetType().Equals(obj.GetType()))
     {
         return(false);
     }
     else
     {
         // the equality of one property will suffice
         ReferenceObject otherObject = (ReferenceObject)obj;
         return(this.StringProperty.Equals(otherObject.StringProperty));
     }
 }
Example #2
0
        public static void Main(string[] args)
        {
            /*
             * This code should not be construed as test code.
             * It simply provides some basic console output to validate a successful build and execution.
             */
            Console.WriteLine("Dubrovnik unit test executable assembly loaded.");
            Console.WriteLine(string.Format("Framework version used : {0}", Environment.Version));

            bool doConsoleOutput = false;

            if (doConsoleOutput)
            {
                // create refObject
                ReferenceObject refObject = new ReferenceObject(".ctor called with", "two strings");

                // Define event handler and raise event
                refObject.UnitTestEvent1 += new EventHandler(TestEventHandler);
                refObject.RaiseUnitTestEvent1();

                // exercise refObject
                Console.WriteLine("Date: {0}", refObject.Date.ToString());
                Console.WriteLine("DecimalNumber: {0}", refObject.DecimalNumber.ToString());
                Console.WriteLine("Int: {0}", refObject.IntNumber);
                Console.WriteLine("Int32: {0}", refObject.Int32Number);
                Console.WriteLine("Int64: {0}", refObject.Int64Number);
                Console.WriteLine(refObject.MixedMethod1(1, 2, 3.0f, 4.0, refObject.Date, "MixedMethod", refObject));

                // confirm extensions accessible
                string extensionString = refObject.ExtensionString();
                Console.WriteLine(extensionString);

                // int ref methods
                int value1 = 1;
                int value2 = 1;
                refObject.DoubleIt(ref value2);
                Console.WriteLine("{0} doubled is {1}", value1, value2);
            }
        }
Example #3
0
		public static void Main (string[] args)
		{
			/*
			 * This code should not be construed as test code.
			 * It simply provides some basic console output to validate a successful build and execution.
			 */
			Console.WriteLine ("Dubrovnik unit test executable assembly loaded.");
			Console.WriteLine(string.Format("Framework version used : {0}", Environment.Version));

			bool doConsoleOutput = false;
			if (doConsoleOutput) {

				// create refObject
				ReferenceObject refObject = new ReferenceObject (".ctor called with", "two strings");

				// Define event handler and raise event
				refObject.UnitTestEvent1 += new EventHandler (TestEventHandler);
				refObject.RaiseUnitTestEvent1 ();

				// exercise refObject
				Console.WriteLine ("Date: {0}", refObject.Date.ToString ());
				Console.WriteLine ("DecimalNumber: {0}", refObject.DecimalNumber.ToString ());
				Console.WriteLine ("Int: {0}", refObject.IntNumber);
				Console.WriteLine ("Int32: {0}", refObject.Int32Number);
				Console.WriteLine ("Int64: {0}", refObject.Int64Number);
				Console.WriteLine (refObject.MixedMethod1 (1, 2, 3.0f, 4.0, refObject.Date, "MixedMethod", refObject));

				// confirm extensions accessible
				string extensionString = refObject.ExtensionString ();
				Console.WriteLine (extensionString);

				// int ref methods
				int value1 = 1;
				int value2 = 1;
				refObject.DoubleIt (ref value2);
				Console.WriteLine ("{0} doubled is {1}", value1, value2);
			}

		}
Example #4
0
        //
        // mixed parameter method
        //
		public string MixedMethod1(int intarg, long longArg, float floatArg, double doubleArg, DateTime dateArg, string stringArg, ReferenceObject refObjectArg) {
			string s = String.Format ("Dubrovnik.UnitTests.MixedMethod1 int: {0} long: {1} float:{2} double: {3} DateTime: {4} string: {5} ReferenceObject:{6}",
			                          intarg, longArg, floatArg, doubleArg, dateArg, stringArg, refObjectArg);
			return s;
		}
Example #5
0
        //
        // mixed parameter method
        //
        public string MixedMethod1(int intarg, long longArg, float floatArg, double doubleArg, DateTime dateArg, string stringArg, ReferenceObject refObjectArg)
        {
            string s = String.Format("Dubrovnik.UnitTests.MixedMethod1 int: {0} long: {1} float:{2} double: {3} DateTime: {4} string: {5} ReferenceObject:{6}",
                                     intarg, longArg, floatArg, doubleArg, dateArg, stringArg, refObjectArg);

            return(s);
        }