changeset 134:4e1a477c38d8

Re #27: Unit requirements * Tidy up line endings * Fix unit tests to mask (logical AND) instead of ORing
author IBBoard <dev@ibboard.co.uk>
date Fri, 22 Apr 2011 10:30:26 +0000
parents f64742dde5f9
children 8c3bba80a25e
files API/Objects/Requirement/ValidationTests.cs
diffstat 1 files changed, 41 insertions(+), 37 deletions(-) [+]
line diff
     1.1 --- a/API/Objects/Requirement/ValidationTests.cs	Sun Apr 17 20:07:57 2011 +0000
     1.2 +++ b/API/Objects/Requirement/ValidationTests.cs	Fri Apr 22 10:30:26 2011 +0000
     1.3 @@ -1,8 +1,8 @@
     1.4 -// This file (ValidationTests.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2011 IBBoard
     1.5 +// This file (ValidationTests.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2011 IBBoard
     1.6  // 
     1.7  // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license.
     1.8  using System;
     1.9 -using NUnit.Framework;
    1.10 +using NUnit.Framework;
    1.11  using NUnit.Framework.SyntaxHelpers;
    1.12  
    1.13  namespace IBBoard.WarFoundry.API.Objects.Requirement
    1.14 @@ -12,42 +12,46 @@
    1.15  	{
    1.16  		[Test()]
    1.17  		public void TestEnumValuesAreDifferent()
    1.18 -		{
    1.19 -			foreach(Validation val1 in Enum.GetValues(typeof(Validation)))
    1.20 -			{
    1.21 -				foreach(Validation val2 in Enum.GetValues(typeof(Validation)))
    1.22 -				{
    1.23 -					Assert.That(val1.Equals(val2) || ((int)val1) != ((int)val2));
    1.24 -				}
    1.25 +		{
    1.26 +			foreach(Validation val1 in Enum.GetValues(typeof(Validation)))
    1.27 +			{
    1.28 +				foreach(Validation val2 in Enum.GetValues(typeof(Validation)))
    1.29 +				{
    1.30 +					Assert.That(val1.Equals(val2) || ((int)val1) != ((int)val2));
    1.31 +				}
    1.32  			}
    1.33 -		}
    1.34 -
    1.35 -		public void TestPassAndNAAreTreatedAsPass()
    1.36 -		{
    1.37 -			Validation mask = Validation.Passed;
    1.38 -			Assert.That(Validation.Passed | mask, Is.EqualTo(Validation.Passed));
    1.39 -			Assert.That(Validation.NotApplicable | mask, Is.EqualTo(Validation.Passed));
    1.40 -		}
    1.41 -
    1.42 -		public void TestFailedAndNAAreTreatedAsFailed()
    1.43 -		{
    1.44 -			Validation mask = Validation.Failed;
    1.45 -			Assert.That(Validation.Failed | mask, Is.EqualTo(Validation.Failed));
    1.46 -			Assert.That(Validation.NotApplicable | mask, Is.EqualTo(Validation.Failed));
    1.47 -		}
    1.48 -
    1.49 -		public void TestValidatesAsOkaySuccedesForPassedAndNA()
    1.50 -		{
    1.51 -			Assert.That(Validates.AsOkay(Validation.Passed), Is.True);
    1.52 -			Assert.That(Validates.AsOkay(Validation.NotApplicable), Is.True);
    1.53 -			Assert.That(Validates.AsOkay(Validation.Failed), Is.False);
    1.54 -		}
    1.55 -
    1.56 -		public void TestValidatesAsNotOkaySuccedesForFailedAndNA()
    1.57 -		{
    1.58 -			Assert.That(Validates.AsNotOkay(Validation.Failed), Is.True);
    1.59 -			Assert.That(Validates.AsNotOkay(Validation.NotApplicable), Is.True);
    1.60 -			Assert.That(Validates.AsNotOkay(Validation.Passed), Is.False);
    1.61 +		}
    1.62 +
    1.63 +		[Test()]
    1.64 +		public void TestPassAndNAAreTreatedAsPass()
    1.65 +		{
    1.66 +			Validation mask = Validation.Passed;
    1.67 +			Assert.That(Validation.Passed & mask, Is.EqualTo(Validation.Passed));
    1.68 +			Assert.That(Validation.NotApplicable & mask, Is.EqualTo(Validation.Passed));
    1.69 +		}
    1.70 +
    1.71 +		[Test()]
    1.72 +		public void TestFailedAndNAAreTreatedAsFailed()
    1.73 +		{
    1.74 +			Validation mask = Validation.Failed;
    1.75 +			Assert.That(Validation.Failed & mask, Is.EqualTo(Validation.Failed));
    1.76 +			Assert.That(Validation.NotApplicable & mask, Is.EqualTo(Validation.Failed));
    1.77 +		}
    1.78 +
    1.79 +		[Test()]
    1.80 +		public void TestValidatesAsOkaySuccedesForPassedAndNA()
    1.81 +		{
    1.82 +			Assert.That(Validates.AsOkay(Validation.Passed), Is.True);
    1.83 +			Assert.That(Validates.AsOkay(Validation.NotApplicable), Is.True);
    1.84 +			Assert.That(Validates.AsOkay(Validation.Failed), Is.False);
    1.85 +		}
    1.86 +
    1.87 +		[Test()]
    1.88 +		public void TestValidatesAsNotOkaySuccedesForFailedAndNA()
    1.89 +		{
    1.90 +			Assert.That(Validates.AsNotOkay(Validation.Failed), Is.True);
    1.91 +			Assert.That(Validates.AsNotOkay(Validation.NotApplicable), Is.True);
    1.92 +			Assert.That(Validates.AsNotOkay(Validation.Passed), Is.False);
    1.93  		}
    1.94  	}
    1.95  }