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

// Def.cs: Represents OCL testing for Def 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 Def rules

       class DefTests

       {

              OCL

              [

                     "context DefTests"

                     "def: income : Integer = 45000"

              ]

             

              OCL

              [

                     "context DefTests"

                     "def: nickname : String = 'Little Red Rooster'"

              ]

             

              OCL

              [

                     "context DefTests"

                     "def: isNickName(t : String) : Boolean = t.size() > 0"

              ]

             

              public void RunTests()

              {

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

                     Console.WriteLine("D1 (income): {0}", income);

                     Console.WriteLine("D2 (nickname): {0}", nickname);

                     Console.WriteLine("D3 (isNickName): {0}", isNickName(nickname));

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

              }

       }

}

 

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

// EOF