mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-08-07 09:56:52 +01:00
Add interfaces knowledge domain and review leaf skill
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: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
parent
4a7a34b5c9
commit
484ee120af
12 changed files with 458 additions and 2 deletions
|
|
@ -0,0 +1,47 @@
|
|||
interface IShippingRate
|
||||
{
|
||||
procedure CalculateRate(Weight: Decimal): Decimal;
|
||||
}
|
||||
|
||||
codeunit 50200 "Standard Shipping Rate" implements IShippingRate
|
||||
{
|
||||
procedure CalculateRate(Weight: Decimal): Decimal
|
||||
begin
|
||||
exit(Weight * 1.5);
|
||||
end;
|
||||
}
|
||||
|
||||
codeunit 50201 "Express Shipping Rate" implements IShippingRate
|
||||
{
|
||||
procedure CalculateRate(Weight: Decimal): Decimal
|
||||
begin
|
||||
exit((Weight * 1.5) + 25);
|
||||
end;
|
||||
}
|
||||
|
||||
enum 50202 "Shipping Method" implements IShippingRate
|
||||
{
|
||||
Extensible = true;
|
||||
|
||||
value(0; Standard)
|
||||
{
|
||||
Implementation = IShippingRate = "Standard Shipping Rate";
|
||||
}
|
||||
value(1; Express)
|
||||
{
|
||||
Implementation = IShippingRate = "Express Shipping Rate";
|
||||
}
|
||||
}
|
||||
|
||||
codeunit 50203 "Shipping Charge"
|
||||
{
|
||||
// Dispatch is automatic: assign the enum to the interface variable and call.
|
||||
// A new method = one new enum value + one impl codeunit, with no edit here.
|
||||
procedure GetRate(Method: Enum "Shipping Method"; Weight: Decimal): Decimal
|
||||
var
|
||||
RateProvider: Interface IShippingRate;
|
||||
begin
|
||||
RateProvider := Method;
|
||||
exit(RateProvider.CalculateRate(Weight));
|
||||
end;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue