-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathShellCommandConfigureUnixTests.fs
More file actions
95 lines (83 loc) · 2.91 KB
/
ShellCommandConfigureUnixTests.fs
File metadata and controls
95 lines (83 loc) · 2.91 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
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
95
module Fli.Tests.ShellContext.ShellCommandConfigureUnixTests
open Fli
open NUnit.Framework
open FsUnit
open System.Collections.Generic
open System.Text
[<Test>]
[<Platform("Linux,Unix,MacOsX")>]
let ``Check FileName in ProcessStartInfo with CMD Shell`` () =
cli { Shell BASH } |> Command.buildProcess |> _.FileName |> should equal "bash"
[<Test>]
[<Platform("Linux,Unix,MacOsX")>]
let ``Check Argument in ProcessStartInfo with Command`` () =
cli {
Shell BASH
Command "echo Hello World!"
}
|> Command.buildProcess
|> _.Arguments
|> should equal "-c \"echo Hello World!\""
[<Test>]
[<Platform("Linux,Unix,MacOsX")>]
let ``Check WorkingDirectory in ProcessStartInfo with WorkingDirectory`` () =
cli {
Shell BASH
WorkingDirectory @"/etc/"
}
|> Command.buildProcess
|> _.WorkingDirectory
|> should equal @"/etc/"
[<Test>]
[<Platform("Linux,Unix,MacOsX")>]
let ``Check Environment in ProcessStartInfo with single environment variable`` () =
cli {
Shell BASH
EnvironmentVariable("Fli", "test")
}
|> Command.buildProcess
|> _.Environment.Contains(KeyValuePair("Fli", "test"))
|> should be True
[<Test>]
[<Platform("Linux,Unix,MacOsX")>]
let ``Check Environment in ProcessStartInfo with multiple environment variables`` () =
let config =
cli {
Shell BASH
EnvironmentVariables [ ("Fli", "test"); ("Fli.Test", "test") ]
}
|> Command.buildProcess
config.Environment.Contains(KeyValuePair("Fli", "test")) |> should be True
config.Environment.Contains(KeyValuePair("Fli.Test", "test")) |> should be True
[<Test>]
[<Platform("Linux,Unix,MacOsX")>]
let ``Check StandardOutputEncoding & StandardErrorEncoding with setting Encoding`` () =
let config =
cli {
Shell BASH
Encoding Encoding.UTF8
}
|> Command.buildProcess
config.StandardOutputEncoding |> should equal Encoding.UTF8
config.StandardErrorEncoding |> should equal Encoding.UTF8
[<Test>]
[<Platform("Linux,Unix,MacOsX")>]
let ``Check all possible values in ProcessStartInfo`` () =
let config =
cli {
Shell BASH
Command "echo Hello World! €"
Input "echo TestInput"
WorkingDirectory @"C:\Users"
EnvironmentVariable("Fli", "test")
EnvironmentVariables [ ("Fli.Test", "test") ]
Encoding Encoding.UTF8
}
|> Command.buildProcess
config.FileName |> should equal "bash"
config.Arguments |> should equal "-c \"echo Hello World! €\""
config.WorkingDirectory |> should equal @"C:\Users"
config.Environment.Contains(KeyValuePair("Fli", "test")) |> should be True
config.Environment.Contains(KeyValuePair("Fli.Test", "test")) |> should be True
config.StandardOutputEncoding |> should equal Encoding.UTF8
config.StandardErrorEncoding |> should equal Encoding.UTF8