mirror of
https://github.com/github/awesome-copilot.git
synced 2026-02-20 02:15:12 +00:00
Fix assertion
This commit is contained in:
@@ -166,10 +166,14 @@ Assert.IsNegative(number);
|
|||||||
### Type Assertions
|
### Type Assertions
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
// Returns typed result for further assertions
|
// MSTest 3.x - uses out parameter
|
||||||
Assert.IsInstanceOfType<MyClass>(obj, out var typed);
|
Assert.IsInstanceOfType<MyClass>(obj, out var typed);
|
||||||
typed.DoSomething();
|
typed.DoSomething();
|
||||||
|
|
||||||
|
// MSTest 4.x - returns typed result directly
|
||||||
|
var typed = Assert.IsInstanceOfType<MyClass>(obj);
|
||||||
|
typed.DoSomething();
|
||||||
|
|
||||||
Assert.IsNotInstanceOfType<WrongType>(obj);
|
Assert.IsNotInstanceOfType<WrongType>(obj);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user