Skip to content

Commit

Permalink
Add usage information to the readme. (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
Malcolmnixon authored Feb 20, 2025
1 parent 7b3304a commit 4983269
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,27 @@
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=demaconsulting_TestResults&metric=security_rating)](https://sonarcloud.io/summary/new_code?id=demaconsulting_TestResults)

The TestResults library supports saving test results to TRX files.


## Usage

The following code-snippet shows how to create a TRX test-results file.

```csharp
// Create a TestResults instance
var results = new TestResults{Name = "SomeTests"};

// Add some results
results.Results.Add(
new TestResult{
Name = "Test1",
ClassName = "SomeTestClass",
CodeBase = "MyTestAssembly",
Outcome = TestOutcome.Passed
});

// Save the results to file
File.WriteAllText(
"results.trx",
TrxSerializer.Serialize(results));
```

0 comments on commit 4983269

Please sign in to comment.