mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-08-06 17:36:53 +01:00
Adds the interfaces knowledge domain covering AL interfaces and enum-with-implementation: three atomic articles with good/bad AL samples, a new al-interfaces-review leaf skill, and additive wiring into al-code-review and the README. Purely additive; no contract change. Part of #34. Co-authored-by: Jesper Schulz-Wedde <jesper.schulzwedde@microsoft.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
39 lines
1 KiB
AL
39 lines
1 KiB
AL
interface INotifier
|
|
{
|
|
procedure Send(Recipient: Text; Body: Text): Boolean;
|
|
}
|
|
|
|
codeunit 50210 "Email Notifier Bad" implements INotifier
|
|
{
|
|
procedure Send(Recipient: Text; Body: Text): Boolean
|
|
begin
|
|
exit(Recipient <> '');
|
|
end;
|
|
}
|
|
|
|
enum 50211 "Notification Channel Bad" implements INotifier
|
|
{
|
|
Extensible = true;
|
|
// No DefaultImplementation declared.
|
|
|
|
value(0; Email)
|
|
{
|
|
Implementation = INotifier = "Email Notifier Bad";
|
|
}
|
|
value(1; None)
|
|
{
|
|
// No Implementation here and no enum-level DefaultImplementation:
|
|
// resolving this value to INotifier and calling Send fails at runtime.
|
|
}
|
|
}
|
|
|
|
codeunit 50212 "Notification Dispatch Bad"
|
|
{
|
|
procedure Notify(Channel: Enum "Notification Channel Bad"; Recipient: Text; Body: Text): Boolean
|
|
var
|
|
Notifier: Interface INotifier;
|
|
begin
|
|
Notifier := Channel; // Channel::None has no implementation
|
|
exit(Notifier.Send(Recipient, Body)); // runtime failure for the None value
|
|
end;
|
|
}
|