diff --git a/PROFiLiX.Common.Tests/File/FilesAndFoldersTests.cs b/PROFiLiX.Common.Tests/File/FilesAndFoldersTests.cs index 039cfa6..d2bdb72 100644 --- a/PROFiLiX.Common.Tests/File/FilesAndFoldersTests.cs +++ b/PROFiLiX.Common.Tests/File/FilesAndFoldersTests.cs @@ -80,6 +80,27 @@ public void DeleteFolderAsync_WithValidData_ShouldSucceed() Assert.That(response, Is.True); } + /// + /// Checks that DeleteFileAsync with with Valid data succeeds. + /// + [Test] + public void DirectorySizeAsync_WithValidData_ShouldSucceed() + { + // Arrange + var mockILogger = new Mock(); + var mockFilesAndFolders = new FilesAndFolders(mockILogger.Object); + string folderName = "C:\\windows\\temp"; + Directory.CreateDirectory(folderName); + Thread.Sleep(2000); + DirectoryInfo di = new DirectoryInfo(folderName); + + // Act + var response = mockFilesAndFolders.DirectorySizeAsync(di).Result; + + // Assert + Assert.That(response, Is.GreaterThan(0)); + } + /// /// Checks that FormatFileSize Valid data succeeds. /// @@ -301,6 +322,24 @@ public void CreateDirectory_WithInvalidFolderName_ShouldThrowArgumentNullExcepti Assert.Throws(() => mockFilesAndFolders.CreateDirectory(rootFolder)); } + /// + /// Checks that CheckDirectory with invalid data errors. + /// + [Test] + public void DirectorySizeAsync_WithInvalidFolderName_ShouldThrowArgumentNullException() + { + // Arrange + var mockILogger = new Mock(); + var mockFilesAndFolders = new FilesAndFolders(mockILogger.Object); + DirectoryInfo? directoryInfo = null; + + // Act + Assert + Assert.Throws(() => + { + long result = mockFilesAndFolders.DirectorySizeAsync(directoryInfo).Result; + }); + } + /// /// Checks that CheckDirectory with invalid data errors. /// diff --git a/PROFiLiX.Common.Tests/Registry/RegistryTests.cs b/PROFiLiX.Common.Tests/Registry/RegistryTests.cs index ef45de8..2ed19f8 100644 --- a/PROFiLiX.Common.Tests/Registry/RegistryTests.cs +++ b/PROFiLiX.Common.Tests/Registry/RegistryTests.cs @@ -12,6 +12,7 @@ namespace PROFiLiX.Common.Tests.Registry using PROFiLiX.Common.Registry; using PROFiLiX.Common.Registry.Exceptions; using PROFiLiX.Common.Registry.Model; + using System.IO; /// /// Class to do Registry unit tests. @@ -654,6 +655,18 @@ public void InvalidKeyException_WithMessageAndInnerException_ShouldThrowExceptio } } + /// + /// Test method to ensure InvalidValueException with message throws correctly. + /// + [Test] + public void InvalidValueException_WithDefault_ShouldThrowException() + { + var result = new InvalidValueException(); + var message = result.Message; + + StringAssert.Contains("InvalidValueException", message); + } + /// /// Test method to ensure InvalidValueException with message throws correctly. ///