Skip to content

Commit c543a5e

Browse files
authored
Merge pull request #27 from docusign/bugfix/fixing-tests-and-setting-up-CI-CD
Fixing tests and setting up CI\CD
2 parents 211d1d2 + 5db4caf commit c543a5e

File tree

2 files changed

+40
-13
lines changed

2 files changed

+40
-13
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Test .NET
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: windows-latest
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
- name: Add .NET support
17+
uses: actions/setup-dotnet@v2
18+
with:
19+
dotnet-version: 6.0.x
20+
- name: Add MsBuild
21+
uses: microsoft/setup-msbuild@v1.1.3
22+
- name: Load dependencies
23+
run: dotnet restore DocuSign.MyAPI\DocuSign.MyAPI.sln
24+
- name: Build project
25+
run: dotnet build DocuSign.MyAPI\DocuSign.MyAPI.sln --no-restore
26+
- name: Run tests
27+
run: dotnet test DocuSign.MyAPI\DocuSign.MyAPI.sln --no-build --verbosity normal

DocuSign.MyAPI.Tests/ExecuteScenarioServiceTests.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public ExecuteScenarioServiceTests()
4343
var authResult = AuthenticateResult.Success(
4444
new AuthenticationTicket(new ClaimsPrincipal(), "DocuSign"));
4545

46-
authResult.Properties.StoreTokens(new[]
46+
authResult.Properties?.StoreTokens(new[]
4747
{
4848
new AuthenticationToken { Name = "access_token", Value = "token_123" }
4949
});
@@ -694,7 +694,7 @@ public async Task ExecuteScenarioStep_CorrectArgument_ReturnCorrectResponse()
694694
new Parameter
695695
{
696696
RequestParameterPath = "accountId",
697-
Source = null,
697+
Source = string.Empty,
698698
In = "Path"
699699
}
700700
}
@@ -706,7 +706,7 @@ public async Task ExecuteScenarioStep_CorrectArgument_ReturnCorrectResponse()
706706
var expectedBody = JToken.Parse("{\"name\": \"Vas\", \"email\": \"val2\"}").ToString();
707707

708708
//Act
709-
var response = await _executeScenarioService.ExecuteScenarioStep(scenarioNumber, stepName, parameters, null);
709+
var response = await _executeScenarioService.ExecuteScenarioStep(scenarioNumber, stepName, parameters, new StepResponse[]{}, new StepParameters[]{});
710710

711711
//Assert
712712
Assert.Equal("https://testApi.com/api/createEntity/accountId123", response.API);
@@ -743,7 +743,7 @@ public async Task ExecuteScenarioStep_CorrectArgumentsWithRandomParameter_Return
743743
new Parameter
744744
{
745745
RequestParameterPath = "accountId",
746-
Source = null,
746+
Source = string.Empty,
747747
In = "Path"
748748
}
749749
}
@@ -756,7 +756,7 @@ public async Task ExecuteScenarioStep_CorrectArgumentsWithRandomParameter_Return
756756
var expectedBody = JToken.Parse("{\"name\": \"User 25 name\", \"email\": \"val2\"}").ToString();
757757

758758
//Act
759-
var response = await _executeScenarioService.ExecuteScenarioStep(scenarioNumber, stepName, parameters, null);
759+
var response = await _executeScenarioService.ExecuteScenarioStep(scenarioNumber, stepName, parameters, new StepResponse[]{}, new StepParameters[]{});
760760

761761
//Assert
762762
Assert.Equal("https://testApi.com/api/createEntity/accountId123", response.API);
@@ -793,7 +793,7 @@ public async Task ExecuteScenarioStep_InvalidParametersPrompt_Skips_ReturnsCorre
793793
new Parameter
794794
{
795795
RequestParameterPath = "accountId",
796-
Source = null,
796+
Source = string.Empty,
797797
In = "Path"
798798
}
799799
}
@@ -805,7 +805,7 @@ public async Task ExecuteScenarioStep_InvalidParametersPrompt_Skips_ReturnsCorre
805805
var expectedBody = JToken.Parse("{\"name\": \"[name]\", \"email\": \"val2\"}").ToString();
806806

807807
//Act
808-
var response = await _executeScenarioService.ExecuteScenarioStep(scenarioNumber, stepName, parameters, null);
808+
var response = await _executeScenarioService.ExecuteScenarioStep(scenarioNumber, stepName, parameters, new StepResponse[]{}, new StepParameters[]{});
809809

810810
//Assert
811811
Assert.Equal("https://testApi.com/api/createEntity/accountId123", response.API);
@@ -824,7 +824,7 @@ public async Task ExecuteScenarioStep_IncorrectScenario_ThrowNotFoundScenarioExc
824824
var parameters = "[{\"Name\": \"Vas\", \"stepName\": \"TestStep\"}]";
825825

826826
//Act
827-
var result = () => _executeScenarioService.ExecuteScenarioStep(scenarioNumber, stepName, parameters, null);
827+
var result = () => _executeScenarioService.ExecuteScenarioStep(scenarioNumber, stepName, parameters, new StepResponse[]{}, new StepParameters[]{});
828828

829829
//Assert
830830
await result.Should().ThrowAsync<NotFoundStepException>().WithMessage("Step with name TestStep is not found.");
@@ -872,7 +872,7 @@ public async Task ExecuteScenario_CorrectArgument_ReturnsCorrectResponse()
872872
new Parameter
873873
{
874874
RequestParameterPath = "accountId",
875-
Source = null,
875+
Source = string.Empty,
876876
In = "Path"
877877
}
878878
}
@@ -921,7 +921,7 @@ public async Task ExecuteScenario_CorrectArgumentWithRandom_ReturnsCorrectRespon
921921
new Parameter
922922
{
923923
RequestParameterPath = "accountId",
924-
Source = null,
924+
Source = string.Empty,
925925
In = "Path"
926926
}
927927
}
@@ -989,7 +989,7 @@ public async Task ExecuteScenario_SeveralSteps_ReturnsCorrectResponse()
989989
new Parameter
990990
{
991991
RequestParameterPath = "accountId",
992-
Source = null,
992+
Source = string.Empty,
993993
In = "Path"
994994
}
995995
}
@@ -1087,7 +1087,7 @@ public async Task ExecuteScenario_SeveralStepsAndSeveralIterations_ReturnsCorrec
10871087
new Parameter
10881088
{
10891089
RequestParameterPath = "accountId",
1090-
Source = null,
1090+
Source = string.Empty,
10911091
In = "Path"
10921092
}
10931093
}
@@ -1184,7 +1184,7 @@ public async Task ExecuteScenario_SeveralSteps_OneStepFailed_ExecutionOfOtherSte
11841184
new Parameter
11851185
{
11861186
RequestParameterPath = "accountId",
1187-
Source = null,
1187+
Source = string.Empty,
11881188
In = "Path"
11891189
}
11901190
}

0 commit comments

Comments
 (0)