Skip to content

Commit

Permalink
Feat: Added missing extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
AnnaSasDev committed Feb 4, 2025
1 parent fb0b241 commit 8b1654f
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace CodeOfChaos.Testing.TUnit;
// ---------------------------------------------------------------------------------------------------------------------
// Code
// ---------------------------------------------------------------------------------------------------------------------
// ReSharper disable once InconsistentNaming
public static class TUnitExtensionsDiagnosticsImmutableArray {
public static InvokableValueAssertionBuilder<ImmutableArray<Diagnostic>> ContainsDiagnostic(this IValueSource<ImmutableArray<Diagnostic>> valueSource, string expectedId, [CallerArgumentExpression(nameof(expectedId))] string doNotPopulateThisValue1 = "") {
return valueSource.RegisterAssertion(
Expand All @@ -23,4 +24,24 @@ public static InvokableValueAssertionBuilder<ImmutableArray<Diagnostic>> Contain
argumentExpressions: [doNotPopulateThisValue1]
);
}

public static InvokableValueAssertionBuilder<ImmutableArray<Diagnostic>> DoesNotContainDiagnostic(this IValueSource<ImmutableArray<Diagnostic>> valueSource, string expectedId, [CallerArgumentExpression(nameof(expectedId))] string doNotPopulateThisValue1 = "") {
return valueSource.RegisterAssertion(
assertCondition: new DoesNotContainDiagnosticAssertCondition<ImmutableArray<Diagnostic>>(
static diagnostics => diagnostics,
expectedId
),
argumentExpressions: [doNotPopulateThisValue1]
);
}

public static InvokableValueAssertionBuilder<ImmutableArray<Diagnostic>> ContainsDiagnosticsExclusively(this IValueSource<ImmutableArray<Diagnostic>> valueSource, string[] expectedIds, [CallerArgumentExpression(nameof(expectedIds))] string doNotPopulateThisValue1 = "") {
return valueSource.RegisterAssertion(
assertCondition: new ContainsDiagnosticsExclusivelyAssertCondition<ImmutableArray<Diagnostic>>(
static diagnostics => diagnostics,
expectedIds
),
argumentExpressions: [doNotPopulateThisValue1]
);
}
}

0 comments on commit 8b1654f

Please sign in to comment.