Skip to content

Commit adf2708

Browse files
authored
Reorganise Documentation Site (#2444)
* Tidy docs * Move to new structure * Remove sidebar header info * Edits * Info blocks * Remove duplicate sentences * Tidy * Fix * Update locations * Update sidebars * Fix * Fix config * Fix link * Missing files * Bring back removed files * Assertions section * Fix * Fix
1 parent ae81724 commit adf2708

File tree

73 files changed

+389
-299
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+389
-299
lines changed

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ $ GIT_USER=<Your GitHub username> yarn deploy
3939
```
4040

4141
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
42+
File renamed without changes.
File renamed without changes.

docs/docs/tutorial-assertions/awaiting.md renamed to docs/docs/assertions/awaiting.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
---
2-
sidebar_position: 2
3-
---
4-
51
# Awaiting
62

73
In TUnit you `await` your assertions, and this serves two purposes:
@@ -10,7 +6,8 @@ In TUnit you `await` your assertions, and this serves two purposes:
106

117
Because of this, your tests should be `async` and return a `Task`.
128

13-
Don't worry about forgetting to `await` - There's an analyzer built in that will notify you if you've missed any!
9+
Don't worry about forgetting to `await` - There's an analyzer built in that will notify you if you've missed any!
10+
If you forget to `await`, your assertion will not actually be executed, and your test may pass when it should fail.
1411

1512
This will error:
1613

@@ -37,4 +34,4 @@ This won't:
3734
```
3835

3936
TUnit is able to take in asynchronous delegates. To be able to assert on these, we need to execute the code. We want to avoid sync-over-async, as this can cause problems and block the thread pool, slowing down your test suite.
40-
And with how fast .NET has become, the overhead of `Task`s and `async` methods shouldn't be noticable.
37+
And with how fast .NET has become, the overhead of `Task`s and `async` methods shouldn't be noticable.

docs/docs/tutorial-assertions/delegates.md renamed to docs/docs/assertions/delegates.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ TUnit can execute your delegates for you, and this allows you to assert on the d
3838
return Task.CompletedTask;
3939
});
4040
}
41-
```
41+
```

docs/docs/tutorial-assertions/extensibility/custom-assertions.md renamed to docs/docs/assertions/extensibility/custom-assertions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,4 @@ public class StringEqualsExpectedValueAssertCondition(string expected, StringCom
107107
$"found \"{actualValue}\"");
108108
}
109109
}
110-
```
110+
```

docs/docs/tutorial-assertions/extensibility/chaining-and-converting.md renamed to docs/docs/assertions/extensibility/extensibility-chaining-and-converting.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
---
2-
sidebar_position: 2
3-
---
4-
51
# Chaining and Converting
62

7-
We may want to chain assertions together that change the type of object being asserted, to keep the assertions reading clear and concise, and not having to declare more variables and more boiler-plate assert calls.
3+
TUnit allows you to chain assertions that change the type being asserted, enabling fluent and expressive test code.
4+
This is useful when an assertion transforms the value (e.g., parsing a response), and you want to continue asserting on the new type.
85

9-
This is possible in TUnit.
6+
Chaining is especially helpful when you want to perform multiple assertions on a value that is transformed by a previous assertion, without having to create intermediate variables.
107

118
For example:
129

1310
```csharp
11+
HttpResponseMessage response = ...;
12+
1413
await Assert.That(response)
1514
.IsProblemDetails()
1615
.And
@@ -86,4 +85,4 @@ public static class ProblemDetailsAssertionExtensions
8685
return valueSource.RegisterAssertion(new ProblemDetailsHasDetailAssertCondition(detail), [detailExpression]);
8786
}
8887
}
89-
```
88+
```

docs/docs/tutorial-assertions/extensibility/returning-items-from-await.md renamed to docs/docs/assertions/extensibility/extensibility-returning-items-from-await.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
---
2-
sidebar_position: 3
3-
---
4-
51
# Returning Data via `await`
62

3+
Sometimes, you may want your assertion to return a value, such as an item found in a collection, so you can use it in further assertions or logic.
4+
TUnit supports this by allowing your assertion to return a mapped result when awaited.
5+
6+
This is useful for scenarios where you want to extract a value from an assertion and use it in subsequent test logic, reducing the need for manual extraction or casting.
7+
78
It may make sense for our assertions to return data that is different from the input, based on what the assertion is doing. This can allow more cleanly written tests than have to manually do casting or parsing afterwards.
89

910
For example, `await Assert.That(collection).Contains(item => item.Price < 0.99)`
@@ -84,4 +85,4 @@ public static MappableResultAssertionBuilder<IEnumerable<TInner>, EnumerableCont
8485
(_, assertCondition) => assertCondition.FoundItem
8586
);
8687
}
87-
```
88+
```
File renamed without changes.

docs/docs/tutorial-assertions/or-conditions.md renamed to docs/docs/assertions/or-conditions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ When using this, only one condition needs to pass:
2424
.Or.IsEqualTo(3)
2525
.Or.IsEqualTo(4);
2626
}
27-
```
27+
```

0 commit comments

Comments
 (0)