refactor (readonly for static objects in tests and file-scoped namespaces
This commit is contained in:
		| @@ -1,11 +1,11 @@ | ||||
| using System.ComponentModel.DataAnnotations; | ||||
|  | ||||
| namespace BlazorWebAssemblyVisaApiClient.Infrastructure.Helpers | ||||
| namespace BlazorWebAssemblyVisaApiClient.Infrastructure.Helpers; | ||||
|  | ||||
| public static class EnumExtensions | ||||
| { | ||||
|     public static class EnumExtensions | ||||
|     public static string GetDisplayName(this Enum value) | ||||
|     { | ||||
|         public static string GetDisplayName(this Enum value) | ||||
|         { | ||||
|             var enumMembers = value.GetType().GetMembers(); | ||||
|             var member = enumMembers.First(info => info.Name == value.ToString()); | ||||
|             var displayAttribute = (DisplayAttribute?)member | ||||
| @@ -14,5 +14,4 @@ namespace BlazorWebAssemblyVisaApiClient.Infrastructure.Helpers | ||||
|             var displayName = displayAttribute?.Name ?? value.ToString(); | ||||
|             return displayName; | ||||
|         } | ||||
|     } | ||||
| } | ||||
| } | ||||
| @@ -1,15 +1,15 @@ | ||||
| using System.Text; | ||||
| using FluentValidation.Results; | ||||
|  | ||||
| namespace BlazorWebAssemblyVisaApiClient.Infrastructure.Helpers | ||||
| { | ||||
|     public static class ValidationResultExtensions | ||||
|     { | ||||
|         public static string ToErrorsString(this ValidationResult validationResult) | ||||
|             => ErrorsToString(validationResult.Errors.Select(e => e.ErrorMessage)); | ||||
| namespace BlazorWebAssemblyVisaApiClient.Infrastructure.Helpers; | ||||
|  | ||||
|         private static string ErrorsToString(IEnumerable<string> errors) | ||||
|         { | ||||
| public static class ValidationResultExtensions | ||||
| { | ||||
|     public static string ToErrorsString(this ValidationResult validationResult) | ||||
|         => ErrorsToString(validationResult.Errors.Select(e => e.ErrorMessage)); | ||||
|  | ||||
|     private static string ErrorsToString(IEnumerable<string> errors) | ||||
|     { | ||||
|             var stringBuilder = new StringBuilder(); | ||||
|             foreach (var error in errors) | ||||
|             { | ||||
| @@ -18,5 +18,4 @@ namespace BlazorWebAssemblyVisaApiClient.Infrastructure.Helpers | ||||
|  | ||||
|             return stringBuilder.ToString(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user