/
ArgOptionsTests.cs
94 lines (76 loc) · 3.2 KB
/
ArgOptionsTests.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
using System.IO;
using System.Linq;
using NUnit.Framework;
using StatLight.Console;
namespace StatLight.Core.Tests.Console
{
namespace ArgOptionsTests
{
[TestFixture]
public class when_testing_the_arg_options : FixtureBase
{
protected override void Before_all_tests()
{
base.Before_all_tests();
_actualFile = Path.GetTempFileName();
}
private string _actualFile;
[Test]
public void when_validating_the_default_properties_of_the_ArgOptions()
{
var argOptions = GetArgOptions("-x", _actualFile);
argOptions.ContinuousIntegrationMode.ShouldBeFalse();
argOptions.ShowHelp.ShouldBeFalse();
argOptions.TagFilters.ShouldEqual(null);
}
[Test]
public void should_be_able_to_get_the_xap_path_property_when_given_the_argument()
{
var argOptions = GetArgOptions("-x", _actualFile);
argOptions.XapPath.First().ShouldEqual(_actualFile);
}
[Test]
public void when_giving_the_xml_output_file_should_validate_theres_a_directory_to_write_the_file_to()
{
typeof(DirectoryNotFoundException).ShouldBeThrownBy(() => GetArgOptions("-x", _actualFile, @"-r=C:\some123456DirShouldntExist\Test.xml"));
}
[Test]
public void when_giving_the_xml_output_file_should_validate_theres_a_directory_to_write_the_file_to_1()
{
var path = @"C:\Test.xml";
var options = GetArgOptions("-x", _actualFile, @"-r=" + path);
options.XmlReportOutputPath.ShouldEqual(path);
}
[Test]
public void when_giving_an_empty_tagFilter_arg_it_should_just_use_nothing()
{
var argOptions = GetArgOptions("-x", _actualFile, "-t");
argOptions.TagFilters.ShouldBeNull();
}
[Test]
public void should_be_able_to_get_the_tagFilter_property_when_given_the_argument()
{
var someTag = "SomeTag";
var argOptions = GetArgOptions("-x", _actualFile, "-t" + someTag);
argOptions.TagFilters.ShouldEqual(someTag);
}
[Test]
public void should_be_able_to_set_the_WebServerOnly_flag()
{
//var argOptions = GetArgOptions("-x", samplePath, "--WebServerOnly");
var argOptions = GetArgOptions("-x", _actualFile, "--webserveronly");
argOptions.StartWebServerOnly.ShouldBeTrue();
}
[Test]
public void should_be_able_to_set_the_ContinuousIntegrationMode_flag()
{
var argOptions = GetArgOptions("-x", _actualFile, "-c");
argOptions.ContinuousIntegrationMode.ShouldBeTrue();
}
private ArgOptions GetArgOptions(params string[] args)
{
return new ArgOptions(args);
}
}
}
}