-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUtilsTests.cs
More file actions
52 lines (44 loc) · 1.46 KB
/
UtilsTests.cs
File metadata and controls
52 lines (44 loc) · 1.46 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
43
44
45
46
47
48
49
50
51
52
using NUnit.Framework;
namespace nccid.Test;
public static class UtilsTests
{
/// <summary>
/// Arbitrary date to use in testing
/// </summary>
internal static readonly DateTime Bd = new(1980, 2, 24);
[Test]
public static void DicomDateTest()
{
Assert.That(Utils.DicomDate(Bd), Is.EqualTo("19800224"));
}
[Test]
public static void DicomWindowTest()
{
Assert.Multiple(static () =>
{
Assert.That(Utils.DicomWindow(Bd, 0, 0, null), Is.EqualTo("19800224-"));
Assert.That(Utils.DicomWindow(Bd, 1, 8, 4), Is.EqualTo("19790216-19800228"));
});
}
[TestCase("", "")]
[TestCase("/foo.dcm", "foo.dcm")]
[TestCase(@"\dir\foo.dcm", "dir/foo.dcm")]
[TestCase(@"/////.//\/\///\foo.dcm", "foo.dcm")]
public static void SanitizePathTest(string from, string to)
{
Assert.That(Utils.SanitizePath(from), Is.EqualTo(to));
}
[TestCase("20010224", 2001, 2, 24)]
public static void ParseDateTest(string s, int y, int m, int d)
{
Assert.That(Utils.ParseDate(s), Is.EqualTo(new DateTime(y, m, d)));
}
[TestCase("", "")]
[TestCase("/foo.dcm", "foo.dcm")]
[TestCase(@"\dir\foo.dcm", "dir/foo.dcm")]
[TestCase(@"/////.//\/\///\foo.dcm", "foo.dcm")]
public static void SanitizePath(string from, string to)
{
Assert.That(Utils.SanitizePath(from), Is.EqualTo(to));
}
}