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

v2.0.0 release #4

Merged
merged 1 commit into from
Aug 13, 2024
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
8 changes: 8 additions & 0 deletions .azuredevops/pipelines/build.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
schedules:
- cron: '0 1 * * 0'
displayName: 'Run at 1:00 AM every Sunday (UTC)'
always: true
branches:
include:
- develop

trigger:
- develop
- main
Expand Down
2 changes: 1 addition & 1 deletion .azuredevops/pipelines/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ resources:
- repository: GitHubRepo
type: github
name: ConsumerDataRight/mock-solution-test-automation
endpoint: github.com_CDR-LukeH
endpoint: github.com_CDR-CI
ref: refs/$(github-ref-prefix)$(release-number)

# The build has 3 seperate tasks run under 1 step
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ jobs:
# build nuget pacakge
- name: Build the mock-solution-test-automation nuget package
run: |
dotnet pack ./mock-solution-test-automation/Source/ConsumerDataRight.ParticipantTooling.MockSolution.TestAutomation/ConsumerDataRight.ParticipantTooling.MockSolution.TestAutomation.csproj --configuration $buildConfiguration --no-build
dotnet pack ./mock-solution-test-automation/Source/ConsumerDataRight.ParticipantTooling.MockSolution.TestAutomation/ConsumerDataRight.ParticipantTooling.MockSolution.TestAutomation.csproj --configuration $buildConfiguration --no-build
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.0.0] - 2024-08-06
### Changed
- Updated nuget package versions.
- Migrated from .Net 6 to .Net 8
- Changed Banking Get Accounts API to only support version 2


## [1.1.0] - 2024-03-13

### Added
- Added support Authorisation Code Flow (ACF).
- Added helper method to modify client claims.

### Changed
- Updated nuget package versions to avoid vulnerabilities.
- Updated methods to use ACF as default instead of Hybrid Flow.
- Updated Playwright Locators to use new Id's for the consent workflow UI's.


## [1.0.0] - 2023-11-23

### Added
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Documentation on how this project is used can be found in the test automation ex
## Technology Stack

The following technologies have been used to build the Mock Solution Test Automation project:
- The source code has been written in `C#` using the `.Net 6` framework.
- The source code has been written in `C#` using the `.Net 8` framework.
- `xUnit` is the framework used for writing and running tests.
- `Microsoft Playwright` is the framework used for Web Testing.

Expand All @@ -54,4 +54,4 @@ See our [security policy](https://github.com/ConsumerDataRight/mock-solution-tes
[MIT License](https://github.com/ConsumerDataRight/mock-solution-test-automation/blob/main/LICENSE)

# Notes
The Mock Solution Test Automation solution is provided as a development and testing tool that is used by the other mock solutions.
The Mock Solution Test Automation solution is provided as a development and testing tool that is used by the other mock solutions.
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Visit our [Responsible disclosure of security vulnerabilities policy](https://ww

| Version | Supported |
| ------- | ------------------ |
| 1.0.x | :white_check_mark: |

| 2.0.x | :white_check_mark: |
| 1.x.x | :x: |


## Reporting a Vulnerability
Expand Down
5 changes: 4 additions & 1 deletion Source/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ dotnet_diagnostic.SA1101.severity = none
# CA5350: Do Not Use Weak Cryptographic Algorithms
dotnet_diagnostic.CA5350.severity = none

#Server certificates should be verified during SSL/TLS connections.
dotnet_diagnostic.S4830.severity = none

#### Core EditorConfig Options ####

# Indentation and spacing
Expand Down Expand Up @@ -252,4 +255,4 @@ dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
indent_size = 4
end_of_line = crlf
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<Compile Remove="TestResults\**" />
<EmbeddedResource Remove="TestResults\**" />
<None Remove="TestResults\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<Compile Remove="TestResults\**" />
<EmbeddedResource Remove="TestResults\**" />
<None Remove="TestResults\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit" Version="2.6.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ConsumerDataRight.ParticipantTooling.MockSolution.TestAutomation\ConsumerDataRight.ParticipantTooling.MockSolution.TestAutomation.csproj" />
</ItemGroup>

</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

namespace ConsumerDataRight.ParticipantTooling.MockSolution.TestAutomation.UnitTests.Tests
{
[Trait("Category", "UnitTests")]
public class TestClass1
{
public class Startup
{
//A default startup is required due to the test project inheriting Xunit.DependencyInjection from the Nuget project.
//A default startup is required due to the test project inheriting Xunit.DependencyInjection from the Nuget project.
public void ConfigureServices(IServiceCollection services) { }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,25 +75,7 @@ public static async Task AssertHasNoContent2(HttpContent? content)
/// <param name="actualJson">The actual json</param>
public static void AssertJson(string? expectedJson, string actualJson)
{
AssertJson<object>(expectedJson, actualJson);

//if (AssertIsJsonNullOrEmpty(expectedJson, actualJson))
//{
// return;
//}

//object? expectedObject = JsonConvert.DeserializeObject(expectedJson);
//expectedObject.Should().NotBeNull($"Error deserializing expected json - '{expectedJson}'");

//object? actualObject = JsonConvert.DeserializeObject(actualJson);
//actualObject.Should().NotBeNull($"Error deserializing actual json - '{actualJson}'");

//var expectedJsonNormalised = JsonConvert.SerializeObject(expectedObject);
//var actualJsonNormalised = JsonConvert.SerializeObject(actualObject);

//actualJson?.JsonCompare(expectedJson).Should().BeTrue(
// $"\r\nExpected json:\r\n{expectedJsonNormalised}\r\nActual Json:\r\n{actualJsonNormalised}\r\n"
//);
AssertJson<object>(expectedJson, actualJson);
}

public static void AssertJson<T>(string? expectedJson, string actualJson)
Expand Down Expand Up @@ -130,16 +112,6 @@ private static bool AssertIsJsonNullOrEmpty(string? expectedJson, string actualJ
return false;
}

//private static void SerializeAndCompareJson(string? expectedObject, string actualObject)
//{
// var expectedJsonNormalised = JsonConvert.SerializeObject(expectedObject);
// var actualJsonNormalised = JsonConvert.SerializeObject(actualObject);

// actualJson?.JsonCompare(expectedJson).Should().BeTrue(
// $"\r\nExpected json:\r\n{expectedJsonNormalised}\r\nActual Json:\r\n{actualJsonNormalised}\r\n"
// );
//}

/// <summary>
/// Assert headers has a single header with the expected value.
/// If expectedValue then just check for the existence of the header (and not it's value)
Expand Down Expand Up @@ -216,5 +188,21 @@ public static async Task AssertErrorAsync(HttpResponseMessage responseMessage, A
receivedError.Code.Should().Be(expectedError.Error);
}
}
public static async Task AssertErrorAsync(HttpResponseMessage responseMessage, CdrException expectedError)
{
responseMessage.StatusCode.Should().Be(expectedError.StatusCode);

AssertHasContentTypeApplicationJson(responseMessage.Content);

var responseContent = await responseMessage.Content.ReadAsStringAsync();
var receivedError = JsonConvert.DeserializeObject<AuthError>(responseContent);

receivedError.Should().NotBeNull();
if (receivedError != null)
{
receivedError.Description.Should().Be(expectedError.Detail);
receivedError.Code.Should().Be(expectedError.Code);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class DisplayTestMethodNameAttribute : BeforeAfterTestAttribute
public override void Before(MethodInfo methodUnderTest)
{
Log.Logger.Information("-----------------------------------------------------");
Log.Logger.Information("--Test #{count} - {TestClassName}.{TestName}", ++_count, methodUnderTest.DeclaringType?.Name, methodUnderTest.Name);
Log.Logger.Information("--Test #{Count} - {TestClassName}.{TestName}", ++_count, methodUnderTest.DeclaringType?.Name, methodUnderTest.Name);
}

public override void After(MethodInfo methodUnderTest)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using ConsumerDataRight.ParticipantTooling.MockSolution.TestAutomation.Extensions;
using ConsumerDataRight.ParticipantTooling.MockSolution.TestAutomation.Interfaces;
using ConsumerDataRight.ParticipantTooling.MockSolution.TestAutomation.Models.Options;
using ConsumerDataRight.ParticipantTooling.MockSolution.TestAutomation.Services;
using Microsoft.AspNetCore.WebUtilities;
using Serilog;
using static ConsumerDataRight.ParticipantTooling.MockSolution.TestAutomation.Services.DataHolderAuthoriseService;

namespace ConsumerDataRight.ParticipantTooling.MockSolution.TestAutomation.APIs
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,5 +353,10 @@ public static class General
public const string InvalidClient = "ERR-GEN-038: invalid_client";
}
}

public static class LogTemplates
{
public const string StartedFunctionInClass = "Started {FunctionName} in {ClassName}.";
}
}
}
Loading
Loading