-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCaseCheckTest.cs
49 lines (40 loc) · 1.48 KB
/
CaseCheckTest.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
using EzPasswordValidator.Checks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace EzPasswordValidator.Tests
{
[TestClass]
public class CaseCheckTest
{
private CaseCheck _check;
[TestInitialize]
public void Setup() => _check = new CaseCheck();
/// <summary>The case check should support english alphabet characters.</summary>
[DataRow("aaBB")]
[DataRow("CCdd")]
[DataRow("aBc")]
[DataRow("AbC")]
[DataTestMethod]
public void WhenPasswordHasUpperAndLowerEnglishCharsThenPasswordIsValid(string validPsw) =>
Assert.IsTrue(_check.Execute(validPsw));
/// <summary>The case check should support non-english alphabet characters.</summary>
[DataRow("øøÆÆ")]
[DataRow("ÅÅøø")]
[DataRow("æØæ")]
[DataRow("ÆøÅ")]
[DataTestMethod]
public void WhenPasswordHasUpperAndLowerNonEnglishCharsThenPasswordIsValid(string validPsw) =>
Assert.IsTrue(_check.Execute(validPsw));
[TestMethod]
public void WhenPasswordHasOnlyUpperCaseCharsThenPasswordIsNotValid()
{
const string invalidPsw = "AAA";
Assert.IsFalse(_check.Execute(invalidPsw));
}
[TestMethod]
public void WhenPasswordHasOnlyLowerCaseCharsThenPasswordIsNotValid()
{
const string invalidPsw = "aaa";
Assert.IsFalse(_check.Execute(invalidPsw));
}
}
}