public static bool testMethod()
            {
                if (Static_InstTestClass07.intI != 1)
                {
                    return(false);
                }
                Static_InstTestClass07 test1 = new Static_InstTestClass07();

                test1.increment();
                if (Static_InstTestClass07.intI != 2)
                {
                    return(false);
                }
                Static_InstTestClass07 test2 = new Static_InstTestClass07();

                test2.increment();
                if (Static_InstTestClass07.intI != 3)
                {
                    return(false);
                }
                Static_InstTestClass07 test3 = new Static_InstTestClass07();

                test3.increment();
                if (Static_InstTestClass07.intI != 4)
                {
                    return(false);
                }
                return(true);
            }
 public void Static_Inst07_Test()
 {
     OutputHelper.WriteLine(" Section 10.2 ");
     OutputHelper.WriteLine(" A static field identifies exactly one storage location.");
     OutputHelper.WriteLine(" No matter how many instances of a class are created,");
     OutputHelper.WriteLine(" there is only ever one copy of a static field.");
     Assert.True(Static_InstTestClass07.testMethod());
 }
 public MFTestResults Static_Inst07_Test()
 {
     Log.Comment(" Section 10.2 ");
     Log.Comment(" A static field identifies exactly one storage location.");
     Log.Comment(" No matter how many instances of a class are created,");
     Log.Comment(" there is only ever one copy of a static field.");
     if (Static_InstTestClass07.testMethod())
     {
         return(MFTestResults.Pass);
     }
     return(MFTestResults.Fail);
 }
Пример #4
0
            public static bool testMethod() {

		if (Static_InstTestClass07.intI != 1) return false;
		Static_InstTestClass07 test1 = new Static_InstTestClass07();
		test1.increment();
		if (Static_InstTestClass07.intI != 2) return false;			
		Static_InstTestClass07 test2 = new Static_InstTestClass07();
		test2.increment();
		if (Static_InstTestClass07.intI != 3) return false;
		Static_InstTestClass07 test3 = new Static_InstTestClass07();
		test3.increment();
		if (Static_InstTestClass07.intI != 4) return false;
		return true;
	}