1
// *********************************************************************
2
// Copyright 2007, Andreas Schlapsi
3
// This is free software licensed under the MIT license.
4
// *********************************************************************
7
using NUnitExtension.RowTest;
9
namespace NUnitExtension.RowTest.Tests
14
private static string s_staticField;
17
public void TestFixtureSetUp()
19
s_staticField = "Class Member";
23
[Row("Other string", "Class Member")]
24
[Row("Class Member", "Other string")]
25
public void StaticFieldTest (string compareTo, string setNext)
27
Assert.AreEqual (s_staticField, compareTo);
28
s_staticField = setNext;
32
[Category("Category - 1")]
33
[Row( 1000, 10, 100.0000)]
34
[Row(-1000, 10, -100.0000)]
35
[Row( 1000, 7, 142.85715)]
36
[Row( 1000, 0.00001, 100000000)]
37
[Row(4195835, 3145729, 1.3338196)]
38
[Row( 1000, 0, 0, ExpectedException = typeof(DivideByZeroException))]
39
public void DivisionTest(double numerator, double denominator, double result)
42
throw new DivideByZeroException();
44
Assert.AreEqual(result, numerator / denominator, 0.00001);
48
[Category("Category - 2")]
51
[Row(3, 4, 8, TestName="Special case")]
53
[Row(10, 10, 0, TestName="ExceptionTest1",
54
ExpectedException=typeof(ArgumentException), ExceptionMessage="x and y may not be equal.")]
55
[Row(1, 1, 0, TestName="ExceptionTest2",
56
ExpectedException=typeof(ArgumentException), ExceptionMessage="x and y may not be equal.")]
57
public void AddTest(int x, int y, int expectedSum)
61
Assert.AreEqual(expectedSum, sum);
66
public void NullArgument(string argument)
68
Assert.IsNull(argument);
72
[Row(SpecialValue.Null)]
73
public void SpecialValueNullArgument(string argument)
75
Assert.IsNull(argument);
78
private int Sum(int x, int y)
86
throw new ArgumentException("x and y may not be equal.");