forked from Xavalon/XamlStyler
/
IndentServiceUnitTests.cs
70 lines (63 loc) · 2.24 KB
/
IndentServiceUnitTests.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
// © Xavalon. All rights reserved.
using NUnit.Framework;
using Xavalon.XamlStyler.Core.Options;
using Xavalon.XamlStyler.Core.Services;
namespace Xavalon.XamlStyler.UnitTests
{
[TestFixture]
public class IndentServiceUnitTests
{
[TestCase(" ", " ")]
[TestCase(" ", "\t")]
[TestCase(" ", "\t ")]
[TestCase("\t", "\t")]
[TestCase("\t ", "\t ")]
[TestCase("\t ", "\t ")]
[TestCase("\t ", "\t ")]
[TestCase("\t ", "\t\t")]
[TestCase("\t \t ", "\t \t ")]
[TestCase("\t Hello ", "\t Hello ")]
[TestCase(" Hi", "\t\t Hi")]
public void TestNormalize(string sourceText, string expected)
{
var indentService = new IndentService(new StylerOptions()
{
IndentWithTabs = true,
IndentSize = 4,
AttributeIndentationStyle = AttributeIndentationStyle.Mixed
});
var result = indentService.Normalize(sourceText);
Assert.That(result, Is.EqualTo(expected));
}
[TestCase(" ")]
[TestCase(" ")]
[TestCase(" ")]
[TestCase("\t")]
[TestCase("\t ")]
[TestCase("\t ")]
[TestCase("\t ")]
[TestCase("\t ")]
[TestCase("\t \t ")]
[TestCase("\t Hello ")]
[TestCase(" Hi")]
public void TestNormalizeNoOp(string sourceText)
{
var indentService = new IndentService(new StylerOptions()
{
IndentWithTabs = true,
IndentSize = 4,
AttributeIndentationStyle = AttributeIndentationStyle.Spaces
});
var result = indentService.Normalize(sourceText);
Assert.That(result, Is.EqualTo(sourceText));
indentService = new IndentService(new StylerOptions()
{
IndentWithTabs = false,
IndentSize = 4,
AttributeIndentationStyle = AttributeIndentationStyle.Mixed
});
result = indentService.Normalize(sourceText);
Assert.That(result, Is.EqualTo(sourceText));
}
}
}