Skip to content

Commit 8b1654f

Browse files
committed
Feat: Added missing extensions
1 parent fb0b241 commit 8b1654f

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/CodeOfChaos.Testing.TUnit/Extensions/TUnitExtensionsDiagnosticsImmutableArray.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ namespace CodeOfChaos.Testing.TUnit;
1313
// ---------------------------------------------------------------------------------------------------------------------
1414
// Code
1515
// ---------------------------------------------------------------------------------------------------------------------
16+
// ReSharper disable once InconsistentNaming
1617
public static class TUnitExtensionsDiagnosticsImmutableArray {
1718
public static InvokableValueAssertionBuilder<ImmutableArray<Diagnostic>> ContainsDiagnostic(this IValueSource<ImmutableArray<Diagnostic>> valueSource, string expectedId, [CallerArgumentExpression(nameof(expectedId))] string doNotPopulateThisValue1 = "") {
1819
return valueSource.RegisterAssertion(
@@ -23,4 +24,24 @@ public static InvokableValueAssertionBuilder<ImmutableArray<Diagnostic>> Contain
2324
argumentExpressions: [doNotPopulateThisValue1]
2425
);
2526
}
27+
28+
public static InvokableValueAssertionBuilder<ImmutableArray<Diagnostic>> DoesNotContainDiagnostic(this IValueSource<ImmutableArray<Diagnostic>> valueSource, string expectedId, [CallerArgumentExpression(nameof(expectedId))] string doNotPopulateThisValue1 = "") {
29+
return valueSource.RegisterAssertion(
30+
assertCondition: new DoesNotContainDiagnosticAssertCondition<ImmutableArray<Diagnostic>>(
31+
static diagnostics => diagnostics,
32+
expectedId
33+
),
34+
argumentExpressions: [doNotPopulateThisValue1]
35+
);
36+
}
37+
38+
public static InvokableValueAssertionBuilder<ImmutableArray<Diagnostic>> ContainsDiagnosticsExclusively(this IValueSource<ImmutableArray<Diagnostic>> valueSource, string[] expectedIds, [CallerArgumentExpression(nameof(expectedIds))] string doNotPopulateThisValue1 = "") {
39+
return valueSource.RegisterAssertion(
40+
assertCondition: new ContainsDiagnosticsExclusivelyAssertCondition<ImmutableArray<Diagnostic>>(
41+
static diagnostics => diagnostics,
42+
expectedIds
43+
),
44+
argumentExpressions: [doNotPopulateThisValue1]
45+
);
46+
}
2647
}

0 commit comments

Comments
 (0)