Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing tests and setting up CI\CD #27

Merged
merged 2 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/dotnet-desktop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Test .NET

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- name: Add .NET support
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.0.x
- name: Add MsBuild
uses: microsoft/[email protected]
- name: Load dependencies
run: dotnet restore DocuSign.MyAPI\DocuSign.MyAPI.sln
- name: Build project
run: dotnet build DocuSign.MyAPI\DocuSign.MyAPI.sln --no-restore
- name: Run tests
run: dotnet test DocuSign.MyAPI\DocuSign.MyAPI.sln --no-build --verbosity normal
26 changes: 13 additions & 13 deletions DocuSign.MyAPI.Tests/ExecuteScenarioServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public ExecuteScenarioServiceTests()
var authResult = AuthenticateResult.Success(
new AuthenticationTicket(new ClaimsPrincipal(), "DocuSign"));

authResult.Properties.StoreTokens(new[]
authResult.Properties?.StoreTokens(new[]
{
new AuthenticationToken { Name = "access_token", Value = "token_123" }
});
Expand Down Expand Up @@ -694,7 +694,7 @@ public async Task ExecuteScenarioStep_CorrectArgument_ReturnCorrectResponse()
new Parameter
{
RequestParameterPath = "accountId",
Source = null,
Source = string.Empty,
In = "Path"
}
}
Expand All @@ -706,7 +706,7 @@ public async Task ExecuteScenarioStep_CorrectArgument_ReturnCorrectResponse()
var expectedBody = JToken.Parse("{\"name\": \"Vas\", \"email\": \"val2\"}").ToString();

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

//Assert
Assert.Equal("https://testApi.com/api/createEntity/accountId123", response.API);
Expand Down Expand Up @@ -743,7 +743,7 @@ public async Task ExecuteScenarioStep_CorrectArgumentsWithRandomParameter_Return
new Parameter
{
RequestParameterPath = "accountId",
Source = null,
Source = string.Empty,
In = "Path"
}
}
Expand All @@ -756,7 +756,7 @@ public async Task ExecuteScenarioStep_CorrectArgumentsWithRandomParameter_Return
var expectedBody = JToken.Parse("{\"name\": \"User 25 name\", \"email\": \"val2\"}").ToString();

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

//Assert
Assert.Equal("https://testApi.com/api/createEntity/accountId123", response.API);
Expand Down Expand Up @@ -793,7 +793,7 @@ public async Task ExecuteScenarioStep_InvalidParametersPrompt_Skips_ReturnsCorre
new Parameter
{
RequestParameterPath = "accountId",
Source = null,
Source = string.Empty,
In = "Path"
}
}
Expand All @@ -805,7 +805,7 @@ public async Task ExecuteScenarioStep_InvalidParametersPrompt_Skips_ReturnsCorre
var expectedBody = JToken.Parse("{\"name\": \"[name]\", \"email\": \"val2\"}").ToString();

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

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

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

//Assert
await result.Should().ThrowAsync<NotFoundStepException>().WithMessage("Step with name TestStep is not found.");
Expand Down Expand Up @@ -872,7 +872,7 @@ public async Task ExecuteScenario_CorrectArgument_ReturnsCorrectResponse()
new Parameter
{
RequestParameterPath = "accountId",
Source = null,
Source = string.Empty,
In = "Path"
}
}
Expand Down Expand Up @@ -921,7 +921,7 @@ public async Task ExecuteScenario_CorrectArgumentWithRandom_ReturnsCorrectRespon
new Parameter
{
RequestParameterPath = "accountId",
Source = null,
Source = string.Empty,
In = "Path"
}
}
Expand Down Expand Up @@ -989,7 +989,7 @@ public async Task ExecuteScenario_SeveralSteps_ReturnsCorrectResponse()
new Parameter
{
RequestParameterPath = "accountId",
Source = null,
Source = string.Empty,
In = "Path"
}
}
Expand Down Expand Up @@ -1087,7 +1087,7 @@ public async Task ExecuteScenario_SeveralStepsAndSeveralIterations_ReturnsCorrec
new Parameter
{
RequestParameterPath = "accountId",
Source = null,
Source = string.Empty,
In = "Path"
}
}
Expand Down Expand Up @@ -1184,7 +1184,7 @@ public async Task ExecuteScenario_SeveralSteps_OneStepFailed_ExecutionOfOtherSte
new Parameter
{
RequestParameterPath = "accountId",
Source = null,
Source = string.Empty,
In = "Path"
}
}
Expand Down
Loading