-
Notifications
You must be signed in to change notification settings - Fork 481
/
Copy pathIssue424Tests.cs
55 lines (46 loc) · 1.3 KB
/
Issue424Tests.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
using System;
using System.Collections.Generic;
using Xunit;
namespace CommandLine.Tests.Unit
{
//MailAndSmsWarningSenderTests
public class Issue424Tests
{
private MailAndSmsWarningSender _sut;
public Issue424Tests()
{
_sut = new MailAndSmsWarningSender();
}
[Fact]
public void SendSmsOnWarning()
{
//Arrange
void Action() => _sut.ParseArgumentsAndRun(
new[] { "--task", "MailAndSmsWarningSender", "--test", "hejtest" });
// Act & Assert
Assert.Throws<NotImplementedException>((Action)Action);
}
}
public class MailAndSmsWarningSender
{
internal class Options
{
[Option("task")]
public string Task { get; set; }
}
public void ParseArgumentsAndRun(string[] args)
{
Parser.Default.ParseArguments<Options>(args)
.WithParsed(ExecuteTaskWithOptions)
.WithNotParsed(HandleParseError);
}
private void HandleParseError(IEnumerable<Error> errs)
{
throw new NotImplementedException();
}
private void ExecuteTaskWithOptions(Options opts)
{
Console.WriteLine("Executing");
}
}
}