Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public static partial class MyContainer
""");

// The metadata module's Default loses to AppModule's (AWT148). With no syntax of its own the diagnostic must fall back to the container's [Import] line. ToString() prefixes the location only when one exists.
await That(result.Diagnostics.Any(d => d.Contains("AWT148"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT148*").AsWildcard()
.Because("two Defaults collide across assemblies with nothing stronger to resolve them");
await That(result.Diagnostics).Contains("(*,*): *AWT148*").AsWildcard()
.Because("the metadata registration's diagnostic falls back to the container's [Import] location");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT101"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT101*").AsWildcard()
.Because("a [FromKey] with no registration under that key is a missing dependency");
await That(result.Diagnostics.Any(d => d.Contains("AWT101") && d.Contains("key: missing"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT101*key: missing*").AsWildcard()
.Because("the missing dependency names the requested key");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT113"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT113*").AsWildcard()
.Because("the Func requests an int but the [Arg] parameter expects a string");
}

Expand All @@ -56,7 +56,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT113"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT113*").AsWildcard()
.Because("a parameterized service cannot be produced from a Func that supplies no runtime arguments");
await That(result.Diagnostics.Single(d => d.Contains("AWT113"))).Contains("(none)")
.Because("an empty runtime-argument list reads as 'none' rather than an empty '()'");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT114"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT114*").AsWildcard()
.Because("a parameterized service is built fresh per call, so a singleton lifetime cannot be honored");
}

Expand All @@ -50,7 +50,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT114"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT114*").AsWildcard()
.Because("a scoped lifetime cannot be honored for a per-call parameterized service either");
}

Expand All @@ -74,7 +74,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT114"))).IsFalse()
await That(result.Diagnostics).DoesNotContain("*AWT114*").AsWildcard()
.Because("transient is the only lifetime a parameterized service can honor");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT115"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT115*").AsWildcard()
.Because("a parameterized service cannot be supplied its runtime arguments through a plain dependency");
}

Expand All @@ -55,7 +55,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT115"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT115*").AsWildcard()
.Because("Lazy<T> cannot carry runtime arguments either, so it cannot build a parameterized service");
}

Expand All @@ -82,7 +82,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT115"))).IsFalse()
await That(result.Diagnostics).DoesNotContain("*AWT115*").AsWildcard()
.Because("a Func<TArg…, T> supplies the runtime arguments, so it is the correct way to obtain it");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT117"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT117*").AsWildcard()
.Because("two different implementations claim the same service type and key");
}

Expand All @@ -50,7 +50,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT117"))).IsFalse()
await That(result.Diagnostics).DoesNotContain("*AWT117*").AsWildcard()
.Because("several implementations may share one service type under different keys");
}

Expand All @@ -74,7 +74,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT117"))).IsFalse()
await That(result.Diagnostics).DoesNotContain("*AWT117*").AsWildcard()
.Because("registering one implementation under several service types with one key is a coalesce, not a conflict");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT120") && d.Contains("Repository") && d.Contains("Connection"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT120*Repository*Connection*").AsWildcard()
.Because("the diagnostic names the dependency path from the synchronously-resolved service to the async-initialized one");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT123"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT123*").AsWildcard()
.Because("a [Decorate] over a service with no registration has nothing to wrap");
}

Expand All @@ -50,7 +50,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT124"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT124*").AsWildcard()
.Because("a decorator with more than one parameter assignable to the service is ambiguous");
}

Expand All @@ -75,7 +75,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT124"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT124*").AsWildcard()
.Because("a decorator with no parameter assignable to the service cannot receive the inner instance");
}

Expand Down Expand Up @@ -125,7 +125,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT124"))).IsFalse()
await That(result.Diagnostics).DoesNotContain("*AWT124*").AsWildcard()
.Because("the inner is the most-derived assignable parameter, so an unrelated `object` sibling is not ambiguous");
}

Expand Down Expand Up @@ -178,7 +178,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT124"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT124*").AsWildcard()
.Because("a [FromKey] parameter is not the chain inner, so the decorator has no parameter to receive it");
}

Expand All @@ -205,9 +205,9 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT102") && d.Contains("MyCode.Deco"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT102*MyCode.Deco*").AsWildcard()
.Because("the cycle diagnostic must name the real decorator type");
await That(result.Diagnostics.Any(d => d.Contains("@__dec:"))).IsFalse()
await That(result.Diagnostics).DoesNotContain("*@__dec:*").AsWildcard()
.Because("the internal synthetic '@__dec:' identity must not leak into user-facing diagnostics");
}

Expand Down Expand Up @@ -235,9 +235,9 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT105") && d.Contains("MyCode.Deco"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT105*MyCode.Deco*").AsWildcard()
.Because("the captive-dependency diagnostic must name the real decorator type");
await That(result.Diagnostics.Any(d => d.Contains("@__dec:"))).IsFalse()
await That(result.Diagnostics).DoesNotContain("*@__dec:*").AsWildcard()
.Because("the internal synthetic '@__dec:' identity must not leak into the captive-dependency diagnostic");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT125"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT125*").AsWildcard()
.Because("the open implementation's arity must match the service's, so a closed service can be re-mapped onto the implementation");
}

Expand All @@ -50,7 +50,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT125"))).IsFalse()
await That(result.Diagnostics).DoesNotContain("*AWT125*").AsWildcard()
.Because("the implementation and service both declare one type parameter");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT126"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT126*").AsWildcard()
.Because("Repository<int> violates the implementation's where T : class constraint");
}

Expand All @@ -52,7 +52,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT126"))).IsFalse()
await That(result.Diagnostics).DoesNotContain("*AWT126*").AsWildcard()
.Because("Order is a reference type, so it satisfies where T : class");
}

Expand Down Expand Up @@ -80,7 +80,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT126"))).IsFalse()
await That(result.Diagnostics).DoesNotContain("*AWT126*").AsWildcard()
.Because("a constructed constraint mentioning the type parameter (IComparable<T>) is satisfied after substitution");
}

Expand Down Expand Up @@ -110,9 +110,9 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT126"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT126*").AsWildcard()
.Because("the implementation's self-referential constraint where T : IComparable<T> is violated by NotComparable after substitution");
await That(result.Diagnostics.Any(d => d.Contains("AWT101"))).IsFalse()
await That(result.Diagnostics).DoesNotContain("*AWT101*").AsWildcard()
.Because("the constraint violation is the single root cause; the consumer's now-unregistered IRepository<NotComparable> must not also raise AWT101");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT127"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT127*").AsWildcard()
.Because("a closed generic in the typeof-ctor form would silently drop its type arguments; the generic attribute form registers closed types");
}

Expand All @@ -45,7 +45,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT127"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT127*").AsWildcard()
.Because("a non-generic type matches no closed service through the open generic path; the generic attribute form registers it");
}

Expand All @@ -70,7 +70,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT127"))).IsFalse()
await That(result.Diagnostics).DoesNotContain("*AWT127*").AsWildcard()
.Because("typeof(Repository<>) is the intended unbound open generic form");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT128"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT128*").AsWildcard()
.Because("the implementation does not expose the service with its type parameters in declaration order");
}

Expand All @@ -52,7 +52,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT128"))).IsFalse()
await That(result.Diagnostics).DoesNotContain("*AWT128*").AsWildcard()
.Because("Repository<T> : IRepository<T> maps its single type parameter onto the service in order");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT129"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT129*").AsWildcard()
.Because("the open registration recurses into an ever-larger closed generic, so expansion is bounded and reported");
}

Expand Down Expand Up @@ -59,7 +59,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT129"))).IsFalse()
await That(result.Diagnostics).DoesNotContain("*AWT129*").AsWildcard()
.Because("a finite closed-generic chain converges, so no depth limit is reached");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT130"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT130*").AsWildcard()
.Because("a composite with no collection parameter of the composed service has nothing to fan out to");
}

Expand All @@ -53,7 +53,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT130"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT130*").AsWildcard()
.Because("the collection parameter must be of the composed service for the composite to fan out over it");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT131"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT131*").AsWildcard()
.Because("the composite is also registered as a bare member of its own service, which has no effect");
}

Expand All @@ -54,7 +54,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT102"))).IsFalse()
await That(result.Diagnostics).DoesNotContain("*AWT102*").AsWildcard()
.Because("dropping the redundant membership keeps the composite out of its own collection, so there is no self-edge cycle");
}

Expand Down Expand Up @@ -82,7 +82,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT131"))).IsFalse()
await That(result.Diagnostics).DoesNotContain("*AWT131*").AsWildcard()
.Because("the composite is a member of a different service, not the one it composes");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT132"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT132*").AsWildcard()
.Because("a service can have at most one composite façade");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT133"))).IsTrue()
await That(result.Diagnostics).Contains("*AWT133*").AsWildcard()
.Because("a collection of a base type would fan out over a different collection than the composed service");
await That(result.Diagnostics.Any(d => d.Contains("AWT130"))).IsFalse()
await That(result.Diagnostics).DoesNotContain("*AWT130*").AsWildcard()
.Because("the composite has a collection parameter, it is of the wrong element type, not missing");
}

Expand Down Expand Up @@ -60,7 +60,7 @@ public static partial class MyContainer
}
""");

await That(result.Diagnostics.Any(d => d.Contains("AWT133"))).IsFalse()
await That(result.Diagnostics).DoesNotContain("*AWT133*").AsWildcard()
.Because("an exact collection of the composed service satisfies the composite regardless of other collection parameters");
}
}
Expand Down
Loading
Loading