From 22500e4222db3ecb304eb1b27c324b597f487e96 Mon Sep 17 00:00:00 2001 From: Thomas Rittson Date: Mon, 7 Oct 2024 10:52:43 +1000 Subject: [PATCH] Add default interface implementation --- .../OrganizationFeatures/Policies/IPolicyDefinition.cs | 4 ++-- .../AdminConsole/Services/PolicyDefinitionFixtures.cs | 10 ---------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/Core/AdminConsole/OrganizationFeatures/Policies/IPolicyDefinition.cs b/src/Core/AdminConsole/OrganizationFeatures/Policies/IPolicyDefinition.cs index 61d9ad71cf..e1c759ae5c 100644 --- a/src/Core/AdminConsole/OrganizationFeatures/Policies/IPolicyDefinition.cs +++ b/src/Core/AdminConsole/OrganizationFeatures/Policies/IPolicyDefinition.cs @@ -25,7 +25,7 @@ public interface IPolicyDefinition /// The current policy, if any /// The modified policy to be saved /// A sequence of validation errors if validation was unsuccessful - public Task ValidateAsync(Policy? currentPolicy, Policy modifiedPolicy); + public Task ValidateAsync(Policy? currentPolicy, Policy modifiedPolicy) => Task.FromResult(null); /// /// Optionally performs side effects after a policy is validated but before it is saved. @@ -33,5 +33,5 @@ public interface IPolicyDefinition /// /// The current policy, if any /// The modified policy to be saved - public Task OnSaveSideEffectsAsync(Policy? currentPolicy, Policy modifiedPolicy); + public Task OnSaveSideEffectsAsync(Policy? currentPolicy, Policy modifiedPolicy) => Task.FromResult(0); } diff --git a/test/Core.Test/AdminConsole/Services/PolicyDefinitionFixtures.cs b/test/Core.Test/AdminConsole/Services/PolicyDefinitionFixtures.cs index a6e102201d..f74df35d13 100644 --- a/test/Core.Test/AdminConsole/Services/PolicyDefinitionFixtures.cs +++ b/test/Core.Test/AdminConsole/Services/PolicyDefinitionFixtures.cs @@ -30,14 +30,4 @@ public class FakeRequireSsoPolicyDefinition : IPolicyDefinition { public PolicyType Type => PolicyType.RequireSso; public IEnumerable RequiredPolicies => [PolicyType.SingleOrg]; - - public Task ValidateAsync(Policy? currentPolicy, Policy modifiedPolicy) - { - return Task.FromResult((string)null); - } - - public Task OnSaveSideEffectsAsync(Policy? currentPolicy, Policy modifiedPolicy) - { - return Task.FromResult(0); - } }