diff --git a/CHANGELOG b/CHANGELOG index cf42ec1..93f647b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +v4.1.0 +- Library: + - Refactoring: moved Files and Validation to NW.Shared.Files and NW.Shared.Validation. + v4.0.0 - BREAKING CHANGES - Library: - Feature: "Bag Pattern" adopted into the codebase (*Settings => SettingBag, *Components => ComponentBag, ...). diff --git a/codecoverage_library.svg b/codecoverage_library.svg index 3bdeb17..f0ecfbd 100644 --- a/codecoverage_library.svg +++ b/codecoverage_library.svg @@ -1 +1 @@ -coverage: 89.47%coverage89.47% \ No newline at end of file +coverage: 97.86%coverage97.86% \ No newline at end of file diff --git a/codecoverage_library.txt b/codecoverage_library.txt index fbc361a..05ee472 100644 --- a/codecoverage_library.txt +++ b/codecoverage_library.txt @@ -1 +1 @@ -https://img.shields.io/badge/coverage-89.47%25-green \ No newline at end of file +https://img.shields.io/badge/coverage-97.86%25-green \ No newline at end of file diff --git a/src/NW.UnivariateForecasting/AsciiBanner/AsciiBannerManager.cs b/src/NW.UnivariateForecasting/AsciiBanner/AsciiBannerManager.cs index 65c220c..47ec8db 100644 --- a/src/NW.UnivariateForecasting/AsciiBanner/AsciiBannerManager.cs +++ b/src/NW.UnivariateForecasting/AsciiBanner/AsciiBannerManager.cs @@ -1,5 +1,5 @@ using System; -using NW.UnivariateForecasting.Validation; +using NW.Shared.Validation; namespace NW.UnivariateForecasting.AsciiBanner { diff --git a/src/NW.UnivariateForecasting/Bags/ComponentBag.cs b/src/NW.UnivariateForecasting/Bags/ComponentBag.cs index 7b0dd0c..163d6aa 100644 --- a/src/NW.UnivariateForecasting/Bags/ComponentBag.cs +++ b/src/NW.UnivariateForecasting/Bags/ComponentBag.cs @@ -1,12 +1,12 @@ using System; using NW.UnivariateForecasting.AsciiBanner; using NW.UnivariateForecasting.Filenames; -using NW.UnivariateForecasting.Files; +using NW.Shared.Files; using NW.UnivariateForecasting.Forecasts; using NW.UnivariateForecasting.Observations; using NW.UnivariateForecasting.Serializations; using NW.UnivariateForecasting.SlidingWindows; -using NW.UnivariateForecasting.Validation; +using NW.Shared.Validation; namespace NW.UnivariateForecasting.Bags { diff --git a/src/NW.UnivariateForecasting/Bags/SettingBag.cs b/src/NW.UnivariateForecasting/Bags/SettingBag.cs index 02eea84..d2ae95d 100644 --- a/src/NW.UnivariateForecasting/Bags/SettingBag.cs +++ b/src/NW.UnivariateForecasting/Bags/SettingBag.cs @@ -1,6 +1,6 @@ using System; using System.IO; -using NW.UnivariateForecasting.Validation; +using NW.Shared.Validation; namespace NW.UnivariateForecasting.Bags { diff --git a/src/NW.UnivariateForecasting/Filenames/FilenameFactory.cs b/src/NW.UnivariateForecasting/Filenames/FilenameFactory.cs index 7400a50..f2ce168 100644 --- a/src/NW.UnivariateForecasting/Filenames/FilenameFactory.cs +++ b/src/NW.UnivariateForecasting/Filenames/FilenameFactory.cs @@ -1,6 +1,6 @@ using System; using System.IO; -using NW.UnivariateForecasting.Validation; +using NW.Shared.Validation; namespace NW.UnivariateForecasting.Filenames { diff --git a/src/NW.UnivariateForecasting/Files/FileAdapter.cs b/src/NW.UnivariateForecasting/Files/FileAdapter.cs deleted file mode 100644 index 95a1f24..0000000 --- a/src/NW.UnivariateForecasting/Files/FileAdapter.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System.Collections.Generic; -using System.IO; -using System.Text; - -namespace NW.UnivariateForecasting.Files -{ - /// - public class FileAdapter : IFileAdapter - { - - #region Fields - #endregion - - #region Properties - #endregion - - #region Constructors - - /// Initializes a instance. - public FileAdapter() { } - - #endregion - - #region Methods_public - - public void AppendAllLines(string path, IEnumerable contents) - => File.AppendAllLines(path, contents); - public void AppendAllLines(string path, IEnumerable contents, Encoding encoding) - => File.AppendAllLines(path, contents, encoding); - public void AppendAllText(string path, string contents) - => File.AppendAllText(path, contents); - public void AppendAllText(string path, string contents, Encoding encoding) - => File.AppendAllText(path, contents, encoding); - public string[] ReadAllLines(string path) - => File.ReadAllLines(path); - public string[] ReadAllLines(string path, Encoding encoding) - => File.ReadAllLines(path, encoding); - public string ReadAllText(string path) - => File.ReadAllText(path); - public string ReadAllText(string path, Encoding encoding) - => File.ReadAllText(path, encoding); - public void WriteAllLines(string path, IEnumerable contents) - => File.WriteAllLines(path, contents); - public void WriteAllLines(string path, IEnumerable contents, Encoding encoding) - => File.WriteAllLines(path, contents, encoding); - public void WriteAllText(string path, string contents) - => File.WriteAllText(path, contents); - public void WriteAllText(string path, string contents, Encoding encoding) - => File.WriteAllText(path, contents, encoding); - - #endregion - - } -} - -/* - Author: numbworks@gmail.com - Last Update: 30.05.2021 -*/ \ No newline at end of file diff --git a/src/NW.UnivariateForecasting/Files/FileInfoAdapter.cs b/src/NW.UnivariateForecasting/Files/FileInfoAdapter.cs deleted file mode 100644 index 64eca2c..0000000 --- a/src/NW.UnivariateForecasting/Files/FileInfoAdapter.cs +++ /dev/null @@ -1,170 +0,0 @@ -using System; -using System.IO; -using System.Runtime.Serialization; -using NW.UnivariateForecasting.Validation; - -namespace NW.UnivariateForecasting.Files -{ - /// - public class FileInfoAdapter : IFileInfoAdapter - { - - #region Fields - - private FileInfo _fileInfo; - - #endregion - - #region Properties - - public bool IsReadOnly - { - get { return _fileInfo.IsReadOnly; } - set { _fileInfo.IsReadOnly = value; } - } - public bool Exists - { - get { return _fileInfo.Exists; } - } - public string DirectoryName - { - get { return _fileInfo.DirectoryName; } - } - public DirectoryInfo Directory - { - get { return _fileInfo.Directory; } - } - public long Length - { - get { return _fileInfo.Length; } - } - public string Name - { - get { return _fileInfo.Name; } - } - public DateTime LastWriteTime - { - get { return _fileInfo.LastWriteTime; } - set { _fileInfo.LastWriteTime = value; } - } - public DateTime LastAccessTimeUtc - { - get { return _fileInfo.LastAccessTimeUtc; } - set { _fileInfo.LastAccessTimeUtc = value; } - } - public DateTime LastAccessTime - { - get { return _fileInfo.LastAccessTime; } - set { _fileInfo.LastAccessTime = value; } - } - public string FullName - { - get { return _fileInfo.FullName; } - } - public string Extension - { - get { return _fileInfo.Extension; } - } - public DateTime CreationTime - { - get { return _fileInfo.CreationTime; } - set { _fileInfo.CreationTime = value; } - } - public DateTime LastWriteTimeUtc - { - get { return _fileInfo.LastWriteTimeUtc; } - set { _fileInfo.LastWriteTimeUtc = value; } - } - public FileAttributes Attributes - { - get { return _fileInfo.Attributes; } - set { _fileInfo.Attributes = value; } - } - public DateTime CreationTimeUtc - { - get { return _fileInfo.CreationTimeUtc; } - set { _fileInfo.CreationTimeUtc = value; } - } - - #endregion - - #region Constructors - - /// Initializes a instance. - /// - public FileInfoAdapter(FileInfo fileInfo) - { - - Validator.ValidateObject(fileInfo, nameof(fileInfo)); - - _fileInfo = fileInfo; - - } - - /// Initializes a instance. - /// - /// - /// - /// - /// - public FileInfoAdapter(string fileName) - { - - _fileInfo = new FileInfo(fileName); - - } - - #endregion - - #region Methods_public - - public StreamWriter AppendText() - => _fileInfo.AppendText(); - public FileInfo CopyTo(string destFileName) - => _fileInfo.CopyTo(destFileName); - public FileInfo CopyTo(string destFileName, bool overwrite) - => _fileInfo.CopyTo(destFileName, overwrite); - public FileStream Create() - => _fileInfo.Create(); - public StreamWriter CreateText() - => _fileInfo.CreateText(); - public void Decrypt() - => _fileInfo.Decrypt(); - public void Delete() - => _fileInfo.Delete(); - public void Encrypt() - => _fileInfo.Encrypt(); - public void MoveTo(string destFileName) - => _fileInfo.MoveTo(destFileName); - public FileStream Open(FileMode mode, FileAccess access, FileShare share) - => _fileInfo.Open(mode, access, share); - public FileStream Open(FileMode mode, FileAccess access) - => _fileInfo.Open(mode, access); - public FileStream Open(FileMode mode) - => _fileInfo.Open(mode); - public FileStream OpenRead() - => _fileInfo.OpenRead(); - public StreamReader OpenText() - => _fileInfo.OpenText(); - public FileStream OpenWrite() - => _fileInfo.OpenWrite(); - public FileInfo Replace(string destinationFileName, string destinationBackupFileName, bool ignoreMetadataErrors) - => _fileInfo.Replace(destinationFileName, destinationBackupFileName, ignoreMetadataErrors); - public FileInfo Replace(string destinationFileName, string destinationBackupFileName) - => _fileInfo.Replace(destinationFileName, destinationBackupFileName); - public override string ToString() - => _fileInfo.ToString(); - public void GetObjectData(SerializationInfo info, StreamingContext context) - => _fileInfo.GetObjectData(info, context); - public void Refresh() - => _fileInfo.Refresh(); - - #endregion - - } -} - -/* - Author: numbworks@gmail.com - Last Update: 08.10.2021 -*/ \ No newline at end of file diff --git a/src/NW.UnivariateForecasting/Files/FileManager.cs b/src/NW.UnivariateForecasting/Files/FileManager.cs deleted file mode 100644 index 9443e4f..0000000 --- a/src/NW.UnivariateForecasting/Files/FileManager.cs +++ /dev/null @@ -1,149 +0,0 @@ -using System; -using System.IO; -using System.Collections.Generic; -using NW.UnivariateForecasting.Validation; - -namespace NW.UnivariateForecasting.Files -{ - /// - public class FileManager : IFileManager - { - - #region Fields - - private IFileAdapter _fileAdapter; - - #endregion - - #region Properties - #endregion - - #region Constructors - - /// Initializes a instance using - /// - public FileManager(IFileAdapter fileAdapter) - { - - Validator.ValidateObject(fileAdapter, nameof(fileAdapter)); - - _fileAdapter = fileAdapter; - - } - - /// Initializes a instance using default parameters. - public FileManager() - { - - _fileAdapter = new FileAdapter(); - - } - - #endregion - - #region Methods_public - - public IEnumerable ReadAllLines(IFileInfoAdapter file) - { - - Validator.ValidateObject(file, nameof(file)); - Validator.ValidateFileExistance(file); - - try - { - - return _fileAdapter.ReadAllLines(file.FullName); - - } - catch (Exception e) - { - - throw new Exception(MessageCollection.NotPossibleToRead(file, e), e); - - } - - } - public string ReadAllText(IFileInfoAdapter file) - { - - Validator.ValidateObject(file, nameof(file)); - Validator.ValidateFileExistance(file); - - try - { - - return _fileAdapter.ReadAllText(file.FullName); - - } - catch (Exception e) - { - - throw new Exception(MessageCollection.NotPossibleToRead(file, e), e); - - } - - } - public void WriteAllLines(IFileInfoAdapter file, IEnumerable content) - { - - Validator.ValidateObject(file, nameof(file)); - - try - { - - _fileAdapter.WriteAllLines(file.FullName, content); - - } - catch (Exception e) - { - - throw new Exception(MessageCollection.NotPossibleToWrite(file, e), e); - - } - - } - public void WriteAllText(IFileInfoAdapter file, string content) - { - - Validator.ValidateObject(file, nameof(file)); - - try - { - - _fileAdapter.WriteAllText(file.FullName, content); - - } - catch (Exception e) - { - - throw new Exception(MessageCollection.NotPossibleToWrite(file, e), e); - - } - - } - public IFileInfoAdapter Create(string filePath) - { - - Validator.ValidateStringNullOrWhiteSpace(filePath, nameof(filePath)); - - return Create(new FileInfo(filePath)); - - } - public IFileInfoAdapter Create(FileInfo fileInfo) - { - - Validator.ValidateObject(fileInfo, nameof(fileInfo)); - - return new FileInfoAdapter(fileInfo); - - } - - #endregion - - } -} - -/* - Author: numbworks@gmail.com - Last Update: 08.10.2021 -*/ \ No newline at end of file diff --git a/src/NW.UnivariateForecasting/Files/IFileAdapter.cs b/src/NW.UnivariateForecasting/Files/IFileAdapter.cs deleted file mode 100644 index 9df5c4d..0000000 --- a/src/NW.UnivariateForecasting/Files/IFileAdapter.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System.Collections.Generic; -using System.Text; -using System.IO; - -namespace NW.UnivariateForecasting.Files -{ - /// Adapter for . - public interface IFileAdapter - { - - /// - /// Appends lines to a file, and then closes the file. - /// If the specified file does not exist, this method creates a file, - /// writes the specified lines to the file, and then closes the file. - /// - void AppendAllLines(string path, IEnumerable contents); - - /// - /// Appends lines to a file by using a specified encoding, and then closes the file. - /// If the specified file does not exist, this method creates a file, writes the - /// specified lines to the file, and then closes the file. - /// - void AppendAllLines(string path, IEnumerable contents, Encoding encoding); - - /// - /// Opens a file, appends the specified string to the file, and then closes the file. - /// If the file does not exist, this method creates a file, writes the specified - /// string to the file, then closes the file. - /// - void AppendAllText(string path, string contents); - - /// - /// Appends the specified string to the file, creating the file if it does not already exist. - /// - void AppendAllText(string path, string contents, Encoding encoding); - - /// - /// Opens a text file, reads all lines of the file, and then closes the file. - /// - string[] ReadAllLines(string path); - - /// - /// Opens a file, reads all lines of the file with the specified encoding, and then closes the file. - /// - string[] ReadAllLines(string path, Encoding encoding); - - /// - /// Opens a text file, reads all lines of the file, and then closes the file. - /// - string ReadAllText(string path); - - /// - /// Opens a file, reads all lines of the file with the specified encoding, and then closes the file. - /// - string ReadAllText(string path, Encoding encoding); - - /// - /// Creates a new file, writes a collection of strings to the file, and then closes the file. - /// - void WriteAllLines(string path, IEnumerable contents); - - /// - /// Creates a new file by using the specified encoding, writes a collection of strings - /// to the file, and then closes the file. - /// - void WriteAllLines(string path, IEnumerable contents, Encoding encoding); - - /// - /// Creates a new file, writes the specified string to the file, and then closes - /// the file. If the target file already exists, it is overwritten. - /// - void WriteAllText(string path, string contents); - - /// - /// Creates a new file, writes the specified string to the file using the specified - /// encoding, and then closes the file. If the target file already exists, it is - /// overwritten. - /// - void WriteAllText(string path, string contents, Encoding encoding); - - } -} - -/* - Author: numbworks@gmail.com - Last Update: 30.05.2021 -*/ \ No newline at end of file diff --git a/src/NW.UnivariateForecasting/Files/IFileInfoAdapter.cs b/src/NW.UnivariateForecasting/Files/IFileInfoAdapter.cs deleted file mode 100644 index 3c22b78..0000000 --- a/src/NW.UnivariateForecasting/Files/IFileInfoAdapter.cs +++ /dev/null @@ -1,200 +0,0 @@ -using System; -using System.IO; -using System.Runtime.Serialization; - -namespace NW.UnivariateForecasting.Files -{ - /// Adapter for . - public interface IFileInfoAdapter - { - - /// - /// Gets or sets the creation time of the current file or directory. - /// - DateTime CreationTime { get; set; } - - /// - /// Gets or sets the creation time, in coordinated universal time (UTC), of the current - /// file or directory. - /// - DateTime CreationTimeUtc { get; set; } - - /// - /// Gets or sets the time the current file or directory was last accessed. - /// - DateTime LastAccessTime { get; set; } - - /// - /// Gets or sets the time, in coordinated universal time (UTC), that the current - /// file or directory was last accessed. - /// - DateTime LastAccessTimeUtc { get; set; } - - /// - /// Gets or sets the time when the current file or directory was last written to. - /// - DateTime LastWriteTime { get; set; } - - /// - /// Gets or sets the time, in coordinated universal time (UTC), when the current - /// file or directory was last written to. - /// - DateTime LastWriteTimeUtc { get; set; } - - /// - /// Gets the string representing the extension part of the file. - /// - string Extension { get; } - - /// - /// Gets the full path of the directory or file. - /// - string FullName { get; } - - /// - /// Gets or sets a value that determines if the current file is read only. - /// - bool IsReadOnly { get; set; } - - /// - /// Gets a value indicating whether a file exists. - /// - bool Exists { get; } - - /// - /// Gets a string representing the directory's full path. - /// - string DirectoryName { get; } - - /// - /// Gets an instance of the parent directory. - /// - DirectoryInfo Directory { get; } - - /// - /// Gets the size, in bytes, of the current file. - /// - long Length { get; } - - /// - /// Gets the name of the file. - /// - string Name { get; } - - /// - /// - /// - FileAttributes Attributes { get; set; } - - /// - /// Creates a that appends text to the file represented by - /// this instance of the . - /// - StreamWriter AppendText(); - - /// - /// Copies an existing file to a new file, disallowing the overwriting of an existing file. - /// - FileInfo CopyTo(string destFileName); - - /// - /// Copies an existing file to a new file, allowing the overwriting of an existing file. - /// - FileInfo CopyTo(string destFileName, bool overwrite); - - /// - /// Creates a file. - /// - FileStream Create(); - - /// - /// Creates a that writes a new text file. - /// - StreamWriter CreateText(); - - /// - /// Decrypts a file that was encrypted by the current account using the method. - /// - void Decrypt(); - - /// - /// Permanently deletes a file. - /// - void Delete(); - - /// - /// Encrypts a file so that only the account used to encrypt the file can decrypt it. - /// - void Encrypt(); - - /// - /// Moves a specified file to a new location, providing the option to specify a new file name. - /// - void MoveTo(string destFileName); - - /// - /// Opens a file in the specified mode. - /// - FileStream Open(FileMode mode); - - /// - /// Opens a file in the specified mode with read, write, or read/write access. - /// - FileStream Open(FileMode mode, FileAccess access); - - /// - /// Opens a file in the specified mode with read, write, or read/write access and - /// the specified sharing option. - /// - FileStream Open(FileMode mode, FileAccess access, FileShare share); - - /// - /// Creates a read-only . - /// - FileStream OpenRead(); - - /// - /// Creates a with UTF8 encoding that reads from an existing - /// text file. - /// - StreamReader OpenText(); - - /// - /// Creates a write-only . - /// - FileStream OpenWrite(); - - /// - /// Replaces the contents of a specified file with the file described by the current - /// object, deleting the original file, and creating a backup - /// of the replaced file. - /// - FileInfo Replace(string destinationFileName, string destinationBackupFileName); - - /// - /// Replaces the contents of a specified file with the file described by the current - /// object, deleting the original file, and creating a backup - /// of the replaced file. Also specifies whether to ignore merge errors. - /// - FileInfo Replace(string destinationFileName, string destinationBackupFileName, bool ignoreMetadataErrors); - - /// - /// Refreshes the state of the object. - /// - void Refresh(); - - /// - /// Sets the object with the file - /// name and additional exception information. - /// - void GetObjectData(SerializationInfo info, StreamingContext context); - - string ToString(); - - } -} - -/* - Author: numbworks@gmail.com - Last Update: 30.05.2021 -*/ \ No newline at end of file diff --git a/src/NW.UnivariateForecasting/Files/IFileManager.cs b/src/NW.UnivariateForecasting/Files/IFileManager.cs deleted file mode 100644 index 50a5b59..0000000 --- a/src/NW.UnivariateForecasting/Files/IFileManager.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System.Collections.Generic; -using System.IO; -using System; - -namespace NW.UnivariateForecasting.Files -{ - /// Collects all the helper methods related to files' management. - public interface IFileManager - { - - /// - /// Opens a text file, reads all lines of the file, and then closes the file. - /// - /// - IEnumerable ReadAllLines(IFileInfoAdapter file); - - /// - /// Opens a text file, reads all lines of the file, and then closes the file. - /// - /// - string ReadAllText(IFileInfoAdapter file); - - /// - /// Creates a new file, writes a collection of strings to the file, and then closes the file. - /// - /// - void WriteAllLines(IFileInfoAdapter file, IEnumerable content); - - /// - /// Creates a new file, writes the specified string to the file, and then closes - /// the file. If the target file already exists, it is overwritten. - /// - /// - void WriteAllText(IFileInfoAdapter file, string content); - - /// - /// Initializes a instance for . - /// - IFileInfoAdapter Create(string filePath); - - /// - /// Initializes a instance for . - /// - IFileInfoAdapter Create(FileInfo fileInfo); - - } -} - -/* - Author: numbworks@gmail.com - Last Update: 30.05.2021 -*/ \ No newline at end of file diff --git a/src/NW.UnivariateForecasting/Files/MessageCollection.cs b/src/NW.UnivariateForecasting/Files/MessageCollection.cs deleted file mode 100644 index 1ce6929..0000000 --- a/src/NW.UnivariateForecasting/Files/MessageCollection.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; - -namespace NW.UnivariateForecasting.Files -{ - ///Collects all the messages used for logging and exceptions for . - public static class MessageCollection - { - - #region Properties - - public static Func NotPossibleToRead - = (file, e) => $"It hasn't been possible to read from the provided file: '{file.FullName}': '{e.Message}'."; - public static Func NotPossibleToWrite - = (file, e) => $"It hasn't been possible to write to the provided file: '{file.FullName}': '{e.Message}'."; - - #endregion - - } -} - -/* - Author: numbworks@gmail.com - Last Update: 12.11.2022 -*/ \ No newline at end of file diff --git a/src/NW.UnivariateForecasting/Forecasts/ForecastingInit.cs b/src/NW.UnivariateForecasting/Forecasts/ForecastingInit.cs index 5df7a53..5ee2380 100644 --- a/src/NW.UnivariateForecasting/Forecasts/ForecastingInit.cs +++ b/src/NW.UnivariateForecasting/Forecasts/ForecastingInit.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using NW.UnivariateForecasting.Validation; +using NW.Shared.Validation; namespace NW.UnivariateForecasting.Forecasts { diff --git a/src/NW.UnivariateForecasting/Forecasts/ForecastingInitManager.cs b/src/NW.UnivariateForecasting/Forecasts/ForecastingInitManager.cs index 29cba7e..41a7416 100644 --- a/src/NW.UnivariateForecasting/Forecasts/ForecastingInitManager.cs +++ b/src/NW.UnivariateForecasting/Forecasts/ForecastingInitManager.cs @@ -1,5 +1,5 @@ using System.Collections.Generic; -using NW.UnivariateForecasting.Validation; +using NW.Shared.Validation; namespace NW.UnivariateForecasting.Forecasts { diff --git a/src/NW.UnivariateForecasting/Forecasts/ForecastingSession.cs b/src/NW.UnivariateForecasting/Forecasts/ForecastingSession.cs index 27a0d76..21ffb73 100644 --- a/src/NW.UnivariateForecasting/Forecasts/ForecastingSession.cs +++ b/src/NW.UnivariateForecasting/Forecasts/ForecastingSession.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using NW.UnivariateForecasting.Observations; -using NW.UnivariateForecasting.Validation; +using NW.Shared.Validation; namespace NW.UnivariateForecasting.Forecasts { diff --git a/src/NW.UnivariateForecasting/Forecasts/MessageCollection.cs b/src/NW.UnivariateForecasting/Forecasts/MessageCollection.cs index c1f905b..c3c6549 100644 --- a/src/NW.UnivariateForecasting/Forecasts/MessageCollection.cs +++ b/src/NW.UnivariateForecasting/Forecasts/MessageCollection.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Dynamic; using System.Linq; -using NW.UnivariateForecasting.Files; +using NW.Shared.Files; namespace NW.UnivariateForecasting.Forecasts { diff --git a/src/NW.UnivariateForecasting/IUnivariateForecaster.cs b/src/NW.UnivariateForecasting/IUnivariateForecaster.cs index d071f5b..fe644d6 100644 --- a/src/NW.UnivariateForecasting/IUnivariateForecaster.cs +++ b/src/NW.UnivariateForecasting/IUnivariateForecaster.cs @@ -1,5 +1,5 @@ using System; -using NW.UnivariateForecasting.Files; +using NW.Shared.Files; using NW.UnivariateForecasting.Forecasts; namespace NW.UnivariateForecasting diff --git a/src/NW.UnivariateForecasting/NW.UnivariateForecasting.csproj b/src/NW.UnivariateForecasting/NW.UnivariateForecasting.csproj index bfd9502..5d24865 100644 --- a/src/NW.UnivariateForecasting/NW.UnivariateForecasting.csproj +++ b/src/NW.UnivariateForecasting/NW.UnivariateForecasting.csproj @@ -13,14 +13,16 @@ https://raw.githubusercontent.com/numbworks/numbworks/master/numbworks_logo_128x128px.png - 4.0.0 - 4.0.0.0 - 4.0.0.0 + 4.1.0 + 4.1.0.0 + 4.1.0.0 + + \ No newline at end of file diff --git a/src/NW.UnivariateForecasting/Observations/ObservationManager.cs b/src/NW.UnivariateForecasting/Observations/ObservationManager.cs index 3fda2fe..a201665 100644 --- a/src/NW.UnivariateForecasting/Observations/ObservationManager.cs +++ b/src/NW.UnivariateForecasting/Observations/ObservationManager.cs @@ -3,7 +3,7 @@ using System.Linq; using NW.UnivariateForecasting.Bags; using NW.UnivariateForecasting.SlidingWindows; -using NW.UnivariateForecasting.Validation; +using NW.Shared.Validation; namespace NW.UnivariateForecasting.Observations { diff --git a/src/NW.UnivariateForecasting/Serializations/Serializer.cs b/src/NW.UnivariateForecasting/Serializations/Serializer.cs index 9623d6b..74e16c8 100644 --- a/src/NW.UnivariateForecasting/Serializations/Serializer.cs +++ b/src/NW.UnivariateForecasting/Serializations/Serializer.cs @@ -1,6 +1,7 @@ using System; using System.Text.Encodings.Web; using System.Text.Json; +using NW.Shared.Validation; namespace NW.UnivariateForecasting.Serializations { @@ -28,7 +29,7 @@ public Serializer() { } public string Serialize(T obj) { - Validation.Validator.ValidateObject(obj, nameof(obj)); + Validator.ValidateObject(obj, nameof(obj)); string json = JsonSerializer.Serialize(obj, CreateJsonSerializerOptions()); diff --git a/src/NW.UnivariateForecasting/SlidingWindows/SlidingWindow.cs b/src/NW.UnivariateForecasting/SlidingWindows/SlidingWindow.cs index 55f70df..7f25c27 100644 --- a/src/NW.UnivariateForecasting/SlidingWindows/SlidingWindow.cs +++ b/src/NW.UnivariateForecasting/SlidingWindows/SlidingWindow.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using NW.UnivariateForecasting.Validation; +using NW.Shared.Validation; namespace NW.UnivariateForecasting.SlidingWindows { diff --git a/src/NW.UnivariateForecasting/SlidingWindows/SlidingWindowItem.cs b/src/NW.UnivariateForecasting/SlidingWindows/SlidingWindowItem.cs index 3a37e85..52248a3 100644 --- a/src/NW.UnivariateForecasting/SlidingWindows/SlidingWindowItem.cs +++ b/src/NW.UnivariateForecasting/SlidingWindows/SlidingWindowItem.cs @@ -1,4 +1,4 @@ -using NW.UnivariateForecasting.Validation; +using NW.Shared.Validation; namespace NW.UnivariateForecasting.SlidingWindows { diff --git a/src/NW.UnivariateForecasting/SlidingWindows/SlidingWindowManager.cs b/src/NW.UnivariateForecasting/SlidingWindows/SlidingWindowManager.cs index 13d42da..32cc9b1 100644 --- a/src/NW.UnivariateForecasting/SlidingWindows/SlidingWindowManager.cs +++ b/src/NW.UnivariateForecasting/SlidingWindows/SlidingWindowManager.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Linq; using NW.UnivariateForecasting.Bags; -using NW.UnivariateForecasting.Validation; +using NW.Shared.Validation; namespace NW.UnivariateForecasting.SlidingWindows { diff --git a/src/NW.UnivariateForecasting/UnivariateForecaster.cs b/src/NW.UnivariateForecasting/UnivariateForecaster.cs index b0a3d6a..de43ae3 100644 --- a/src/NW.UnivariateForecasting/UnivariateForecaster.cs +++ b/src/NW.UnivariateForecasting/UnivariateForecaster.cs @@ -3,12 +3,13 @@ using System.Linq; using System.Reflection; using NW.UnivariateForecasting.Bags; -using NW.UnivariateForecasting.Files; +using NW.Shared.Files; using NW.UnivariateForecasting.Forecasts; using NW.UnivariateForecasting.Observations; using NW.UnivariateForecasting.Serializations; using NW.UnivariateForecasting.SlidingWindows; -using NW.UnivariateForecasting.Validation; +using NW.Shared.Validation; +using NW.Shared.Files.Validation; namespace NW.UnivariateForecasting { @@ -136,7 +137,7 @@ private T LoadOrDefault(IFileInfoAdapter jsonFile) { Validator.ValidateObject(jsonFile, nameof(jsonFile)); - Validator.ValidateFileExistance(jsonFile); + FilesValidator.ValidateFileExistance(jsonFile); _componentBag.LoggingAction(Forecasts.MessageCollection.AttemptingToLoadObjectFrom(typeof(T), jsonFile)); diff --git a/src/NW.UnivariateForecasting/Validation/MessageCollection.cs b/src/NW.UnivariateForecasting/Validation/MessageCollection.cs deleted file mode 100644 index c1850ce..0000000 --- a/src/NW.UnivariateForecasting/Validation/MessageCollection.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using NW.UnivariateForecasting.Files; - -namespace NW.UnivariateForecasting.Validation -{ - ///Collects all the messages used for logging and exceptions for . - public static class MessageCollection - { - - #region Validator - - public static Func FirstValueIsGreaterOrEqualThanSecondValue - = (variableName1, variableName2) => $"The '{variableName1}''s value is greater or equal than '{variableName2}''s value."; - public static Func FirstValueIsGreaterThanSecondValue - = (variableName1, variableName2) => $"The '{variableName1}''s value is greater than '{variableName2}''s value."; - public static Func VariableContainsZeroItems - = (variableName) => $"'{variableName}' contains zero items."; - - public static Func VariableCantBeLessThan - = (variableName, threshold) => $"'{variableName}' can't be less than '{threshold}'."; - public static Func VariableCantBeLessThanDouble - = (variableName, threshold) => $"'{variableName}' can't be less than '{threshold}'."; - - public static Func DividingMustReturnWholeNumber { get; } - = (variableName1, variableName2) => $"Dividing '{variableName1}' by '{variableName2}' must return a whole number."; - public static Func ProvidedPathDoesntExist - = (file) => $"The provided path doesn't exist: '{file.FullName}'."; - - #endregion - - } -} - -/* - Author: numbworks@gmail.com - Last Update: 08.03.2023 -*/ \ No newline at end of file diff --git a/src/NW.UnivariateForecasting/Validation/Validator.cs b/src/NW.UnivariateForecasting/Validation/Validator.cs deleted file mode 100644 index 3cb9eb6..0000000 --- a/src/NW.UnivariateForecasting/Validation/Validator.cs +++ /dev/null @@ -1,259 +0,0 @@ -using System; -using System.Collections.Generic; -using NW.UnivariateForecasting.Files; - -namespace NW.UnivariateForecasting.Validation -{ - /// Collects all the validation methods. - public static class Validator - { - - #region Methods_private - - private static TException CreateException(string message) where TException : Exception - => (TException)Activator.CreateInstance(typeof(TException), message); - - #endregion - - #region ThrowIfFirst - - /// Throws an exception of type TException when is greater or equal than . - public static void ThrowIfFirstIsGreaterOrEqual(int value1, string variableName1, int value2, string variableName2) where TException : Exception - { - - if (value1 >= value2) - throw CreateException(MessageCollection.FirstValueIsGreaterOrEqualThanSecondValue(variableName1, variableName2)); - - } - - /// Throws an exception of type when is greater or equal than . - public static void ThrowIfFirstIsGreaterOrEqual(int value1, string variableName1, int value2, string variableName2) - => ThrowIfFirstIsGreaterOrEqual(value1, variableName1, value2, variableName2); - - /// Throws an exception of type TException when is greater than . - public static void ThrowIfFirstIsGreater(int value1, string variableName1, int value2, string variableName2) where TException : Exception - { - - if (value1 > value2) - throw CreateException(MessageCollection.FirstValueIsGreaterThanSecondValue(variableName1, variableName2)); - - } - - /// Throws an exception of type when is greater than . - public static void ThrowIfFirstIsGreater(int value1, string variableName1, int value2, string variableName2) - => ThrowIfFirstIsGreater(value1, variableName1, value2, variableName2); - - #endregion - - #region ThrowIfLess - - /// Throws an exception of type TException when is less than one. - public static void ThrowIfLessThanOne(uint value, string variableName) where TException : Exception - { - - int threshold = 1; - if (value < threshold) - throw CreateException(MessageCollection.VariableCantBeLessThan(variableName, threshold)); - - } - - /// Throws an exception of type when is less than one. - public static void ThrowIfLessThanOne(uint value, string variableName) - => ThrowIfLessThanOne(value, variableName); - - /// Throws an exception of type TException when is less than . - public static void ThrowIfLessThan(int value, int threshold, string variableName) where TException : Exception - { - - if (value < threshold) - throw CreateException(MessageCollection.VariableCantBeLessThan(variableName, threshold)); - - } - - /// Throws an exception of type TException when is less than . - public static void ThrowIfLessThan(int value, int threshold, string variableName) - => ThrowIfLessThan(value, threshold, variableName); - - /// Throws an exception of type TException when is less than . - public static void ThrowIfLessThan(double value, double threshold, string variableName) where TException : Exception - { - - if (value < threshold) - throw CreateException(MessageCollection.VariableCantBeLessThanDouble(variableName, threshold)); - - } - - /// Throws an exception of type TException when is less than . - public static void ThrowIfLessThan(double value, double threshold, string variableName) - => ThrowIfLessThan(value, threshold, variableName); - - #endregion - - #region ThrowIfModulo - - /// Throws an exception of type TException when the modulo between and is not zero. - public static void ThrowIfModuloIsNotZero(uint value1, string variableName1, uint value2, string variableName2) where TException : Exception - { - - if (value1 % value2 != 0) - throw CreateException(MessageCollection.DividingMustReturnWholeNumber(variableName1, variableName2)); - - } - - /// Throws an exception of type when the modulo between and is not zero. - public static void ThrowIfModuloIsNotZero(uint value1, string variableName1, uint value2, string variableName2) - => ThrowIfModuloIsNotZero(value1, variableName1, value2, variableName2); - - #endregion - - #region ValidateArray - - /// Throws an exception of type when is null or of type when is empty. - public static void ValidateArray(UArray[] arr, string variableName) - { - - ValidateArrayNull(arr, variableName); - ValidateArrayEmpty(arr, variableName); - - } - - /// Throws an exception of type when is null. - public static void ValidateArrayNull(UArray[] arr, string variableName) where TException : Exception - { - - if (arr == null) - throw CreateException(variableName); - - } - - /// Throws an exception of type when is empty. - public static void ValidateArrayEmpty(UArray[] arr, string variableName) where TException : Exception - { - - if (arr.Length == 0) - throw CreateException(MessageCollection.VariableContainsZeroItems(variableName)); - - } - - #endregion - - #region ValidateFileExistance - - /// Throws an exception of type TException when doesn't exist. - public static void ValidateFileExistance(IFileInfoAdapter file) where TException : Exception - { - - if (!file.Exists) - throw CreateException(MessageCollection.ProvidedPathDoesntExist(file)); - - } - - /// Throws an exception of type when doesn't exist. - public static void ValidateFileExistance(IFileInfoAdapter file) - => ValidateFileExistance(file); - - #endregion - - #region ValidateLength - - /// Throws an exception of type TException when is less than one. - public static void ValidateLength(uint length) where TException : Exception - { - - int threshold = 1; - if (length < threshold) - throw CreateException(MessageCollection.VariableCantBeLessThan(nameof(length), threshold)); - - } - - /// Throws an exception of type when is less than one. - public static void ValidateLength(uint length) - => ValidateLength(length); - - #endregion - - #region ValidateList - - /// Throws an exception of type when is null or of type when is empty. - public static void ValidateList(List list, string variableName) - { - - ValidateListNull(list, variableName); - ValidateListEmpty(list, variableName); - - } - - /// Throws an exception of type when is null. - public static void ValidateListNull(List list, string variableName) where TException : Exception - { - - if (list == null) - throw CreateException(variableName); - - } - - /// Throws an exception of type when is empty. - public static void ValidateListEmpty(List list, string variableName) where T : Exception - { - - if (list.Count == 0) - throw CreateException(MessageCollection.VariableContainsZeroItems(variableName)); - - } - - #endregion - - #region ValidateObject - - /// Throws an exception of type TException when is null. - public static void ValidateObject(object obj, string variableName) where TException : Exception - { - - if (obj == null) - throw CreateException(variableName); - - } - - /// Throws an exception of type when is null. - public static void ValidateObject(object obj, string variableName) - => ValidateObject(obj, variableName); - - #endregion - - #region ValidateStringNullOrWhiteSpace - - /// Throws an exception of type TException when is null or whitespace. - public static void ValidateStringNullOrWhiteSpace(string str, string variableName) where TException : Exception - { - - if (string.IsNullOrWhiteSpace(str)) - throw CreateException(variableName); - - } - - /// Throws an exception of type when is null or whitespace. - public static void ValidateStringNullOrWhiteSpace(string str, string variableName) - => ValidateStringNullOrWhiteSpace(str, variableName); - - /// Throws an exception of type TException when is null or empty. - public static void ValidateStringNullOrEmpty(string str, string variableName) where TException : Exception - { - - if (string.IsNullOrEmpty(str)) - throw CreateException(variableName); - - } - - /// Throws an exception of type when is null or empty. - public static void ValidateStringNullOrEmpty(string str, string variableName) - => ValidateStringNullOrEmpty(str, variableName); - - #endregion - - } -} - -/* - Author: numbworks@gmail.com - Last Update: 08.03.2023 -*/ \ No newline at end of file diff --git a/src/NW.UnivariateForecastingClient/Application/ApplicationManager.cs b/src/NW.UnivariateForecastingClient/Application/ApplicationManager.cs index 161cf9b..30da28b 100644 --- a/src/NW.UnivariateForecastingClient/Application/ApplicationManager.cs +++ b/src/NW.UnivariateForecastingClient/Application/ApplicationManager.cs @@ -1,5 +1,5 @@ using System; -using NW.UnivariateForecasting.Validation; +using NW.Shared.Validation; using NW.UnivariateForecastingClient.Shared; using NW.UnivariateForecastingClient.ApplicationSession; using McMaster.Extensions.CommandLineUtils; diff --git a/src/NW.UnivariateForecastingClient/Application/ApplicationManagerBag.cs b/src/NW.UnivariateForecastingClient/Application/ApplicationManagerBag.cs index 4ecacb9..57b2f3b 100644 --- a/src/NW.UnivariateForecastingClient/Application/ApplicationManagerBag.cs +++ b/src/NW.UnivariateForecastingClient/Application/ApplicationManagerBag.cs @@ -1,7 +1,7 @@ using System; using NW.UnivariateForecastingClient.ApplicationAbout; using NW.UnivariateForecastingClient.ApplicationSession; -using NW.UnivariateForecasting.Validation; +using NW.Shared.Validation; namespace NW.UnivariateForecastingClient.Application { diff --git a/src/NW.UnivariateForecastingClient/Application/ApplicationManagerBagFactory.cs b/src/NW.UnivariateForecastingClient/Application/ApplicationManagerBagFactory.cs index 2d3bbf9..6213f27 100644 --- a/src/NW.UnivariateForecastingClient/Application/ApplicationManagerBagFactory.cs +++ b/src/NW.UnivariateForecastingClient/Application/ApplicationManagerBagFactory.cs @@ -1,5 +1,5 @@ using System; -using NW.UnivariateForecasting.Validation; +using NW.Shared.Validation; using NW.UnivariateForecastingClient.ApplicationAbout; using NW.UnivariateForecastingClient.ApplicationSession; using NW.UnivariateForecastingClient.Shared; diff --git a/src/NW.UnivariateForecastingClient/ApplicationAbout/AboutManager.cs b/src/NW.UnivariateForecastingClient/ApplicationAbout/AboutManager.cs index 448e9f8..d30b396 100644 --- a/src/NW.UnivariateForecastingClient/ApplicationAbout/AboutManager.cs +++ b/src/NW.UnivariateForecastingClient/ApplicationAbout/AboutManager.cs @@ -1,5 +1,5 @@ using System; -using NW.UnivariateForecasting.Validation; +using NW.Shared.Validation; using NW.UnivariateForecastingClient.Shared; using McMaster.Extensions.CommandLineUtils; diff --git a/src/NW.UnivariateForecastingClient/ApplicationSession/SessionManager.cs b/src/NW.UnivariateForecastingClient/ApplicationSession/SessionManager.cs index 7d7a64d..582fcfc 100644 --- a/src/NW.UnivariateForecastingClient/ApplicationSession/SessionManager.cs +++ b/src/NW.UnivariateForecastingClient/ApplicationSession/SessionManager.cs @@ -1,5 +1,5 @@ using System; -using NW.UnivariateForecasting.Validation; +using NW.Shared.Validation; using NW.UnivariateForecastingClient.Shared; using McMaster.Extensions.CommandLineUtils; diff --git a/src/NW.UnivariateForecastingClient/NW.UnivariateForecastingClient.csproj b/src/NW.UnivariateForecastingClient/NW.UnivariateForecastingClient.csproj index 24480b7..b26b52f 100644 --- a/src/NW.UnivariateForecastingClient/NW.UnivariateForecastingClient.csproj +++ b/src/NW.UnivariateForecastingClient/NW.UnivariateForecastingClient.csproj @@ -13,12 +13,12 @@ false true MIT - 4.0.0 unifor numbworks_logo_128x128px.ico numbworks_logo_128x128px.png - 4.0.0.0 - 4.0.0.0 + 4.1.0 + 4.1.0.0 + 4.1.0.0 diff --git a/src/NW.UnivariateForecastingClient/Shared/LibraryBroker.cs b/src/NW.UnivariateForecastingClient/Shared/LibraryBroker.cs index 05f1f97..51f3141 100644 --- a/src/NW.UnivariateForecastingClient/Shared/LibraryBroker.cs +++ b/src/NW.UnivariateForecastingClient/Shared/LibraryBroker.cs @@ -2,9 +2,9 @@ using System.IO; using NW.UnivariateForecasting; using NW.UnivariateForecasting.Bags; -using NW.UnivariateForecasting.Files; +using NW.Shared.Files; using NW.UnivariateForecasting.Forecasts; -using NW.UnivariateForecasting.Validation; +using NW.Shared.Validation; namespace NW.UnivariateForecastingClient.Shared { diff --git a/tests/NW.UnivariateForecasting.UnitTests/Bags/ComponentBagTests.cs b/tests/NW.UnivariateForecasting.UnitTests/Bags/ComponentBagTests.cs index 8d8d9d2..46bf0e3 100644 --- a/tests/NW.UnivariateForecasting.UnitTests/Bags/ComponentBagTests.cs +++ b/tests/NW.UnivariateForecasting.UnitTests/Bags/ComponentBagTests.cs @@ -2,7 +2,7 @@ using NW.UnivariateForecasting.AsciiBanner; using NW.UnivariateForecasting.Bags; using NW.UnivariateForecasting.Filenames; -using NW.UnivariateForecasting.Files; +using NW.Shared.Files; using NW.UnivariateForecasting.Forecasts; using NW.UnivariateForecasting.Observations; using NW.UnivariateForecasting.Serializations; diff --git a/tests/NW.UnivariateForecasting.UnitTests/Bags/SettingBagTests.cs b/tests/NW.UnivariateForecasting.UnitTests/Bags/SettingBagTests.cs index 0f6d074..964375d 100644 --- a/tests/NW.UnivariateForecasting.UnitTests/Bags/SettingBagTests.cs +++ b/tests/NW.UnivariateForecasting.UnitTests/Bags/SettingBagTests.cs @@ -1,6 +1,7 @@ using System; -using NUnit.Framework; using NW.UnivariateForecasting.Bags; +using NW.Shared.Validation; +using NUnit.Framework; namespace NW.UnivariateForecasting.UnitTests.Bags { @@ -22,7 +23,7 @@ public class SettingBagTests ) ), typeof(ArgumentException), - UnivariateForecasting.Validation.MessageCollection.VariableCantBeLessThanDouble( + Shared.Validation.MessageCollection.VariableCantBeLessThanDouble( "forecastingDenominator", SettingBag.DefaultForecastingDenominator) ).SetArgDisplayNames($"{nameof(settingBagExceptionTestCases)}_01"), @@ -46,7 +47,7 @@ public class SettingBagTests roundingDigits: 16 )), typeof(ArgumentException), - UnivariateForecasting.Validation.MessageCollection.FirstValueIsGreaterThanSecondValue("roundingDigits", "DefaultRoundingDigits") + Shared.Validation.MessageCollection.FirstValueIsGreaterThanSecondValue("roundingDigits", "DefaultRoundingDigits") ).SetArgDisplayNames($"{nameof(settingBagExceptionTestCases)}_03") }; diff --git a/tests/NW.UnivariateForecasting.UnitTests/Files/FileManagerTests.cs b/tests/NW.UnivariateForecasting.UnitTests/Files/FileManagerTests.cs deleted file mode 100644 index c313adf..0000000 --- a/tests/NW.UnivariateForecasting.UnitTests/Files/FileManagerTests.cs +++ /dev/null @@ -1,293 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using NW.UnivariateForecasting.Files; -using NUnit.Framework; - -namespace NW.UnivariateForecasting.UnitTests.Files -{ - - [TestFixture] - public class FileManagerTests - { - - #region Fields - - private static TestCaseData[] fileManagerExceptionTestCases = - { - - new TestCaseData( - new TestDelegate( () => new FileManager(null) ), - typeof(ArgumentNullException), - new ArgumentNullException("fileAdapter").Message - ).SetArgDisplayNames($"{nameof(fileManagerExceptionTestCases)}_01"), - - }; - private static TestCaseData[] readAllLinesExceptionTestCases = - { - - new TestCaseData( - new TestDelegate( - () => new FileManager().ReadAllLines(null) - ), - typeof(ArgumentNullException), - new ArgumentNullException("file").Message - ).SetArgDisplayNames($"{nameof(readAllLinesExceptionTestCases)}_01"), - - new TestCaseData( - new TestDelegate( - () => new FileManager().ReadAllLines(ObjectMother.FileInfoAdapterDoesntExist) - ), - typeof(ArgumentException), - UnivariateForecasting.Validation.MessageCollection.ProvidedPathDoesntExist(ObjectMother.FileInfoAdapterDoesntExist) - ).SetArgDisplayNames($"{nameof(readAllLinesExceptionTestCases)}_02"), - - new TestCaseData( - new TestDelegate( - () => new FileManager(ObjectMother.FileAdapterReadAllMethodsThrowIOException) - .ReadAllLines(ObjectMother.FileInfoAdapterExists) - ), - typeof(Exception), - MessageCollection.NotPossibleToRead( - ObjectMother.FileInfoAdapterExists, - ObjectMother.FileAdapterIOException) - ).SetArgDisplayNames($"{nameof(readAllLinesExceptionTestCases)}_03") - - }; - private static TestCaseData[] readAllTextExceptionTestCases = - { - - new TestCaseData( - new TestDelegate( - () => new FileManager().ReadAllText(null) - ), - typeof(ArgumentNullException), - new ArgumentNullException("file").Message - ).SetArgDisplayNames($"{nameof(readAllTextExceptionTestCases)}_01"), - - new TestCaseData( - new TestDelegate( - () => new FileManager().ReadAllText(ObjectMother.FileInfoAdapterDoesntExist) - ), - typeof(ArgumentException), - UnivariateForecasting.Validation.MessageCollection.ProvidedPathDoesntExist(ObjectMother.FileInfoAdapterDoesntExist) - ).SetArgDisplayNames($"{nameof(readAllTextExceptionTestCases)}_02"), - - new TestCaseData( - new TestDelegate( - () => new FileManager(ObjectMother.FileAdapterReadAllMethodsThrowIOException) - .ReadAllText(ObjectMother.FileInfoAdapterExists) - ), - typeof(Exception), - MessageCollection.NotPossibleToRead( - ObjectMother.FileInfoAdapterExists, - ObjectMother.FileAdapterIOException) - ).SetArgDisplayNames($"{nameof(readAllTextExceptionTestCases)}_03") - - }; - private static TestCaseData[] writeAllLinesExceptionTestCases = - { - - new TestCaseData( - new TestDelegate( - () => new FileManager().WriteAllLines(null, ObjectMother.ContentMultipleLines) - ), - typeof(ArgumentNullException), - new ArgumentNullException("file").Message - ).SetArgDisplayNames($"{nameof(writeAllLinesExceptionTestCases)}_01"), - - new TestCaseData( - new TestDelegate( - () => new FileManager(ObjectMother.FileAdapterWriteAllMethodsThrowIOException) - .WriteAllLines( - ObjectMother.FileInfoAdapterExists, - ObjectMother.ContentMultipleLines) - ), - typeof(Exception), - MessageCollection.NotPossibleToWrite( - ObjectMother.FileInfoAdapterExists, - ObjectMother.FileAdapterIOException) - ).SetArgDisplayNames($"{nameof(writeAllLinesExceptionTestCases)}_02") - - }; - private static TestCaseData[] writeAllTextExceptionTestCases = - { - - new TestCaseData( - new TestDelegate( - () => new FileManager().WriteAllText(null, ObjectMother.ContentSingleLine) - ), - typeof(ArgumentNullException), - new ArgumentNullException("file").Message - ).SetArgDisplayNames($"{nameof(writeAllTextExceptionTestCases)}_01"), - - new TestCaseData( - new TestDelegate( - () => new FileManager(ObjectMother.FileAdapterWriteAllMethodsThrowIOException) - .WriteAllText( - ObjectMother.FileInfoAdapterExists, - ObjectMother.ContentSingleLine) - ), - typeof(Exception), - MessageCollection.NotPossibleToWrite( - ObjectMother.FileInfoAdapterExists, - ObjectMother.FileAdapterIOException) - ).SetArgDisplayNames($"{nameof(writeAllTextExceptionTestCases)}_02") - - }; - private static TestCaseData[] createExceptionTestCases = - { - - new TestCaseData( - new TestDelegate( - () => new FileManager().Create((string)null) - ), - typeof(ArgumentNullException), - new ArgumentNullException("filePath").Message - ).SetArgDisplayNames($"{nameof(createExceptionTestCases)}_01"), - - new TestCaseData( - new TestDelegate( - () => new FileManager().Create((FileInfo)null) - ), - typeof(ArgumentNullException), - new ArgumentNullException("fileInfo").Message - ).SetArgDisplayNames($"{nameof(createExceptionTestCases)}_02") - - }; - - #endregion - - #region SetUp - #endregion - - #region Tests - - [TestCaseSource(nameof(fileManagerExceptionTestCases))] - public void FileManager_ShouldThrowACertainException_WhenUnproperArguments - (TestDelegate del, Type expectedType, string expectedMessage) - => Utilities.ObjectMother.Method_ShouldThrowACertainException_WhenUnproperArguments(del, expectedType, expectedMessage); - - [TestCaseSource(nameof(readAllLinesExceptionTestCases))] - public void ReadAllLines_ShouldThrowACertainException_WhenUnproperArguments - (TestDelegate del, Type expectedType, string expectedMessage) - => Utilities.ObjectMother.Method_ShouldThrowACertainException_WhenUnproperArguments(del, expectedType, expectedMessage); - [Test] - public void ReadAllLines_ShouldReturnStrings_WhenFileExists() - { - - // Arrange - // Act - IEnumerable actual - = new FileManager(ObjectMother.FileAdapterAllMethodsWork) - .ReadAllLines(ObjectMother.FileInfoAdapterExists); - - // Assert - Assert.That(ObjectMother.ContentMultipleLines, Is.EqualTo(actual)); - - } - - [TestCaseSource(nameof(readAllTextExceptionTestCases))] - public void ReadAllText_ShouldThrowACertainException_WhenUnproperArguments - (TestDelegate del, Type expectedType, string expectedMessage) - => Utilities.ObjectMother.Method_ShouldThrowACertainException_WhenUnproperArguments(del, expectedType, expectedMessage); - [Test] - public void ReadAllText_ShouldReturnString_WhenFileExists() - { - - // Arrange - // Act - string actual - = new FileManager(ObjectMother.FileAdapterAllMethodsWork) - .ReadAllText(ObjectMother.FileInfoAdapterExists); - - // Assert - Assert.That(ObjectMother.ContentSingleLine, Is.EqualTo(actual)); - - } - - [TestCaseSource(nameof(writeAllLinesExceptionTestCases))] - public void WriteAllLines_ShouldThrowACertainException_WhenUnproperArguments - (TestDelegate del, Type expectedType, string expectedMessage) - => Utilities.ObjectMother.Method_ShouldThrowACertainException_WhenUnproperArguments(del, expectedType, expectedMessage); - [Test] - public void WriteAllLines_ShouldSuccessfullyWriteToFile_WhenNoIOIssuesArise() - { - - // Arrange - // Act - // Assert - try - { - - new FileManager(ObjectMother.FileAdapterAllMethodsWork) - .WriteAllLines(ObjectMother.FileInfoAdapterExists, ObjectMother.ContentMultipleLines); - Assert.That(true, Is.True); - - } - catch - { - - Assert.That(false, Is.False); - - } - - } - - [TestCaseSource(nameof(writeAllTextExceptionTestCases))] - public void WriteAllText_ShouldThrowACertainException_WhenUnproperArguments - (TestDelegate del, Type expectedType, string expectedMessage) - => Utilities.ObjectMother.Method_ShouldThrowACertainException_WhenUnproperArguments(del, expectedType, expectedMessage); - [Test] - public void WriteAllText_ShouldSuccessfullyWriteToFile_WhenNoIOIssuesArise() - { - - // Arrange - // Act - // Assert - try - { - - new FileManager(ObjectMother.FileAdapterAllMethodsWork) - .WriteAllText(ObjectMother.FileInfoAdapterExists, ObjectMother.ContentSingleLine); - Assert.That(true, Is.True); - - } - catch - { - - Assert.That(false, Is.False); - - } - - } - - [TestCaseSource(nameof(createExceptionTestCases))] - public void Create_ShouldThrowACertainException_WhenUnproperArguments - (TestDelegate del, Type expectedType, string expectedMessage) - => Utilities.ObjectMother.Method_ShouldThrowACertainException_WhenUnproperArguments(del, expectedType, expectedMessage); - [Test] - public void Create_ShouldRetunAIFileInfoAdapterObject_WhenInvoked() - { - - // Arrange - // Act - IFileInfoAdapter actual = new FileManager().Create(@"J:\"); - - // Assert - Assert.That(actual, Is.InstanceOf()); - - } - - #endregion - - #region TearDown - #endregion - - } - -} -/* - Author: numbworks@gmail.com - Last Update: 09.02.2024 -*/ diff --git a/tests/NW.UnivariateForecasting.UnitTests/Files/ObjectMother.cs b/tests/NW.UnivariateForecasting.UnitTests/Files/ObjectMother.cs deleted file mode 100644 index 71dd7ee..0000000 --- a/tests/NW.UnivariateForecasting.UnitTests/Files/ObjectMother.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System.Collections.Generic; -using System.IO; -using System.Linq; -using NW.UnivariateForecasting.Files; -using NW.UnivariateForecasting.UnitTests.Utilities; - -namespace NW.UnivariateForecasting.UnitTests.Files -{ - public static class ObjectMother - { - - #region Properties - - public static string ContentSingleLine = "First line"; - public static IEnumerable ContentMultipleLines = - new List() { - "First line", - "Second line" - }; - public static string FileInfoAdapterFullName = @"C:\somefile.txt"; - public static IFileInfoAdapter FileInfoAdapterDoesntExist - => new FakeFileInfoAdapter(false, FileInfoAdapterFullName); - public static IFileInfoAdapter FileInfoAdapterExists - => new FakeFileInfoAdapter(true, FileInfoAdapterFullName); - public static IOException FileAdapterIOException = new IOException("Impossible to access the file."); - public static IFileAdapter FileAdapterReadAllMethodsThrowIOException - => new FakeFileAdapter( - fakeReadAllLines: () => throw FileAdapterIOException, - fakeReadAllText: () => throw FileAdapterIOException - ); - public static IFileAdapter FileAdapterWriteAllMethodsThrowIOException - => new FakeFileAdapter( - fakeWriteAllLines: () => throw FileAdapterIOException, - fakeWriteAllText: () => throw FileAdapterIOException - ); - public static IFileAdapter FileAdapterAllMethodsWork - => new FakeFileAdapter( - fakeReadAllLines: () => ContentMultipleLines.ToArray(), - fakeReadAllText: () => ContentSingleLine, - fakeWriteAllLines: () => { }, - fakeWriteAllText: () => { } - ); - - #endregion - - } -} - -/* - Author: numbworks@gmail.com - Last Update: 14.11.2022 -*/ \ No newline at end of file diff --git a/tests/NW.UnivariateForecasting.UnitTests/Forecasts/ObjectMother.cs b/tests/NW.UnivariateForecasting.UnitTests/Forecasts/ObjectMother.cs index 765f8d0..bc66a22 100644 --- a/tests/NW.UnivariateForecasting.UnitTests/Forecasts/ObjectMother.cs +++ b/tests/NW.UnivariateForecasting.UnitTests/Forecasts/ObjectMother.cs @@ -57,7 +57,7 @@ public static ForecastingInit ForecastingInit_DoubleWithCE steps: ForecastingInit_Steps_MultipleDouble ); - public static string ForecastingSession_Version = "4.0.0.0"; + public static string ForecastingSession_Version = "4.1.0.0"; public static double NextValue = 519.23; public static List ExpandedValues = new List() { 58.5, 615.26, 659.84, 635.69, 612.27, 632.94, NextValue }; diff --git a/tests/NW.UnivariateForecasting.UnitTests/NW.UnivariateForecasting.UnitTests.csproj b/tests/NW.UnivariateForecasting.UnitTests/NW.UnivariateForecasting.UnitTests.csproj index ca33a8f..c8bf2e9 100644 --- a/tests/NW.UnivariateForecasting.UnitTests/NW.UnivariateForecasting.UnitTests.csproj +++ b/tests/NW.UnivariateForecasting.UnitTests/NW.UnivariateForecasting.UnitTests.csproj @@ -8,12 +8,14 @@ https://github.com/numbworks/NW.UnivariateForecasting https://raw.githubusercontent.com/numbworks/numbworks/master/numbworks_logo_128x128px.png machinelearning csharp library univariate timeseriesanalysis netstandard forecasting - 4.0.0 + 4.1.0 + + diff --git a/tests/NW.UnivariateForecasting.UnitTests/Observations/ObservationManagerTests.cs b/tests/NW.UnivariateForecasting.UnitTests/Observations/ObservationManagerTests.cs index 95ca9e5..be12706 100644 --- a/tests/NW.UnivariateForecasting.UnitTests/Observations/ObservationManagerTests.cs +++ b/tests/NW.UnivariateForecasting.UnitTests/Observations/ObservationManagerTests.cs @@ -1,10 +1,11 @@ using System; using System.Collections.Generic; +using NW.UnivariateForecasting.Bags; using NW.UnivariateForecasting.Observations; using NW.UnivariateForecasting.SlidingWindows; using NW.UnivariateForecasting.UnitTests.Utilities; +using NW.Shared.Validation; using NUnit.Framework; -using NW.UnivariateForecasting.Bags; namespace NW.UnivariateForecasting.UnitTests.Observations { @@ -60,7 +61,7 @@ public class ObservationManagerTests roundingDigits: SettingBag.DefaultRoundingDigits )), typeof(ArgumentException), - UnivariateForecasting.Validation.MessageCollection.VariableCantBeLessThanDouble( + Shared.Validation.MessageCollection.VariableCantBeLessThanDouble( "forecastingDenominator", SettingBag.DefaultForecastingDenominator) ).SetArgDisplayNames($"{nameof(createExceptionTestCases)}_02"), @@ -73,7 +74,7 @@ public class ObservationManagerTests roundingDigits: 16 )), typeof(ArgumentException), - UnivariateForecasting.Validation.MessageCollection.FirstValueIsGreaterThanSecondValue("roundingDigits", "DefaultRoundingDigits") + Shared.Validation.MessageCollection.FirstValueIsGreaterThanSecondValue("roundingDigits", "DefaultRoundingDigits") ).SetArgDisplayNames($"{nameof(createExceptionTestCases)}_03") }; diff --git a/tests/NW.UnivariateForecasting.UnitTests/Resources/ForecastingSessionDoubleWithCEAsJson.txt b/tests/NW.UnivariateForecasting.UnitTests/Resources/ForecastingSessionDoubleWithCEAsJson.txt index 34d74f7..727ff0c 100644 --- a/tests/NW.UnivariateForecasting.UnitTests/Resources/ForecastingSessionDoubleWithCEAsJson.txt +++ b/tests/NW.UnivariateForecasting.UnitTests/Resources/ForecastingSessionDoubleWithCEAsJson.txt @@ -25,5 +25,5 @@ "NextValue": 158.25 } ], - "Version": "4.0.0.0" + "Version": "4.1.0.0" } \ No newline at end of file diff --git a/tests/NW.UnivariateForecasting.UnitTests/Resources/ForecastingSessionSingleWithCEAsJson.txt b/tests/NW.UnivariateForecasting.UnitTests/Resources/ForecastingSessionSingleWithCEAsJson.txt index 5fcd4cc..056317f 100644 --- a/tests/NW.UnivariateForecasting.UnitTests/Resources/ForecastingSessionSingleWithCEAsJson.txt +++ b/tests/NW.UnivariateForecasting.UnitTests/Resources/ForecastingSessionSingleWithCEAsJson.txt @@ -20,5 +20,5 @@ "NextValue": 316.48 } ], - "Version": "4.0.0.0" + "Version": "4.1.0.0" } \ No newline at end of file diff --git a/tests/NW.UnivariateForecasting.UnitTests/Resources/ForecastingSessionSingleWithoutCEAsJson.txt b/tests/NW.UnivariateForecasting.UnitTests/Resources/ForecastingSessionSingleWithoutCEAsJson.txt index 6d94608..09e63cb 100644 --- a/tests/NW.UnivariateForecasting.UnitTests/Resources/ForecastingSessionSingleWithoutCEAsJson.txt +++ b/tests/NW.UnivariateForecasting.UnitTests/Resources/ForecastingSessionSingleWithoutCEAsJson.txt @@ -20,5 +20,5 @@ "NextValue": 519.23 } ], - "Version": "4.0.0.0" + "Version": "4.1.0.0" } \ No newline at end of file diff --git a/tests/NW.UnivariateForecasting.UnitTests/SlidingWindows/SlidingWindowItemTests.cs b/tests/NW.UnivariateForecasting.UnitTests/SlidingWindows/SlidingWindowItemTests.cs index e0f1c8d..0f0e05c 100644 --- a/tests/NW.UnivariateForecasting.UnitTests/SlidingWindows/SlidingWindowItemTests.cs +++ b/tests/NW.UnivariateForecasting.UnitTests/SlidingWindows/SlidingWindowItemTests.cs @@ -1,5 +1,6 @@ using System; using NW.UnivariateForecasting.SlidingWindows; +using NW.Shared.Validation; using NUnit.Framework; namespace NW.UnivariateForecasting.UnitTests.SlidingWindows @@ -17,7 +18,7 @@ public class SlidingWindowItemTests new TestDelegate( () => new SlidingWindowItem(id: 0, X_Actual: 58.50, Y_Forecasted: 615.26)), typeof(ArgumentException), - UnivariateForecasting.Validation.MessageCollection.VariableCantBeLessThan("id", 1) + Shared.Validation.MessageCollection.VariableCantBeLessThan("id", 1) ).SetArgDisplayNames($"{nameof(slidingWindowItemExceptionTestCases)}_01") }; diff --git a/tests/NW.UnivariateForecasting.UnitTests/SlidingWindows/SlidingWindowManagerTests.cs b/tests/NW.UnivariateForecasting.UnitTests/SlidingWindows/SlidingWindowManagerTests.cs index 4c339a2..720d0cd 100644 --- a/tests/NW.UnivariateForecasting.UnitTests/SlidingWindows/SlidingWindowManagerTests.cs +++ b/tests/NW.UnivariateForecasting.UnitTests/SlidingWindows/SlidingWindowManagerTests.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using NW.UnivariateForecasting.SlidingWindows; using NW.UnivariateForecasting.UnitTests.Utilities; +using NW.Shared.Validation; using NUnit.Framework; namespace NW.UnivariateForecasting.UnitTests.SlidingWindows @@ -56,7 +57,7 @@ public class SlidingWindowManagerTests roundingDigits: 16 )), typeof(ArgumentException), - UnivariateForecasting.Validation.MessageCollection.FirstValueIsGreaterThanSecondValue("roundingDigits", "DefaultRoundingDigits") + Shared.Validation.MessageCollection.FirstValueIsGreaterThanSecondValue("roundingDigits", "DefaultRoundingDigits") ).SetArgDisplayNames($"{nameof(createExceptionTestCases)}_02") }; @@ -68,9 +69,9 @@ public class SlidingWindowManagerTests ObjectMother.SlidingWindow01_RoundingDigits, ObjectMother.SlidingWindow01, new List() { - MessageCollection.CreatingSlidingWindowOutOfFollowingArguments, - MessageCollection.ProvidedValuesAre(ObjectMother.SlidingWindow01_Values), - MessageCollection.FollowingSlidingWindowHasBeenCreated(ObjectMother.SlidingWindow01) + UnivariateForecasting.SlidingWindows.MessageCollection.CreatingSlidingWindowOutOfFollowingArguments, + UnivariateForecasting.SlidingWindows.MessageCollection.ProvidedValuesAre(ObjectMother.SlidingWindow01_Values), + UnivariateForecasting.SlidingWindows.MessageCollection.FollowingSlidingWindowHasBeenCreated(ObjectMother.SlidingWindow01) } ).SetArgDisplayNames($"{nameof(createTestCases)}_01") diff --git a/tests/NW.UnivariateForecasting.UnitTests/UnivariateForecasterTests.cs b/tests/NW.UnivariateForecasting.UnitTests/UnivariateForecasterTests.cs index 34bd4c0..41fefe8 100644 --- a/tests/NW.UnivariateForecasting.UnitTests/UnivariateForecasterTests.cs +++ b/tests/NW.UnivariateForecasting.UnitTests/UnivariateForecasterTests.cs @@ -3,15 +3,15 @@ using System.IO; using System.Reflection; using NW.UnivariateForecasting.AsciiBanner; -using NW.UnivariateForecasting.Files; +using NW.UnivariateForecasting.Bags; using NW.UnivariateForecasting.Filenames; using NW.UnivariateForecasting.Forecasts; using NW.UnivariateForecasting.Observations; using NW.UnivariateForecasting.Serializations; using NW.UnivariateForecasting.SlidingWindows; using NW.UnivariateForecasting.UnitTests.Utilities; +using NW.Shared.Files; using NUnit.Framework; -using NW.UnivariateForecasting.Bags; namespace NW.UnivariateForecasting.UnitTests { @@ -81,10 +81,10 @@ public class UnivariateForecasterTests new TestCaseData( new TestDelegate( - () => new UnivariateForecaster().LoadInitOrDefault(jsonFile: Files.ObjectMother.FileInfoAdapterDoesntExist) + () => new UnivariateForecaster().LoadInitOrDefault(jsonFile: ObjectMother.FileInfoAdapterDoesntExist) ), typeof(ArgumentException), - UnivariateForecasting.Validation.MessageCollection.ProvidedPathDoesntExist(Files.ObjectMother.FileInfoAdapterDoesntExist) + Shared.Files.Validation.MessageCollection.ProvidedPathDoesntExist(ObjectMother.FileInfoAdapterDoesntExist) ).SetArgDisplayNames($"{nameof(loadInitOrDefaultExceptionTestCases)}_02") }; diff --git a/tests/NW.UnivariateForecasting.UnitTests/Utilities/FakeFileAdapter.cs b/tests/NW.UnivariateForecasting.UnitTests/Utilities/FakeFileAdapter.cs deleted file mode 100644 index 9a3d4e9..0000000 --- a/tests/NW.UnivariateForecasting.UnitTests/Utilities/FakeFileAdapter.cs +++ /dev/null @@ -1,108 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using NW.UnivariateForecasting.Files; - -namespace NW.UnivariateForecasting.UnitTests.Utilities -{ - public class FakeFileAdapter : IFileAdapter - { - - #region Fields - - private Func _fakeReadAllLines; - private Func _fakeReadAllText; - private Action _fakeWriteAllLines; - private Action _fakeWriteAllText; - - #endregion - - #region Properties - #endregion - - #region Constructors - - public FakeFileAdapter( - Func fakeReadAllLines = null, - Func fakeReadAllText = null, - Action fakeWriteAllLines = null, - Action fakeWriteAllText = null - ) - { - - _fakeReadAllLines = fakeReadAllLines; - _fakeReadAllText = fakeReadAllText; - _fakeWriteAllLines = fakeWriteAllLines; - _fakeWriteAllText = fakeWriteAllText; - - } - - #endregion - - #region Methods_public - - public string[] ReadAllLines(string path) - { - - if (_fakeReadAllLines == null) - throw new NotImplementedException(); - - return _fakeReadAllLines.Invoke(); - - } - public string ReadAllText(string path) - { - - if (_fakeReadAllText == null) - throw new NotImplementedException(); - - return _fakeReadAllText.Invoke(); - - } - public void WriteAllLines(string path, IEnumerable contents) - { - - if (_fakeWriteAllLines == null) - throw new NotImplementedException(); - - _fakeWriteAllLines.Invoke(); - - } - public void WriteAllText(string path, string contents) - { - - if (_fakeWriteAllText == null) - throw new NotImplementedException(); - - _fakeWriteAllText.Invoke(); - - } - - public void AppendAllLines(string path, IEnumerable contents) - => throw new NotImplementedException(); - public void AppendAllLines(string path, IEnumerable contents, Encoding encoding) - => throw new NotImplementedException(); - public void AppendAllText(string path, string contents) - => throw new NotImplementedException(); - public void AppendAllText(string path, string contents, Encoding encoding) - => throw new NotImplementedException(); - public string[] ReadAllLines(string path, Encoding encoding) - => throw new NotImplementedException(); - public string ReadAllText(string path, Encoding encoding) - => throw new NotImplementedException(); - public void WriteAllLines(string path, IEnumerable contents, Encoding encoding) - => throw new NotImplementedException(); - public void WriteAllText(string path, string contents, Encoding encoding) - => throw new NotImplementedException(); - - #endregion - - } -} - -/* - - Author: numbworks@gmail.com - Last Update: 14.11.2022 - -*/ \ No newline at end of file diff --git a/tests/NW.UnivariateForecasting.UnitTests/Utilities/FakeFileAdapterWithInternalMemory.cs b/tests/NW.UnivariateForecasting.UnitTests/Utilities/FakeFileAdapterWithInternalMemory.cs deleted file mode 100644 index c799882..0000000 --- a/tests/NW.UnivariateForecasting.UnitTests/Utilities/FakeFileAdapterWithInternalMemory.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Linq; -using NW.UnivariateForecasting.Files; - -namespace NW.UnivariateForecasting.UnitTests.Utilities -{ - public class FakeFileAdapterWithInternalMemory : IFileAdapter - { - - #region Fields - - private string[] _AllLines; - private string _AllText; - - #endregion - - #region Properties - #endregion - - #region Constructors - - public FakeFileAdapterWithInternalMemory() { } - - #endregion - - #region Methods_public - - public string[] ReadAllLines(string path) - => _AllLines; - public string ReadAllText(string path) - => _AllText; - public void WriteAllLines(string path, IEnumerable contents) - => _AllLines = contents.ToArray(); - public void WriteAllText(string path, string contents) - => _AllText = contents; - - public void AppendAllLines(string path, IEnumerable contents) - => throw new NotImplementedException(); - public void AppendAllLines(string path, IEnumerable contents, Encoding encoding) - => throw new NotImplementedException(); - public void AppendAllText(string path, string contents) - => throw new NotImplementedException(); - public void AppendAllText(string path, string contents, Encoding encoding) - => throw new NotImplementedException(); - public string[] ReadAllLines(string path, Encoding encoding) - => throw new NotImplementedException(); - public string ReadAllText(string path, Encoding encoding) - => throw new NotImplementedException(); - public void WriteAllLines(string path, IEnumerable contents, Encoding encoding) - => throw new NotImplementedException(); - public void WriteAllText(string path, string contents, Encoding encoding) - => throw new NotImplementedException(); - - #endregion - - } -} - -/* - Author: numbworks@gmail.com - Last Update: 14.11.2022 -*/ \ No newline at end of file diff --git a/tests/NW.UnivariateForecasting.UnitTests/Utilities/FakeFileInfoAdapter.cs b/tests/NW.UnivariateForecasting.UnitTests/Utilities/FakeFileInfoAdapter.cs index 9c1f9a2..2e99cfd 100644 --- a/tests/NW.UnivariateForecasting.UnitTests/Utilities/FakeFileInfoAdapter.cs +++ b/tests/NW.UnivariateForecasting.UnitTests/Utilities/FakeFileInfoAdapter.cs @@ -1,7 +1,7 @@ using System; using System.IO; using System.Runtime.Serialization; -using NW.UnivariateForecasting.Files; +using NW.Shared.Files; namespace NW.UnivariateForecasting.UnitTests.Utilities { diff --git a/tests/NW.UnivariateForecasting.UnitTests/Utilities/FakeFileManager.cs b/tests/NW.UnivariateForecasting.UnitTests/Utilities/FakeFileManager.cs index 3e2d724..b54f5c6 100644 --- a/tests/NW.UnivariateForecasting.UnitTests/Utilities/FakeFileManager.cs +++ b/tests/NW.UnivariateForecasting.UnitTests/Utilities/FakeFileManager.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.IO; -using NW.UnivariateForecasting.Files; +using NW.Shared.Files; namespace NW.UnivariateForecasting.UnitTests.Utilities { diff --git a/tests/NW.UnivariateForecasting.UnitTests/Utilities/FakeFileManagerThrowingWriteExceptions.cs b/tests/NW.UnivariateForecasting.UnitTests/Utilities/FakeFileManagerThrowingWriteExceptions.cs index 940bb70..95e7e83 100644 --- a/tests/NW.UnivariateForecasting.UnitTests/Utilities/FakeFileManagerThrowingWriteExceptions.cs +++ b/tests/NW.UnivariateForecasting.UnitTests/Utilities/FakeFileManagerThrowingWriteExceptions.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.IO; -using NW.UnivariateForecasting.Files; +using NW.Shared.Files; namespace NW.UnivariateForecasting.UnitTests.Utilities { diff --git a/tests/NW.UnivariateForecasting.UnitTests/Utilities/ObjectMother.cs b/tests/NW.UnivariateForecasting.UnitTests/Utilities/ObjectMother.cs index 9e3178d..2f25d1e 100644 --- a/tests/NW.UnivariateForecasting.UnitTests/Utilities/ObjectMother.cs +++ b/tests/NW.UnivariateForecasting.UnitTests/Utilities/ObjectMother.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Reflection; using NUnit.Framework; +using NW.Shared.Files; using NW.UnivariateForecasting.Bags; namespace NW.UnivariateForecasting.UnitTests.Utilities @@ -10,6 +11,11 @@ public static class ObjectMother { #region Properties + + public static string FileInfoAdapterFullName = @"C:\somefile.txt"; + public static IFileInfoAdapter FileInfoAdapterDoesntExist + => new FakeFileInfoAdapter(false, FileInfoAdapterFullName); + #endregion #region Methods diff --git a/tests/NW.UnivariateForecasting.UnitTests/Validation/ObjectMother.cs b/tests/NW.UnivariateForecasting.UnitTests/Validation/ObjectMother.cs deleted file mode 100644 index c85a0d8..0000000 --- a/tests/NW.UnivariateForecasting.UnitTests/Validation/ObjectMother.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using NW.UnivariateForecasting.UnitTests.Utilities; - -namespace NW.UnivariateForecasting.UnitTests.Validation -{ - public static class ObjectMother - { - - #region Properties - - public static string[] Array01 = new[] { "Dodge", "Datsun", "Jaguar", "DeLorean" }; - public static Car Object01 = new Car() - { - Brand = "Dodge", - Model = "Charger", - Year = 1966, - Price = 13500, - Currency = "USD" - }; - public static uint Length01 = 3; - public static string VariableName_Variable = "variable"; - public static string VariableName_Length = "length"; - public static string VariableName_N1 = "n1"; - public static string VariableName_N2 = "n2"; - public static List List01 = Array01.ToList(); - public static uint Value = Length01; - public static string String01 = "Dodge"; - public static string StringOnlyWhiteSpaces = " "; - - #endregion - - } -} - -/* - Author: numbworks@gmail.com - Last Update: 14.11.2022 -*/ \ No newline at end of file diff --git a/tests/NW.UnivariateForecasting.UnitTests/Validation/ValidatorTests.cs b/tests/NW.UnivariateForecasting.UnitTests/Validation/ValidatorTests.cs deleted file mode 100644 index 76523d4..0000000 --- a/tests/NW.UnivariateForecasting.UnitTests/Validation/ValidatorTests.cs +++ /dev/null @@ -1,491 +0,0 @@ -using System; -using System.Collections.Generic; -using NW.UnivariateForecasting.Validation; -using NUnit.Framework; - -namespace NW.UnivariateForecasting.UnitTests.Validation -{ - [TestFixture] - public class ValidatorTests - { - - #region Fields - - private static TestCaseData[] validateLengthExceptionTestCases = - { - - // ValidateLength - new TestCaseData( - new TestDelegate( - () => Validator.ValidateLength(0) - ), - typeof(Exception), - new Exception( - MessageCollection.VariableCantBeLessThan(ObjectMother.VariableName_Length, 1)).Message - ).SetArgDisplayNames($"{nameof(validateLengthExceptionTestCases)}_01"), - - // ValidateLength - new TestCaseData( - new TestDelegate( - () => Validator.ValidateLength(0) - ), - typeof(ArgumentException), - new ArgumentException( - MessageCollection.VariableCantBeLessThan(ObjectMother.VariableName_Length, 1)).Message - ).SetArgDisplayNames($"{nameof(validateLengthExceptionTestCases)}_02") - - }; - private static TestCaseData[] validateObjectExceptionTestCases = - { - - // ValidateObject - new TestCaseData( - new TestDelegate( - () => Validator.ValidateObject(null, ObjectMother.VariableName_Variable) - ), - typeof(ArgumentException), - new ArgumentException(ObjectMother.VariableName_Variable).Message - ).SetArgDisplayNames($"{nameof(validateObjectExceptionTestCases)}_01"), - - // ValidateObject - new TestCaseData( - new TestDelegate( - () => Validator.ValidateObject(null, ObjectMother.VariableName_Variable) - ), - typeof(ArgumentNullException), - new ArgumentNullException(ObjectMother.VariableName_Variable).Message - ).SetArgDisplayNames($"{nameof(validateObjectExceptionTestCases)}_02") - - }; - private static TestCaseData[] validateArrayExceptionTestCases = - { - - // ValidateArrayNull - new TestCaseData( - new TestDelegate( - () => Validator.ValidateArray( - null, - ObjectMother.VariableName_Variable) - ), - typeof(ArgumentNullException), - new ArgumentNullException(ObjectMother.VariableName_Variable).Message - ).SetArgDisplayNames($"{nameof(validateArrayExceptionTestCases)}_01"), - - // ValidateArrayEmpty - new TestCaseData( - new TestDelegate( - () => Validator.ValidateArray( - Array.Empty(), - ObjectMother.VariableName_Variable) - ), - typeof(ArgumentException), - MessageCollection.VariableContainsZeroItems(ObjectMother.VariableName_Variable) - ).SetArgDisplayNames($"{nameof(validateArrayExceptionTestCases)}_02") - - }; - private static TestCaseData[] validateListExceptionTestCases = - { - - // ValidateListNull - new TestCaseData( - new TestDelegate( - () => Validator.ValidateList( - (List)null, - ObjectMother.VariableName_Variable) - ), - typeof(ArgumentNullException), - new ArgumentNullException(ObjectMother.VariableName_Variable).Message - ).SetArgDisplayNames($"{nameof(validateListExceptionTestCases)}_01"), - - // ValidateListEmpty - new TestCaseData( - new TestDelegate( - () => Validator.ValidateList( - new List() { }, - ObjectMother.VariableName_Variable) - ), - typeof(ArgumentException), - MessageCollection.VariableContainsZeroItems(ObjectMother.VariableName_Variable) - ).SetArgDisplayNames($"{nameof(validateListExceptionTestCases)}_02"), - - }; - private static TestCaseData[] validateStringNullOrWhiteSpaceExceptionTestCases = - { - - // ValidateStringNullOrWhiteSpace - new TestCaseData( - new TestDelegate( - () => Validator.ValidateStringNullOrWhiteSpace( - null, - ObjectMother.VariableName_Variable) - ), - typeof(Exception), - new Exception(ObjectMother.VariableName_Variable).Message - ).SetArgDisplayNames($"{nameof(validateStringNullOrWhiteSpaceExceptionTestCases)}_01"), - - // ValidateStringNullOrWhiteSpace - new TestCaseData( - new TestDelegate( - () => Validator.ValidateStringNullOrWhiteSpace( - null, - ObjectMother.VariableName_Variable) - ), - typeof(ArgumentNullException), - new ArgumentNullException(ObjectMother.VariableName_Variable).Message - ).SetArgDisplayNames($"{nameof(validateStringNullOrWhiteSpaceExceptionTestCases)}_02"), - - // ValidateStringNullOrWhiteSpace - new TestCaseData( - new TestDelegate( - () => Validator.ValidateStringNullOrWhiteSpace( - string.Empty, - ObjectMother.VariableName_Variable) - ), - typeof(ArgumentNullException), - new ArgumentNullException(ObjectMother.VariableName_Variable).Message - ).SetArgDisplayNames($"{nameof(validateStringNullOrWhiteSpaceExceptionTestCases)}_03"), - - // ValidateStringNullOrWhiteSpace - new TestCaseData( - new TestDelegate( - () => Validator.ValidateStringNullOrWhiteSpace( - ObjectMother.StringOnlyWhiteSpaces, - ObjectMother.VariableName_Variable) - ), - typeof(ArgumentNullException), - new ArgumentNullException(ObjectMother.VariableName_Variable).Message - ).SetArgDisplayNames($"{nameof(validateStringNullOrWhiteSpaceExceptionTestCases)}_04") - - }; - private static TestCaseData[] validateStringNullOrEmptyExceptionTestCases = - { - - // ValidateStringNullOrEmpty - new TestCaseData( - new TestDelegate( - () => Validator.ValidateStringNullOrEmpty( - null, - ObjectMother.VariableName_Variable) - ), - typeof(Exception), - new Exception(ObjectMother.VariableName_Variable).Message - ).SetArgDisplayNames($"{nameof(validateStringNullOrEmptyExceptionTestCases)}_01"), - - // ValidateStringNullOrEmpty - new TestCaseData( - new TestDelegate( - () => Validator.ValidateStringNullOrEmpty( - null, - ObjectMother.VariableName_Variable) - ), - typeof(ArgumentNullException), - new ArgumentNullException(ObjectMother.VariableName_Variable).Message - ).SetArgDisplayNames($"{nameof(validateStringNullOrEmptyExceptionTestCases)}_02"), - - // ValidateStringNullOrEmpty - new TestCaseData( - new TestDelegate( - () => Validator.ValidateStringNullOrEmpty( - string.Empty, - ObjectMother.VariableName_Variable) - ), - typeof(ArgumentNullException), - new ArgumentNullException(ObjectMother.VariableName_Variable).Message - ).SetArgDisplayNames($"{nameof(validateStringNullOrEmptyExceptionTestCases)}_03") - - }; - private static TestCaseData[] validateStringNullOrEmptyTestCases = - { - - new TestCaseData( - ObjectMother.String01 - ).SetArgDisplayNames($"{nameof(validateStringNullOrEmptyTestCases)}_01"), - - new TestCaseData( - ObjectMother.StringOnlyWhiteSpaces - ).SetArgDisplayNames($"{nameof(validateStringNullOrEmptyTestCases)}_02") - - }; - private static TestCaseData[] throwIfLessThanOneExceptionTestCases = - { - - // ThrowIfLessThanOne - new TestCaseData( - new TestDelegate( - () => Validator.ThrowIfLessThanOne(0, ObjectMother.VariableName_N1) - ), - typeof(Exception), - MessageCollection.VariableCantBeLessThan(ObjectMother.VariableName_N1, 1) - ).SetArgDisplayNames($"{nameof(throwIfLessThanOneExceptionTestCases)}_01"), - - // ThrowIfLessThanOne - new TestCaseData( - new TestDelegate( - () => Validator.ThrowIfLessThanOne(0, ObjectMother.VariableName_N1) - ), - typeof(ArgumentException), - MessageCollection.VariableCantBeLessThan(ObjectMother.VariableName_N1, 1) - ).SetArgDisplayNames($"{nameof(throwIfLessThanOneExceptionTestCases)}_02") - - }; - private static TestCaseData[] throwIfFirstIsGreaterExceptionTestCases = - { - - // ThrowIfFirstIsGreater - new TestCaseData( - new TestDelegate( - () => Validator.ThrowIfFirstIsGreater( - 4, - ObjectMother.VariableName_N1, - 1, - ObjectMother.VariableName_N2) - ), - typeof(Exception), - MessageCollection.FirstValueIsGreaterThanSecondValue( - ObjectMother.VariableName_N1, - ObjectMother.VariableName_N2 - ) - ).SetArgDisplayNames($"{nameof(throwIfFirstIsGreaterExceptionTestCases)}_01"), - - // ThrowIfFirstIsGreater - new TestCaseData( - new TestDelegate( - () => Validator.ThrowIfFirstIsGreater( - 4, - ObjectMother.VariableName_N1, - 1, - ObjectMother.VariableName_N2) - ), - typeof(ArgumentException), - MessageCollection.FirstValueIsGreaterThanSecondValue( - ObjectMother.VariableName_N1, - ObjectMother.VariableName_N2 - ) - ).SetArgDisplayNames($"{nameof(throwIfFirstIsGreaterExceptionTestCases)}_02") - - }; - private static TestCaseData[] throwIfFirstIsGreaterOrEqualExceptionTestCases = - { - - // ThrowIfFirstIsGreater - new TestCaseData( - new TestDelegate( - () => Validator.ThrowIfFirstIsGreaterOrEqual( - 4, - ObjectMother.VariableName_N1, - 1, - ObjectMother.VariableName_N2) - ), - typeof(Exception), - MessageCollection.FirstValueIsGreaterOrEqualThanSecondValue( - ObjectMother.VariableName_N1, - ObjectMother.VariableName_N2 - ) - ).SetArgDisplayNames($"{nameof(throwIfFirstIsGreaterOrEqualExceptionTestCases)}_01"), - - // ThrowIfFirstIsGreater - new TestCaseData( - new TestDelegate( - () => Validator.ThrowIfFirstIsGreaterOrEqual( - 4, - ObjectMother.VariableName_N1, - 1, - ObjectMother.VariableName_N2) - ), - typeof(ArgumentException), - MessageCollection.FirstValueIsGreaterOrEqualThanSecondValue( - ObjectMother.VariableName_N1, - ObjectMother.VariableName_N2 - ) - ).SetArgDisplayNames($"{nameof(throwIfFirstIsGreaterOrEqualExceptionTestCases)}_02") - - }; - private static TestCaseData[] throwIfModuloIsNotZeroExceptionTestCases = - { - - new TestCaseData( - new TestDelegate( - () => Validator.ThrowIfModuloIsNotZero( - value1: 5, - variableName1: ObjectMother.VariableName_N1, - value2: 2, - variableName2: ObjectMother.VariableName_N2) - ), - typeof(Exception), - MessageCollection.DividingMustReturnWholeNumber(ObjectMother.VariableName_N1, ObjectMother.VariableName_N2) - ).SetArgDisplayNames($"{nameof(throwIfModuloIsNotZeroExceptionTestCases)}_01") - - }; - - #endregion - - #region SetUp - #endregion - - #region Tests - - [TestCaseSource(nameof(validateLengthExceptionTestCases))] - public void ValidateLength_ShouldThrowACertainException_WhenUnproperArguments - (TestDelegate del, Type expectedType, string expectedMessage) - => Utilities.ObjectMother.Method_ShouldThrowACertainException_WhenUnproperArguments(del, expectedType, expectedMessage); - - [TestCaseSource(nameof(validateObjectExceptionTestCases))] - public void ValidateObject_ShouldThrowACertainException_WhenUnproperArguments - (TestDelegate del, Type expectedType, string expectedMessage) - => Utilities.ObjectMother.Method_ShouldThrowACertainException_WhenUnproperArguments(del, expectedType, expectedMessage); - - [TestCaseSource(nameof(validateArrayExceptionTestCases))] - public void ValidateArray_ShouldThrowACertainException_WhenUnproperArguments - (TestDelegate del, Type expectedType, string expectedMessage) - => Utilities.ObjectMother.Method_ShouldThrowACertainException_WhenUnproperArguments(del, expectedType, expectedMessage); - - [TestCaseSource(nameof(validateListExceptionTestCases))] - public void ValidateList_ShouldThrowACertainException_WhenUnproperArguments - (TestDelegate del, Type expectedType, string expectedMessage) - => Utilities.ObjectMother.Method_ShouldThrowACertainException_WhenUnproperArguments(del, expectedType, expectedMessage); - - [TestCaseSource(nameof(validateStringNullOrWhiteSpaceExceptionTestCases))] - public void ValidateStringNullOrWhiteSpace_ShouldThrowACertainException_WhenUnproperArguments - (TestDelegate del, Type expectedType, string expectedMessage) - => Utilities.ObjectMother.Method_ShouldThrowACertainException_WhenUnproperArguments(del, expectedType, expectedMessage); - - [TestCaseSource(nameof(validateStringNullOrEmptyExceptionTestCases))] - public void ValidateStringNullOrEmpty_ShouldThrowACertainException_WhenUnproperArguments - (TestDelegate del, Type expectedType, string expectedMessage) - => Utilities.ObjectMother.Method_ShouldThrowACertainException_WhenUnproperArguments(del, expectedType, expectedMessage); - - [TestCaseSource(nameof(throwIfLessThanOneExceptionTestCases))] - public void ThrowIfLessThanOne_ShouldThrowACertainException_WhenUnproperArguments - (TestDelegate del, Type expectedType, string expectedMessage) - => Utilities.ObjectMother.Method_ShouldThrowACertainException_WhenUnproperArguments(del, expectedType, expectedMessage); - - [TestCaseSource(nameof(throwIfFirstIsGreaterExceptionTestCases))] - public void ThrowIfFirstIsGreater_ShouldThrowACertainException_WhenUnproperArguments - (TestDelegate del, Type expectedType, string expectedMessage) - => Utilities.ObjectMother.Method_ShouldThrowACertainException_WhenUnproperArguments(del, expectedType, expectedMessage); - - [TestCaseSource(nameof(throwIfFirstIsGreaterOrEqualExceptionTestCases))] - public void ThrowIfFirstIsGreaterOrEqual_ShouldThrowACertainException_WhenUnproperArguments - (TestDelegate del, Type expectedType, string expectedMessage) - => Utilities.ObjectMother.Method_ShouldThrowACertainException_WhenUnproperArguments(del, expectedType, expectedMessage); - - [TestCaseSource(nameof(throwIfModuloIsNotZeroExceptionTestCases))] - public void ThrowIfModuloIsNotZero_ShouldThrowACertainException_WhenUnproperArguments - (TestDelegate del, Type expectedType, string expectedMessage) - => Utilities.ObjectMother.Method_ShouldThrowACertainException_WhenUnproperArguments(del, expectedType, expectedMessage); - - - [Test] - public void ValidateLength_ShouldDoNothing_WhenProperArgument() - => Method_ShouldDoNothing_WhenProperArgument( - new Action[] { - () => Validator.ValidateLength(ObjectMother.Length01), - () => Validator.ValidateLength(ObjectMother.Length01) - }); - - [Test] - public void ValidateObject_ShouldDoNothing_WhenProperArgument() - => Method_ShouldDoNothing_WhenProperArgument( - new Action[] { - () => Validator.ValidateObject(ObjectMother.Object01, ObjectMother.VariableName_Variable), - () => Validator.ValidateObject(ObjectMother.Object01, ObjectMother.VariableName_Variable) - }); - - [Test] - public void ValidateArray_ShouldDoNothing_WhenProperArgument() - => Method_ShouldDoNothing_WhenProperArgument( - new Action[] { - () => Validator.ValidateArray(ObjectMother.Array01, ObjectMother.VariableName_Variable) - }); - - [Test] - public void ValidateList_ShouldDoNothing_WhenProperArgument() - => Method_ShouldDoNothing_WhenProperArgument( - new Action[] { - () => Validator.ValidateList(ObjectMother.List01, ObjectMother.VariableName_Variable) - }); - - [Test] - public void ValidateStringNullOrWhiteSpace_ShouldDoNothing_WhenProperArgument() - => Method_ShouldDoNothing_WhenProperArgument( - new Action[] { - () => Validator.ValidateStringNullOrWhiteSpace(ObjectMother.String01, ObjectMother.VariableName_Variable) - }); - - [TestCaseSource(nameof(validateStringNullOrEmptyTestCases))] - public void ValidateStringNullOrEmpty_ShouldDoNothing_WhenProperArgument(string str) - => Method_ShouldDoNothing_WhenProperArgument( - new Action[] { - () => Validator.ValidateStringNullOrEmpty(str, ObjectMother.VariableName_Variable) - }); - - [Test] - public void ThrowIfFirstIsGreaterOrEqual_ShouldDoNothing_WhenProperArgument() - => Method_ShouldDoNothing_WhenProperArgument( - new Action[] { - () => Validator.ThrowIfFirstIsGreaterOrEqual(4, "n1", 5, "n2") - }); - - [Test] - public void ThrowIfFirstIsGreater_ShouldDoNothing_WhenProperArgument() - => Method_ShouldDoNothing_WhenProperArgument( - new Action[] { - () => Validator.ThrowIfFirstIsGreater(3, "n1", 4, "n2") - }); - - [Test] - public void ThrowIfLessThanOne_ShouldDoNothing_WhenProperArgument() - => Method_ShouldDoNothing_WhenProperArgument( - new Action[] { - () => Validator.ThrowIfLessThanOne(ObjectMother.Value, nameof(ObjectMother.Value)) - }); - - [Test] - public void ThrowIfModuloIsNotZero_ShouldDoNothing_WhenProperArgument() - => Method_ShouldDoNothing_WhenProperArgument( - new Action[] { - () => Validator.ThrowIfModuloIsNotZero( - value1: 4, - variableName1: ObjectMother.VariableName_N1, - value2: 1, - variableName2: ObjectMother.VariableName_N2) - }); - - #endregion - - #region TearDown - #endregion - - #region Support_methods - - public void Method_ShouldDoNothing_WhenProperArgument(Action[] actions) - { - - try - { - - // Arrange - // Act - foreach (Action action in actions) - action(); - - } - catch (Exception ex) - { - - // Assert - Assert.Fail(ex.Message); - - } - - } - - #endregion - - } -} - -/* - Author: numbworks@gmail.com - Last Update: 06.03.2023 -*/ diff --git a/tests/NW.UnivariateForecastingClient.UnitTests/NW.UnivariateForecastingClient.UnitTests.csproj b/tests/NW.UnivariateForecastingClient.UnitTests/NW.UnivariateForecastingClient.UnitTests.csproj index f23a85e..acf0f6a 100644 --- a/tests/NW.UnivariateForecastingClient.UnitTests/NW.UnivariateForecastingClient.UnitTests.csproj +++ b/tests/NW.UnivariateForecastingClient.UnitTests/NW.UnivariateForecastingClient.UnitTests.csproj @@ -6,7 +6,7 @@ Library numbworks 2024 - 4.0.0 + 4.1.0 https://github.com/numbworks/NW.UnivariateForecasting numbworks_logo_128x128px.png @@ -18,6 +18,7 @@ + diff --git a/tests/NW.UnivariateForecastingClient.UnitTests/Utilities/FakeFileManagerWithDynamicRead.cs b/tests/NW.UnivariateForecastingClient.UnitTests/Utilities/FakeFileManagerWithDynamicRead.cs index de3f5cb..59314c6 100644 --- a/tests/NW.UnivariateForecastingClient.UnitTests/Utilities/FakeFileManagerWithDynamicRead.cs +++ b/tests/NW.UnivariateForecastingClient.UnitTests/Utilities/FakeFileManagerWithDynamicRead.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.IO; -using NW.UnivariateForecasting.Files; using NW.UnivariateForecasting.UnitTests.Utilities; +using NW.Shared.Files; namespace NW.UnivariateForecastingClient.UnitTests.Utilities {