-
Notifications
You must be signed in to change notification settings - Fork 631
/
PrecalculatedLUTTest.cs
59 lines (48 loc) · 1.33 KB
/
PrecalculatedLUTTest.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
// Copyright (c) 2012-2017 fo-dicom contributors.
// Licensed under the Microsoft Public License (MS-PL).
using Xunit;
namespace Dicom.Imaging.LUT
{
#region Unit tests
[Collection("General")]
public class PrecalculatedLUTTest
{
[Theory(DisplayName = "Issue #219 ")]
[InlineData(-80, -50)]
[InlineData(0, 0)]
[InlineData(80, 50)]
public void Indexer_Get_AlwaysReturnValidValue(int input, int expected)
{
var lut = new PrecalculatedLUT(new MockLUT(-100, 100), -50, 50);
lut.Recalculate();
var actual = lut[input];
Assert.Equal(expected, actual);
}
}
#endregion
#region Support classes
internal class MockLUT : ILUT
{
internal MockLUT(int min, int max)
{
this.MinimumOutputValue = min;
this.MaximumOutputValue = max;
this.IsValid = false;
}
public bool IsValid { get; private set; }
public int MinimumOutputValue { get; private set; }
public int MaximumOutputValue { get; private set; }
public int this[int input]
{
get
{
return input;
}
}
public void Recalculate()
{
this.IsValid = true;
}
}
#endregion
}