My unit tests reference files that are in the project and set to copy always. This passes.
[Test]
public void MyTest()
{
// Arrange
var json = File.ReadAllText("testfiles\\mytest.json");
// Act & Assert
Assert.IsNotNull(json);
}
In the CI/CD pipeline for GitHub, mytest.json
is not found.
How do I get the mytest.json
file deployed, or if it is deployed how do I get the test to fine it?
The YAML file - the default .NET one that gitHub generates for you
name: .NET
on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 6.x.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal