From 92bc3f964a693e692aac63681ab6beea65e13c0f Mon Sep 17 00:00:00 2001 From: Ivar Nesje Date: Thu, 4 Jan 2024 22:53:27 +0100 Subject: [PATCH] Remove dead code --- .../Validation/Default/DataAnnotationValidator.cs | 7 +------ .../Validation/Default/DefaultDataElementValidator.cs | 7 ++----- .../Validators/Default/DataAnnotationValidatorTests.cs | 10 ---------- 3 files changed, 3 insertions(+), 21 deletions(-) diff --git a/src/Altinn.App.Core/Features/Validation/Default/DataAnnotationValidator.cs b/src/Altinn.App.Core/Features/Validation/Default/DataAnnotationValidator.cs index 47a6c60e2..1929d48e6 100644 --- a/src/Altinn.App.Core/Features/Validation/Default/DataAnnotationValidator.cs +++ b/src/Altinn.App.Core/Features/Validation/Default/DataAnnotationValidator.cs @@ -32,15 +32,10 @@ public DataAnnotationValidator(IHttpContextAccessor httpContextAccessor, IObject } /// - /// Dummy implementation to satisfy interface, We use instead + /// Run Data annotation validation on all data types with app logic /// public string DataType => "*"; - /// - /// Run validator for all data types. - /// - public bool CanValidateDataType(string dataType) => true; - /// /// Disable incremental validation for this validator. /// diff --git a/src/Altinn.App.Core/Features/Validation/Default/DefaultDataElementValidator.cs b/src/Altinn.App.Core/Features/Validation/Default/DefaultDataElementValidator.cs index 43ec72b49..841a2c16b 100644 --- a/src/Altinn.App.Core/Features/Validation/Default/DefaultDataElementValidator.cs +++ b/src/Altinn.App.Core/Features/Validation/Default/DefaultDataElementValidator.cs @@ -9,13 +9,10 @@ namespace Altinn.App.Core.Features.Validation.Default; /// public class DefaultDataElementValidator : IDataElementValidator { - /// - public string DataType => "*"; - /// - /// Runs on all data elements to validate metadata and file scan results. + /// Run validations on all data elements /// - public bool CanValidateDataType(DataType dataType) => true; + public string DataType => "*"; /// public Task> ValidateDataElement(Instance instance, DataElement dataElement, DataType dataType) diff --git a/test/Altinn.App.Core.Tests/Features/Validators/Default/DataAnnotationValidatorTests.cs b/test/Altinn.App.Core.Tests/Features/Validators/Default/DataAnnotationValidatorTests.cs index f8f1e0a70..84f5cedc3 100644 --- a/test/Altinn.App.Core.Tests/Features/Validators/Default/DataAnnotationValidatorTests.cs +++ b/test/Altinn.App.Core.Tests/Features/Validators/Default/DataAnnotationValidatorTests.cs @@ -49,16 +49,6 @@ private class TestClass public TestClass? NestedProperty { get; set; } } - [Fact] - public void CanValidateDataType() - { - // Act - var result = _validator.CanValidateDataType(DataAnnotationsTestFixture.DataType); - - // Assert - Assert.True(result); - } - [Fact] public void ShouldRunForIncrementalValidation() {