Mercurial > repos > IBDev-IBBoard.WarFoundry.API.Tests
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 wrap: on
line diff
--- a/API/Objects/Requirement/ValidationTests.cs Sun Apr 17 20:07:57 2011 +0000 +++ b/API/Objects/Requirement/ValidationTests.cs Fri Apr 22 10:30:26 2011 +0000 @@ -1,8 +1,8 @@ -// This file (ValidationTests.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2011 IBBoard +// This file (ValidationTests.cs) is a part of the IBBoard.WarFoundry.API.Tests project and is copyright 2011 IBBoard // // 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. using System; -using NUnit.Framework; +using NUnit.Framework; using NUnit.Framework.SyntaxHelpers; namespace IBBoard.WarFoundry.API.Objects.Requirement @@ -12,42 +12,46 @@ { [Test()] public void TestEnumValuesAreDifferent() - { - foreach(Validation val1 in Enum.GetValues(typeof(Validation))) - { - foreach(Validation val2 in Enum.GetValues(typeof(Validation))) - { - Assert.That(val1.Equals(val2) || ((int)val1) != ((int)val2)); - } + { + foreach(Validation val1 in Enum.GetValues(typeof(Validation))) + { + foreach(Validation val2 in Enum.GetValues(typeof(Validation))) + { + Assert.That(val1.Equals(val2) || ((int)val1) != ((int)val2)); + } } - } - - public void TestPassAndNAAreTreatedAsPass() - { - Validation mask = Validation.Passed; - Assert.That(Validation.Passed | mask, Is.EqualTo(Validation.Passed)); - Assert.That(Validation.NotApplicable | mask, Is.EqualTo(Validation.Passed)); - } - - public void TestFailedAndNAAreTreatedAsFailed() - { - Validation mask = Validation.Failed; - Assert.That(Validation.Failed | mask, Is.EqualTo(Validation.Failed)); - Assert.That(Validation.NotApplicable | mask, Is.EqualTo(Validation.Failed)); - } - - public void TestValidatesAsOkaySuccedesForPassedAndNA() - { - Assert.That(Validates.AsOkay(Validation.Passed), Is.True); - Assert.That(Validates.AsOkay(Validation.NotApplicable), Is.True); - Assert.That(Validates.AsOkay(Validation.Failed), Is.False); - } - - public void TestValidatesAsNotOkaySuccedesForFailedAndNA() - { - Assert.That(Validates.AsNotOkay(Validation.Failed), Is.True); - Assert.That(Validates.AsNotOkay(Validation.NotApplicable), Is.True); - Assert.That(Validates.AsNotOkay(Validation.Passed), Is.False); + } + + [Test()] + public void TestPassAndNAAreTreatedAsPass() + { + Validation mask = Validation.Passed; + Assert.That(Validation.Passed & mask, Is.EqualTo(Validation.Passed)); + Assert.That(Validation.NotApplicable & mask, Is.EqualTo(Validation.Passed)); + } + + [Test()] + public void TestFailedAndNAAreTreatedAsFailed() + { + Validation mask = Validation.Failed; + Assert.That(Validation.Failed & mask, Is.EqualTo(Validation.Failed)); + Assert.That(Validation.NotApplicable & mask, Is.EqualTo(Validation.Failed)); + } + + [Test()] + public void TestValidatesAsOkaySuccedesForPassedAndNA() + { + Assert.That(Validates.AsOkay(Validation.Passed), Is.True); + Assert.That(Validates.AsOkay(Validation.NotApplicable), Is.True); + Assert.That(Validates.AsOkay(Validation.Failed), Is.False); + } + + [Test()] + public void TestValidatesAsNotOkaySuccedesForFailedAndNA() + { + Assert.That(Validates.AsNotOkay(Validation.Failed), Is.True); + Assert.That(Validates.AsNotOkay(Validation.NotApplicable), Is.True); + Assert.That(Validates.AsNotOkay(Validation.Passed), Is.False); } } }