From f88a108f2766d29ffc3bc62a30591dea7e212e09 Mon Sep 17 00:00:00 2001 From: ivans Date: Thu, 6 Feb 2025 00:07:44 +0400 Subject: [PATCH] =?UTF-8?q?=D1=87=D1=83=D1=82=D0=BE=D0=BA=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=B4=D0=B5=D0=BB=D0=B0=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Exceptions/ValidationException.cs | 11 ++++++++++ .../Extensions/StringExtensions.cs | 20 +++++++++++++++++++ .../Infrastructure/IValidation.cs | 11 ++++++++++ .../SweetBunsContracts.csproj | 4 ++++ 4 files changed, 46 insertions(+) create mode 100644 SweetBunsContracts/SweetBunsContracts/Exceptions/ValidationException.cs create mode 100644 SweetBunsContracts/SweetBunsContracts/Extensions/StringExtensions.cs create mode 100644 SweetBunsContracts/SweetBunsContracts/Infrastructure/IValidation.cs diff --git a/SweetBunsContracts/SweetBunsContracts/Exceptions/ValidationException.cs b/SweetBunsContracts/SweetBunsContracts/Exceptions/ValidationException.cs new file mode 100644 index 0000000..3cf6586 --- /dev/null +++ b/SweetBunsContracts/SweetBunsContracts/Exceptions/ValidationException.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SweetBunsContracts.Exceptions; + +public class ValidationException(string message) : Exception(message) +{ +} diff --git a/SweetBunsContracts/SweetBunsContracts/Extensions/StringExtensions.cs b/SweetBunsContracts/SweetBunsContracts/Extensions/StringExtensions.cs new file mode 100644 index 0000000..c85e644 --- /dev/null +++ b/SweetBunsContracts/SweetBunsContracts/Extensions/StringExtensions.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SweetBunsContracts.Extensions; + +public static class StringExtensions +{ + public static bool IsEmpty(this string str) + { + return string.IsNullOrWhiteSpace(str); + } + + public static bool IsGuid(this string str) + { + return Guid.TryParse(str, out _); + } +} diff --git a/SweetBunsContracts/SweetBunsContracts/Infrastructure/IValidation.cs b/SweetBunsContracts/SweetBunsContracts/Infrastructure/IValidation.cs new file mode 100644 index 0000000..6472385 --- /dev/null +++ b/SweetBunsContracts/SweetBunsContracts/Infrastructure/IValidation.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SweetBunsContracts.Infrastructure; +public class IValidation +{ + void Validate(); +} diff --git a/SweetBunsContracts/SweetBunsContracts/SweetBunsContracts.csproj b/SweetBunsContracts/SweetBunsContracts/SweetBunsContracts.csproj index fa71b7a..9339af7 100644 --- a/SweetBunsContracts/SweetBunsContracts/SweetBunsContracts.csproj +++ b/SweetBunsContracts/SweetBunsContracts/SweetBunsContracts.csproj @@ -6,4 +6,8 @@ enable + + + +