Skip to content

Latest commit

 

History

History
157 lines (109 loc) · 7.9 KB

README.md

File metadata and controls

157 lines (109 loc) · 7.9 KB

EPAO Onboarding and Certification

UK Government logo

Build Status Quality Gate Status License

This repository represents the Assessors API code base. This service comprises the changes to downgrade the Register of End-Point Assessor Organisations to become a consolidated list of End-Point Assessors that are registered/approved/recognised by several External Quality Assurance Providers (EQAP), including OFQUAL.

Developer Setup

Requirements

In order to run this solution locally you will need the following:

Environment Setup

  • Clone this repository and open Visual Studio as an administrator.
  • Either use Visual Studio's Publish Database tool to publish the database project SFA.DAS.AssessorService.Database to the database name {{database name}} on {{local instance name}}, or create a database manually named {{database name}} on {{local instance name}} and run each of the .sql scripts in the SFA.DAS.AssessorService.Database project.
  • json file - Get the das-assessor-service configuration json file from das-employer-config; which is a non-public repository.
  • Azure Table Storage Config - Add the following data to your Azure Table Storage Config:

RowKey: SFA.DAS.AssessorService_1.0

PartitionKey: LOCAL

Data:

{{The contents of the local config json file}}.

Make sure you update the SqlConnectionString value to your local instance name, Initial Catalog value to your database name, and Trusted_Connection value to True.

Run the solution

The default JSON configuration was created to work with dotnet run:

  • Navigate to src/SFA.DAS.AssessorService.Web/

  • run dotnet restore

  • run dotnet run

  • Open https://localhost:5015

  • Navigate to src/SFA.DAS.AssessorService.Application.Api/

  • run dotnet restore

  • run dotnet run

Note: Running the solution from Visual Studio is supported by bypassing the external authentication using the configuration variable "StubAuth" = true.

  • To run a local copy you will also need the following solutions locally:

  • And you may also require:

  • Please follow the Walkthrough which is a non-public wiki to create an account and setup local test data.

Tests

This codebase includes unit tests and integration tests. These are all in seperate projects aptly named after the project they cover.

Unit Tests

There are several unit test projects in the solution built using C#, NUnit, Moq, FluentAssertions, .NET and AutoFixture.

  • SFA.DAS.AssessorService.Application.Api.External.UnitTests
  • SFA.DAS.AssessorService.Application.Api.UnitTests
  • SFA.DAS.AssessorService.Application.UnitTests
  • SFA.DAS.AssessorService.Data.UnitTests
  • SFA.DAS.AssessorService.Domain.UnitTests
  • SFA.DAS.AssessorService.Web.UnitTests

Integration Tests

There are two integration test projects:

  • SFA.DAS.AssessorService.Application.Api.IntegrationTests
  • SFA.DAS.AssessorService.Data.IntegrationTests

Specflow is currently used for integration testing the internal API. It is configured to run using the NUnit Test runner. Hence, it requires:

  • To be run using the NUnit Test Runner.
  • The SFA.DAS.AssessorService.Application.Api project to already be running.
  • The BaseAddress value in the app.config to be set to the base address of the running SFA.DAS.AssessorService.Application.Api project.

SonarCloud Analysis (Optional)

SonarCloud analysis can be performed using a docker container which can be built from the included dockerfile.

Docker must be running Windows containers in this instance

An example of the docker run command to analyse the code base can be found below.

For this docker container to be successfully created you will need:

  • docker running Windows containers
  • a user on SonarCloud.io with permission to run analysis
  • a SonarQube.Analysis.xml file in the root of the git repository.

This file takes the format:

<SonarQubeAnalysisProperties  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.sonarsource.com/msbuild/integration/2015/1">
<Property Name="sonar.host.url">https://sonarcloud.io</Property>
<Property Name="sonar.login">[Your SonarCloud user token]</Property>
</SonarQubeAnalysisProperties>
Example:

docker run [OPTIONS] IMAGE COMMAND

Docker run documentation

docker run --rm -v c:/projects/das-assessor-service:c:/projects/das-assessor-service -w c:/projects/das-assessor-service 3d9151a444b2 powershell -F c:/projects/das-assessor-service/sonarcloud/analyse.ps1

Options:
Option Description
--rm Remove any existing containers for this image
-v Bind the current directory of the host to the given directory in the container ($PWD may be different on your platform). This should be the folder where the code to be analysed is
-w Set the working directory
Command:

Execute the analyse.ps1 PowerShell script

Setup issues

If you get issues with localhost certificate validation when accessing the local login service (e.g. "AuthenticationException: The remote certificate is invalid according to the validation procedure") then run the following command from the login service directory to install the local dev certificates:

dotnet dev-certs https --trust

Confirm the certificate install in the dialog that appears.

If you get issues with the target framework when building (e.g. it is targeting .net core 3 instead of 2.2.) then add a global.json file in each of the projects being run with the required target framework specified as follows:

{
  "sdk": {
    "version": "2.2.207"
  }
}

To see the installed SDK versions run the following command:

dotnet --info