Skip to content

Commit

Permalink
Tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
thomhurst committed Oct 2, 2024
1 parent db232d8 commit d6a3f98
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
4 changes: 2 additions & 2 deletions docs/docs/tutorial-basics/class-data-source.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ public class MyTestClass
public Task InitializeAsync()
{
await StopServer();
await StartServer();
}

public ValueTask DisposeAsync()
{
await StartServer();
await StopServer();
}
}
}
Expand Down
10 changes: 2 additions & 8 deletions docs/docs/tutorial-basics/method-data-source.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,13 @@
sidebar_position: 5
---

# Data Source Driven Tests
# Method Data Sources

A limitation of passing data in with `[Arguments(...)]` is that the data must be `constant` values. For example, we can't new up an object and pass it into this attribute as an argument. This is a constraint of the language and we can't change that.

If we want test data represented in the form of objects, or just to use something that isn't a constant, we can declare a test data source.

This can come in 3 forms, with help of the following attributes:
- `[MethodDataSource]`
- `[ClassDataSource]`
- `[ClassConstructorAttribute]` (for constructors only)

## MethodDataSource
This has two options:
`MethodDataSource` has two options:
- If you pass in one argument, this is the method name containing your data. TUnit will assume this is in the current test class.
- If you pass in two arguments, the first should be the `Type` of the class containing your test source data method, and the second should be the name of the method.

Expand Down

0 comments on commit d6a3f98

Please sign in to comment.