-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMatchedBracketStringValidatorTest.cs
More file actions
42 lines (37 loc) · 1.55 KB
/
Copy pathMatchedBracketStringValidatorTest.cs
File metadata and controls
42 lines (37 loc) · 1.55 KB
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
using Xunit;
namespace code_challenge
{
public class MatchedBracketStringValidatorTest
{
private readonly MatchedBracketStringValidator validator = new();
[Theory]
[InlineData("Hello I’m [name] and I’m {age} years old!")]
[InlineData("Hello I’m [(firstname) (lastname)] and I’m {age} years old!")]
[InlineData("Hello I’m ((firstname) (lastname)) and I’m {age} years old!")]
public void TestIsValid_IsOK(string input)
{
Assert.True(validator.IsValid(input));
}
[Theory]
[InlineData("Hello I’m [(firstname) (lastname]) and I’m {age} years old!")]
[InlineData("Hello I’m ((firstname) (lastname)and I’m {age} years old!")]
public void TestIsValid_IsNotOK(string input)
{
Assert.False(validator.IsValid(input));
}
[Theory]
[InlineData("Hello I’m [(firstname) (lastname]) and I’m {age} years old!")]
public void TestIsValid_IsNotOK_WithWrongClosingOrderErrorMessage(string input)
{
Assert.False(validator.IsValid(input));
Assert.Equal("Wrong closing order", validator.ErrorMessage);
}
[Theory]
[InlineData("Hello I’m ((firstname) (lastname)and I’m {age} years old!")]
public void TestIsValid_IsNotOK_WithMissingClosingBracketErrorMessage(string input)
{
Assert.False(validator.IsValid(input));
Assert.Equal("Missing closing ')'", validator.ErrorMessage);
}
}
}