// ------------------------------------------------------------------

// Body.cs: Represents OCL testing for Body rules

// ------------------------------------------------------------------

// Project: C# and OCL Compiler

// Module:  Testing

// Author:  Dave Arnold

// Version: 1.0

// ------------------------------------------------------------------

 

// ------------------------------------------------------------------

// Imports

// ------------------------------------------------------------------

using System;

using System.Collections;

// ------------------------------------------------------------------

 

// ------------------------------------------------------------------

// DaveArnold.OCLTesting Namespace

// ------------------------------------------------------------------

namespace DaveArnold.OCLTesting

{

       // A Class to test Body rules

       class BodyTests

       {

              OCL

              [

                     "context BodyTests::Test1(): Integer"

                     "body: 2 * 2"

              ]

             

              OCL

              [

                     "context BodyTests::Test2 get : Integer"

                     "body: 4 / 2"

              ]

             

              OCL

              [

                     "context BodyTests::Test3(a : Integer, b : Integer) : Integer"

                     "body: a * b"

              ]

             

             

              public void RunTests()

              {

                     Console.WriteLine("---------------- BODY TESTS -----------------");

                     Console.WriteLine("B1 (Test1()[2*2]): {0}", this.Test1());

                     Console.WriteLine("B2 (Test2[4/2]): {0}", this.Test2);

                     Console.WriteLine("B3 (Test3(a, b)[a*b]: {0}", this.Test3(20, 20));

                     Console.WriteLine("------------ BODY TESTS COMPLETE ------------");

              }

       }

}

 

// ------------------------------------------------------------------

// EOF