diff --git a/MainProject.Tests/Utils/FileUtils_Tests.cs b/MainProject.Tests/Utils/FileUtils_Tests.cs index a689650..18001a5 100644 --- a/MainProject.Tests/Utils/FileUtils_Tests.cs +++ b/MainProject.Tests/Utils/FileUtils_Tests.cs @@ -5,60 +5,45 @@ using BasicDotnetTemplate.MainProject.Models.Common; namespace BasicDotnetTemplate.MainProject.Tests; [TestClass] -public static class FileUtils_Tests +public class FileUtils_Tests { [TestMethod] - public static void ConvertFileToObject_NoFilePath() + public void ConvertFileToObject_NoFilePath() { try { - try - { - PermissionsFile? permissionsFile = FileUtils.ConvertFileToObject(String.Empty); - Assert.Fail($"Expected exception instead of response: {permissionsFile}"); - } - catch (ArgumentException argumentException) - { - Assert.IsInstanceOfType(argumentException, typeof(ArgumentException)); - } - catch (Exception exception) - { - Assert.Fail($"An exception was thrown: {exception}"); - } + PermissionsFile? permissionsFile = FileUtils.ConvertFileToObject(String.Empty); + Assert.Fail($"Expected exception instead of response: {permissionsFile}"); } - catch (Exception ex) + catch (ArgumentException argumentException) { - Console.WriteLine(ex.InnerException); - Assert.Fail($"An exception was thrown: {ex}"); + Assert.IsInstanceOfType(argumentException, typeof(ArgumentException)); + } + catch (Exception exception) + { + Assert.Fail($"An exception was thrown: {exception}"); } } [TestMethod] - public static void ConvertFileToObject_NoFile() + public void ConvertFileToObject_NoFile() { try { - try - { - PermissionsFile? permissionsFile = FileUtils.ConvertFileToObject(System.AppDomain.CurrentDomain.BaseDirectory + "Config/no-permissions.json"); - Assert.Fail($"Expected exception instead of response: {permissionsFile}"); - } - catch (FileNotFoundException fileNotFoundException) - { - Assert.IsInstanceOfType(fileNotFoundException, typeof(FileNotFoundException)); - } - catch (Exception exception) - { - Assert.Fail($"An exception was thrown: {exception}"); - } + PermissionsFile? permissionsFile = FileUtils.ConvertFileToObject(System.AppDomain.CurrentDomain.BaseDirectory + "Config/no-permissions.json"); + Assert.Fail($"Expected exception instead of response: {permissionsFile}"); } - catch (Exception ex) + catch (FileNotFoundException fileNotFoundException) { - Console.WriteLine(ex.InnerException); - Assert.Fail($"An exception was thrown: {ex}"); + Assert.IsInstanceOfType(fileNotFoundException, typeof(FileNotFoundException)); + } + catch (Exception exception) + { + Assert.Fail($"An exception was thrown: {exception}"); } } + }