From 010cc792fe9b18f7c3b3c99834e4af20278c9ce8 Mon Sep 17 00:00:00 2001 From: Greg Hays Date: Wed, 3 Jan 2024 17:28:23 -0800 Subject: [PATCH] CODE RUB: Standard Version 2.10.0 Upgrade Closes: #96 --- .../FailedFileSerializationException.cs | 9 +++++-- .../Exceptions/FailedFileServiceException.cs | 8 ++++-- .../Exceptions/FileDependencyException.cs | 8 ++++-- .../FileDependencyValidationException.cs | 8 ++++-- .../Files/Exceptions/FileServiceException.cs | 8 ++++-- .../Exceptions/FileValidationException.cs | 8 ++++-- .../Exceptions/InvalidFileContentException.cs | 6 ++++- .../InvalidFileDependencyException.cs | 8 ++++-- .../Exceptions/InvalidFilePathException.cs | 6 ++++- .../Exceptions/AdoDependencyException.cs | 13 ++++++---- .../AdoDependencyValidationException.cs | 13 ++++++---- .../Exceptions/AdoValidationException.cs | 13 ++++++---- .../Exceptions/BuildServiceException.cs | 13 ++++++---- .../Exceptions/NullPathException.cs | 9 +++++-- .../Exceptions/NullPipelineException.cs | 9 +++++-- .../Builds/BuildServiceTests.Exceptions.cs | 6 ++--- .../Builds/BuildServiceTests.Validations.cs | 10 ++++--- .../Builds/BuildServiceTests.logic.cs | 2 +- .../FileServiceTests.Exceptions.Write.cs | 26 ++++++++++++------- .../Files/FileServiceTests.Logic.Write.cs | 2 +- .../FileServiceTests.Validations.Write.cs | 16 +++++++----- 21 files changed, 137 insertions(+), 64 deletions(-) diff --git a/ADotNet/Models/Foundations/Files/Exceptions/FailedFileSerializationException.cs b/ADotNet/Models/Foundations/Files/Exceptions/FailedFileSerializationException.cs index 6eaf93f..ed31d75 100644 --- a/ADotNet/Models/Foundations/Files/Exceptions/FailedFileSerializationException.cs +++ b/ADotNet/Models/Foundations/Files/Exceptions/FailedFileSerializationException.cs @@ -12,7 +12,12 @@ namespace ADotNet.Models.Foundations.Files.Exceptions public class FailedFileSerializationException : Xeption { public FailedFileSerializationException(Exception innerException) - : base(message: "Failed file serialization error occurred, contact support.", innerException) + : base(message: "Failed file serialization error occurred, contact support.", + innerException: innerException) + { } + + public FailedFileSerializationException(string message, Exception innerException) + : base(message, innerException) { } } -} +} \ No newline at end of file diff --git a/ADotNet/Models/Foundations/Files/Exceptions/FailedFileServiceException.cs b/ADotNet/Models/Foundations/Files/Exceptions/FailedFileServiceException.cs index d59a333..6345b71 100644 --- a/ADotNet/Models/Foundations/Files/Exceptions/FailedFileServiceException.cs +++ b/ADotNet/Models/Foundations/Files/Exceptions/FailedFileServiceException.cs @@ -13,7 +13,11 @@ public class FailedFileServiceException : Xeption { public FailedFileServiceException(Exception innerException) : base(message: "Failed file service error occurred, contact support.", - innerException) + innerException: innerException) + { } + + public FailedFileServiceException(string message, Exception innerException) + : base(message, innerException) { } } -} +} \ No newline at end of file diff --git a/ADotNet/Models/Foundations/Files/Exceptions/FileDependencyException.cs b/ADotNet/Models/Foundations/Files/Exceptions/FileDependencyException.cs index c83219d..9ad3cfd 100644 --- a/ADotNet/Models/Foundations/Files/Exceptions/FileDependencyException.cs +++ b/ADotNet/Models/Foundations/Files/Exceptions/FileDependencyException.cs @@ -12,7 +12,11 @@ public class FileDependencyException : Xeption { public FileDependencyException(Xeption innerException) : base(message: "File dependency error occurred, contact support.", - innerException) + innerException: innerException) + { } + + public FileDependencyException(string message, Xeption innerException) + : base(message, innerException) { } } -} +} \ No newline at end of file diff --git a/ADotNet/Models/Foundations/Files/Exceptions/FileDependencyValidationException.cs b/ADotNet/Models/Foundations/Files/Exceptions/FileDependencyValidationException.cs index 6696688..c7a0e7d 100644 --- a/ADotNet/Models/Foundations/Files/Exceptions/FileDependencyValidationException.cs +++ b/ADotNet/Models/Foundations/Files/Exceptions/FileDependencyValidationException.cs @@ -12,7 +12,11 @@ public class FileDependencyValidationException : Xeption { public FileDependencyValidationException(Xeption innerException) : base(message: "File dependency validation error occurred, fix the errors and try again.", - innerException) + innerException: innerException) + { } + + public FileDependencyValidationException(string message, Xeption innerException) + : base(message, innerException) { } } -} +} \ No newline at end of file diff --git a/ADotNet/Models/Foundations/Files/Exceptions/FileServiceException.cs b/ADotNet/Models/Foundations/Files/Exceptions/FileServiceException.cs index 2dd8f42..35a821f 100644 --- a/ADotNet/Models/Foundations/Files/Exceptions/FileServiceException.cs +++ b/ADotNet/Models/Foundations/Files/Exceptions/FileServiceException.cs @@ -12,7 +12,11 @@ public class FileServiceException : Xeption { public FileServiceException(Xeption innerException) : base(message: "File service error occurred, contact support.", - innerException) + innerException: innerException) + { } + + public FileServiceException(string message, Xeption innerException) + : base(message, innerException) { } } -} +} \ No newline at end of file diff --git a/ADotNet/Models/Foundations/Files/Exceptions/FileValidationException.cs b/ADotNet/Models/Foundations/Files/Exceptions/FileValidationException.cs index 954c644..0ec00b6 100644 --- a/ADotNet/Models/Foundations/Files/Exceptions/FileValidationException.cs +++ b/ADotNet/Models/Foundations/Files/Exceptions/FileValidationException.cs @@ -12,7 +12,11 @@ public class FileValidationException : Xeption { public FileValidationException(Xeption innerException) : base(message: "File validation error occurred, fix the errors and try again.", - innerException) + innerException: innerException) + { } + + public FileValidationException(string message, Xeption innerException) + : base(message, innerException) { } } -} +} \ No newline at end of file diff --git a/ADotNet/Models/Foundations/Files/Exceptions/InvalidFileContentException.cs b/ADotNet/Models/Foundations/Files/Exceptions/InvalidFileContentException.cs index eb62f09..8823963 100644 --- a/ADotNet/Models/Foundations/Files/Exceptions/InvalidFileContentException.cs +++ b/ADotNet/Models/Foundations/Files/Exceptions/InvalidFileContentException.cs @@ -13,5 +13,9 @@ public class InvalidFileContentException : Xeption public InvalidFileContentException() : base(message: "Invalid file content, fix errors and try again.") { } + + public InvalidFileContentException(string message) + : base(message) + { } } -} +} \ No newline at end of file diff --git a/ADotNet/Models/Foundations/Files/Exceptions/InvalidFileDependencyException.cs b/ADotNet/Models/Foundations/Files/Exceptions/InvalidFileDependencyException.cs index 2592a91..7290f8b 100644 --- a/ADotNet/Models/Foundations/Files/Exceptions/InvalidFileDependencyException.cs +++ b/ADotNet/Models/Foundations/Files/Exceptions/InvalidFileDependencyException.cs @@ -13,7 +13,11 @@ public class InvalidFileException : Xeption { public InvalidFileException(Exception innerException) : base(message: "Invalid file error occurred.", - innerException) + innerException: innerException) + { } + + public InvalidFileException(string message, Exception innerException) + : base(message, innerException) { } } -} +} \ No newline at end of file diff --git a/ADotNet/Models/Foundations/Files/Exceptions/InvalidFilePathException.cs b/ADotNet/Models/Foundations/Files/Exceptions/InvalidFilePathException.cs index 8bb464b..8bc2103 100644 --- a/ADotNet/Models/Foundations/Files/Exceptions/InvalidFilePathException.cs +++ b/ADotNet/Models/Foundations/Files/Exceptions/InvalidFilePathException.cs @@ -13,5 +13,9 @@ public class InvalidFilePathException : Xeption public InvalidFilePathException() : base(message: "Invalid file path, fix the errors and try again.") { } + + public InvalidFilePathException(string message) + : base(message) + { } } -} +} \ No newline at end of file diff --git a/ADotNet/Models/Pipelines/AdoPipelines/Exceptions/AdoDependencyException.cs b/ADotNet/Models/Pipelines/AdoPipelines/Exceptions/AdoDependencyException.cs index b98ce72..b6a5837 100644 --- a/ADotNet/Models/Pipelines/AdoPipelines/Exceptions/AdoDependencyException.cs +++ b/ADotNet/Models/Pipelines/AdoPipelines/Exceptions/AdoDependencyException.cs @@ -11,9 +11,12 @@ namespace ADotNet.Models.Pipelines.Exceptions public class AdoDependencyException : Exception { public AdoDependencyException(Exception innerException) - : base("Ado dependency error occured, contact support.", innerException) - { - - } + : base(message: "Ado dependency error occured, contact support.", + innerException: innerException) + { } + + public AdoDependencyException(string message, Exception innerException) + : base(message, innerException) + { } } -} +} \ No newline at end of file diff --git a/ADotNet/Models/Pipelines/AdoPipelines/Exceptions/AdoDependencyValidationException.cs b/ADotNet/Models/Pipelines/AdoPipelines/Exceptions/AdoDependencyValidationException.cs index 885853d..72bc931 100644 --- a/ADotNet/Models/Pipelines/AdoPipelines/Exceptions/AdoDependencyValidationException.cs +++ b/ADotNet/Models/Pipelines/AdoPipelines/Exceptions/AdoDependencyValidationException.cs @@ -11,9 +11,12 @@ namespace ADotNet.Models.Pipelines.Exceptions public class AdoDependencyValidationException : Exception { public AdoDependencyValidationException(Exception innerException) - : base("Ado dependency validation error occured, try again.", innerException) - { - - } + : base(message: "Ado dependency validation error occured, try again.", + innerException: innerException) + { } + + public AdoDependencyValidationException(string message, Exception innerException) + : base(message, innerException) + { } } -} +} \ No newline at end of file diff --git a/ADotNet/Models/Pipelines/AdoPipelines/Exceptions/AdoValidationException.cs b/ADotNet/Models/Pipelines/AdoPipelines/Exceptions/AdoValidationException.cs index 7639d73..4f7c16a 100644 --- a/ADotNet/Models/Pipelines/AdoPipelines/Exceptions/AdoValidationException.cs +++ b/ADotNet/Models/Pipelines/AdoPipelines/Exceptions/AdoValidationException.cs @@ -11,9 +11,12 @@ namespace ADotNet.Models.Pipelines.Exceptions public class AdoValidationException : Exception { public AdoValidationException(Exception innerException) - : base("Ado validation exception occurred, try again", innerException) - { - - } + : base(message: "Ado validation exception occurred, try again", + innerException: innerException) + { } + + public AdoValidationException(string message,Exception innerException) + : base(message, innerException) + { } } -} +} \ No newline at end of file diff --git a/ADotNet/Models/Pipelines/AdoPipelines/Exceptions/BuildServiceException.cs b/ADotNet/Models/Pipelines/AdoPipelines/Exceptions/BuildServiceException.cs index 123c87c..d710c73 100644 --- a/ADotNet/Models/Pipelines/AdoPipelines/Exceptions/BuildServiceException.cs +++ b/ADotNet/Models/Pipelines/AdoPipelines/Exceptions/BuildServiceException.cs @@ -11,9 +11,12 @@ namespace ADotNet.Models.Pipelines.Exceptions public class BuildServiceException : Exception { public BuildServiceException(Exception innerException) - : base("Build service exception occured, contact support.", innerException) - { - - } + : base(message: "Build service exception occured, contact support.", + innerException: innerException) + { } + + public BuildServiceException(string message, Exception innerException) + : base(message, innerException) + { } } -} +} \ No newline at end of file diff --git a/ADotNet/Models/Pipelines/AdoPipelines/Exceptions/NullPathException.cs b/ADotNet/Models/Pipelines/AdoPipelines/Exceptions/NullPathException.cs index 232e546..ce68bbc 100644 --- a/ADotNet/Models/Pipelines/AdoPipelines/Exceptions/NullPathException.cs +++ b/ADotNet/Models/Pipelines/AdoPipelines/Exceptions/NullPathException.cs @@ -11,6 +11,11 @@ namespace ADotNet.Models.Pipelines.Exceptions public class NullPathException : Exception { public NullPathException() - : base("Path is null") { } + : base(message: "Path is null") + { } + + public NullPathException(string message) + : base(message) + { } } -} +} \ No newline at end of file diff --git a/ADotNet/Models/Pipelines/AdoPipelines/Exceptions/NullPipelineException.cs b/ADotNet/Models/Pipelines/AdoPipelines/Exceptions/NullPipelineException.cs index c1c9793..2981d08 100644 --- a/ADotNet/Models/Pipelines/AdoPipelines/Exceptions/NullPipelineException.cs +++ b/ADotNet/Models/Pipelines/AdoPipelines/Exceptions/NullPipelineException.cs @@ -11,6 +11,11 @@ namespace ADotNet.Models.Pipelines.Exceptions public class NullPipelineException : Exception { public NullPipelineException() - : base("Pipeline is null") { } + : base(message: "Pipeline is null") + { } + + public NullPipelineException(string message) + : base(message) + { } } -} +} \ No newline at end of file diff --git a/AdoNet.Tests.Unit/Services/Builds/BuildServiceTests.Exceptions.cs b/AdoNet.Tests.Unit/Services/Builds/BuildServiceTests.Exceptions.cs index 39bd2f2..9b6a8c2 100644 --- a/AdoNet.Tests.Unit/Services/Builds/BuildServiceTests.Exceptions.cs +++ b/AdoNet.Tests.Unit/Services/Builds/BuildServiceTests.Exceptions.cs @@ -17,7 +17,7 @@ public partial class BuildServiceTests { [Theory] [MemberData(nameof(FileValidationExceptions))] - public void ShouldThrowDependencyValidationOnSerializeIfDependencyValidationErrorOccurs( + private void ShouldThrowDependencyValidationOnSerializeIfDependencyValidationErrorOccurs( Exception dependencyValidationException) { // given @@ -56,7 +56,7 @@ public void ShouldThrowDependencyValidationOnSerializeIfDependencyValidationErro [Theory] [MemberData(nameof(FileDependencyExceptions))] - public void ShouldThrowDependencyExceptionOnSerializeIfDependencyValidationErrorOccurs( + private void ShouldThrowDependencyExceptionOnSerializeIfDependencyValidationErrorOccurs( Exception dependencyException) { // given @@ -94,7 +94,7 @@ public void ShouldThrowDependencyExceptionOnSerializeIfDependencyValidationError } [Fact] - public void ShouldThrowServiceExceptionOnSerializeIfSystemErrorOccurs() + private void ShouldThrowServiceExceptionOnSerializeIfSystemErrorOccurs() { // given AspNetPipeline somePipeline = CreateRandomAspNetPipeline(); diff --git a/AdoNet.Tests.Unit/Services/Builds/BuildServiceTests.Validations.cs b/AdoNet.Tests.Unit/Services/Builds/BuildServiceTests.Validations.cs index 56ac137..6ced8a4 100644 --- a/AdoNet.Tests.Unit/Services/Builds/BuildServiceTests.Validations.cs +++ b/AdoNet.Tests.Unit/Services/Builds/BuildServiceTests.Validations.cs @@ -16,14 +16,15 @@ namespace ADotNet.Tests.Unit.Services public partial class BuildServiceTests { [Fact] - public void ShouldThrowValidationExceptionOnSerializeIfPipelineIsNull() + private void ShouldThrowValidationExceptionOnSerializeIfPipelineIsNull() { // given AspNetPipeline invalidPipeline = null; string somePath = GetRandomFilePath(); var nullPiplineException = - new NullPipelineException(); + new NullPipelineException( + message: "Pipeline is null"); // when Action serializeAndWriteToFileAction = () => @@ -50,7 +51,7 @@ public void ShouldThrowValidationExceptionOnSerializeIfPipelineIsNull() } [Fact] - public void ShouldThrowValidationExceptionOnSerializeIfPathIsNull() + private void ShouldThrowValidationExceptionOnSerializeIfPathIsNull() { // given string invalidPath = null; @@ -59,7 +60,8 @@ public void ShouldThrowValidationExceptionOnSerializeIfPathIsNull() CreateRandomAspNetPipeline(); var nullPathException = - new NullPathException(); + new NullPathException( + message: "Path is null"); // when Action serializeAndWriteToFileAction = () => diff --git a/AdoNet.Tests.Unit/Services/Builds/BuildServiceTests.logic.cs b/AdoNet.Tests.Unit/Services/Builds/BuildServiceTests.logic.cs index 7571ea4..e68e49f 100644 --- a/AdoNet.Tests.Unit/Services/Builds/BuildServiceTests.logic.cs +++ b/AdoNet.Tests.Unit/Services/Builds/BuildServiceTests.logic.cs @@ -13,7 +13,7 @@ namespace ADotNet.Tests.Unit.Services public partial class BuildServiceTests { [Fact] - public void ShouldSerializeAndWriteAdoPipelineModel() + private void ShouldSerializeAndWriteAdoPipelineModel() { // given AspNetPipeline randomAspNetPipeline = diff --git a/AdoNet.Tests.Unit/Services/Foundations/Files/FileServiceTests.Exceptions.Write.cs b/AdoNet.Tests.Unit/Services/Foundations/Files/FileServiceTests.Exceptions.Write.cs index c22e58b..d289f87 100644 --- a/AdoNet.Tests.Unit/Services/Foundations/Files/FileServiceTests.Exceptions.Write.cs +++ b/AdoNet.Tests.Unit/Services/Foundations/Files/FileServiceTests.Exceptions.Write.cs @@ -16,7 +16,7 @@ public partial class FileServiceTests { [Theory] [MemberData(nameof(FileDependencyValidationExceptions))] - public void ShouldThrowDependencyValidationExceptionOnWriteIfDependencyValidationErrorOccurs( + private void ShouldThrowDependencyValidationExceptionOnWriteIfDependencyValidationErrorOccurs( Exception dependencyValidationException) { // given @@ -25,11 +25,13 @@ public void ShouldThrowDependencyValidationExceptionOnWriteIfDependencyValidatio var invalidFileException = new InvalidFileException( - dependencyValidationException); + message: "Invalid file error occurred.", + innerException: dependencyValidationException); var fileDependencyValidationException = new FileDependencyValidationException( - invalidFileException); + message: "File dependency validation error occurred, fix the errors and try again.", + innerException: invalidFileException); this.filesBrokerMock.Setup(broker => broker.WriteToFile(It.IsAny(), It.IsAny())) @@ -51,7 +53,7 @@ public void ShouldThrowDependencyValidationExceptionOnWriteIfDependencyValidatio } [Fact] - public void ShouldThrowDependencyExceptionOnWriteIfSerializationErrorOccurs() + private void ShouldThrowDependencyExceptionOnWriteIfSerializationErrorOccurs() { // given string somePath = GetRandomString(); @@ -62,11 +64,13 @@ public void ShouldThrowDependencyExceptionOnWriteIfSerializationErrorOccurs() var failedFileSerializationException = new FailedFileSerializationException( - serializationException); + message: "Failed file serialization error occurred, contact support.", + innerException: serializationException); var fileDependencyException = new FileDependencyException( - failedFileSerializationException); + message: "File dependency error occurred, contact support.", + innerException: failedFileSerializationException); this.filesBrokerMock.Setup(broker => broker.WriteToFile(It.IsAny(), It.IsAny())) @@ -88,7 +92,7 @@ public void ShouldThrowDependencyExceptionOnWriteIfSerializationErrorOccurs() } [Fact] - public void ShoudThrowServiceExceptionOnWriteIfServiceErrorOccurs() + private void ShoudThrowServiceExceptionOnWriteIfServiceErrorOccurs() { // given string somePath = GetRandomString(); @@ -96,10 +100,14 @@ public void ShoudThrowServiceExceptionOnWriteIfServiceErrorOccurs() var serviceException = new Exception(); var failedFileServiceException = - new FailedFileServiceException(serviceException); + new FailedFileServiceException( + message: "Failed file service error occurred, contact support.", + innerException: serviceException); var fileServiceException = - new FileServiceException(failedFileServiceException); + new FileServiceException( + message: "File service error occurred, contact support.", + innerException: failedFileServiceException); this.filesBrokerMock.Setup(broker => broker.WriteToFile(It.IsAny(), It.IsAny())) diff --git a/AdoNet.Tests.Unit/Services/Foundations/Files/FileServiceTests.Logic.Write.cs b/AdoNet.Tests.Unit/Services/Foundations/Files/FileServiceTests.Logic.Write.cs index f1140cb..e8ed34a 100644 --- a/AdoNet.Tests.Unit/Services/Foundations/Files/FileServiceTests.Logic.Write.cs +++ b/AdoNet.Tests.Unit/Services/Foundations/Files/FileServiceTests.Logic.Write.cs @@ -12,7 +12,7 @@ namespace AdoNet.Tests.Unit.Services.Foundations.Files public partial class FileServiceTests { [Fact] - public void ShouldWriteToFile() + private void ShouldWriteToFile() { // given string randomFilePath = GetRandomString(); diff --git a/AdoNet.Tests.Unit/Services/Foundations/Files/FileServiceTests.Validations.Write.cs b/AdoNet.Tests.Unit/Services/Foundations/Files/FileServiceTests.Validations.Write.cs index 69eec28..51e18ae 100644 --- a/AdoNet.Tests.Unit/Services/Foundations/Files/FileServiceTests.Validations.Write.cs +++ b/AdoNet.Tests.Unit/Services/Foundations/Files/FileServiceTests.Validations.Write.cs @@ -17,18 +17,20 @@ public partial class FileServiceTests [InlineData(null)] [InlineData("")] [InlineData(" ")] - public void ShouldThrowValidationExceptionOnWriteIfPathIsInvalid( + private void ShouldThrowValidationExceptionOnWriteIfPathIsInvalid( string invalidPath) { // given string someContent = GetRandomString(); var invalidFilePathException = - new InvalidFilePathException(); + new InvalidFilePathException( + message: "Invalid file path, fix the errors and try again."); var expectedFileValidationException = new FileValidationException( - invalidFilePathException); + message: "File validation error occurred, fix the errors and try again.", + innerException: invalidFilePathException); // when Action writeToFileAction = () => @@ -53,18 +55,20 @@ public void ShouldThrowValidationExceptionOnWriteIfPathIsInvalid( [InlineData(null)] [InlineData("")] [InlineData(" ")] - public void ShouldThrowValidationExceptionOnWriteIfContentIsInvalid( + private void ShouldThrowValidationExceptionOnWriteIfContentIsInvalid( string invalidContent) { // given string somePath = GetRandomString(); var invalidFileContentException = - new InvalidFileContentException(); + new InvalidFileContentException( + message: "Invalid file content, fix errors and try again."); var expectedFileValidationException = new FileValidationException( - invalidFileContentException); + message: "File validation error occurred, fix the errors and try again.", + innerException: invalidFileContentException); // when Action writeToFileAction = () =>