-
Notifications
You must be signed in to change notification settings - Fork 1
/
dotnetclient_test.go
44 lines (33 loc) · 1.35 KB
/
dotnetclient_test.go
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
package dotnetresource_test
import (
"github.com/miclip/dotnet-resource/fakes"
"os/exec"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"github.com/miclip/dotnet-resource"
)
var _ = Describe("dotnetclient", func() {
BeforeEach(func(){
dotnetresource.ExecCommand = fakes.FakeExecCommand
})
It("should execute dotnet build command", func() {
defer func() { dotnetresource.ExecCommand = exec.Command }()
fakes.MockedExitStatus = 0
fakes.MockedStdout = ""
expectedCommand := "dotnet build tmp/source/path/project.csproj -f netcoreapp2.1 -r ubuntu.14.04-x64"
client := dotnetresource.NewDotnetClient("/path/project.csproj","netcoreapp2.1","ubuntu.14.04-x64", "tmp/source")
_, err := client.Build()
Ω(fakes.CommandString).Should(Equal(expectedCommand))
Ω(err).ShouldNot(HaveOccurred())
})
It("should execute dotnet test command", func() {
defer func() { dotnetresource.ExecCommand = exec.Command }()
fakes.MockedExitStatus = 0
fakes.MockedStdout = ""
expectedCommand := "dotnet test -f netcoreapp2.1 --no-build --no-restore PASS -p:RuntimeIdentifier=ubuntu.14.04-x64"
client := dotnetresource.NewDotnetClient("/path/project.csproj","netcoreapp2.1","ubuntu.14.04-x64", "/tmp/source")
_, err := client.Test("A_Filter")
Ω(fakes.CommandString).Should(Equal(expectedCommand))
Ω(err).ShouldNot(HaveOccurred())
})
})