-
Notifications
You must be signed in to change notification settings - Fork 0
/
ArgsExceptionTests.cs
72 lines (64 loc) · 2.17 KB
/
ArgsExceptionTests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
using NUnit.Framework;
namespace ConsoleApplication
{
[TestFixture]
public class ArgsExceptionTests
{
[Test]
public void UnexpectedMessage()
{
var e = new ArgsException(ErrorCode.UnexpectedArgument, 'x');
Assert.AreEqual("Argument -x unexpected.", e.GetErrorMessage());
}
[Test]
public void MissingStringMessage()
{
var e = new ArgsException(ErrorCode.MissingString, 'x');
Assert.AreEqual("Could not find string parameter for -x.", e.GetErrorMessage());
}
[Test]
public void InvalidIntegerMessage()
{
var e = new ArgsException(ErrorCode.InvalidInteger, 'x', "Forty two");
Assert.AreEqual(
"Argument -x expects an integer but was 'Forty two'.",
e.GetErrorMessage());
}
[Test]
public void MissingIntegerMessage()
{
var e = new ArgsException(ErrorCode.MissingInteger, 'x');
Assert.AreEqual(
"Could not find integer parameter for -x.",
e.GetErrorMessage());
}
[Test]
public void InvalidDobuleMessage()
{
var e = new ArgsException(ErrorCode.InvalidDouble, 'x', "Forty two");
Assert.AreEqual(
"Argument -x expects a double but was 'Forty two'.",
e.GetErrorMessage());
}
[Test]
public void MissingDoubleMessage()
{
var e = new ArgsException(ErrorCode.MissingDouble, 'x');
Assert.AreEqual(
"Could not find double parameter for -x.",
e.GetErrorMessage());
}
[Test]
public void InvalidArgumentName()
{
var e = new ArgsException(ErrorCode.InvalidArgumentName, '#');
Assert.AreEqual("'#' is not a valid argument name.", e.GetErrorMessage());
}
[Test]
public void InvalidFormat()
{
var e = new ArgsException(ErrorCode.InvalidArgumentFormat, 'x', "$");
Assert.AreEqual("'$' is not a valid argument format.", e.GetErrorMessage());
}
}
}