diff --git a/Directory.Packages.props b/Directory.Packages.props index 2c7469590..6d316a09f 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -32,6 +32,10 @@ + + + + diff --git a/Source/Testably.Abstractions.Testing/FileSystem/FileSystemWatcherMock.cs b/Source/Testably.Abstractions.Testing/FileSystem/FileSystemWatcherMock.cs index f299829f1..6dd66c333 100644 --- a/Source/Testably.Abstractions.Testing/FileSystem/FileSystemWatcherMock.cs +++ b/Source/Testably.Abstractions.Testing/FileSystem/FileSystemWatcherMock.cs @@ -15,7 +15,7 @@ namespace Testably.Abstractions.Testing.FileSystem; /// /// Mocked instance of a /// -public sealed class FileSystemWatcherMock : Component, IFileSystemWatcher +internal sealed class FileSystemWatcherMock : Component, IFileSystemWatcher { /// /// Simulated bytes pre message to calculate the size of the blocking collection relative to the diff --git a/Testably.Abstractions.sln b/Testably.Abstractions.sln index d61e3f229..485545b0c 100644 --- a/Testably.Abstractions.sln +++ b/Testably.Abstractions.sln @@ -90,6 +90,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testably.Abstractions.TestH EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testably.Abstractions.Tests.SourceGenerator", "Tests\Helpers\Testably.Abstractions.Tests.SourceGenerator\Testably.Abstractions.Tests.SourceGenerator.csproj", "{97A2540A-7FB4-4D8B-B003-3F8CAA9CED87}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Api", "Api", "{8A44FA00-968E-4CEC-90E6-94A878B9DEB2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testably.Abstractions.Api.Tests", "Tests\Api\Testably.Abstractions.Api.Tests\Testably.Abstractions.Api.Tests.csproj", "{2A729DA1-0C27-4C68-AB39-7D7BCB00D49F}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Api", "Api", "{0AEBB1A6-07D6-46DC-BC78-9771D380EBC0}" + ProjectSection(SolutionItems) = preProject + Tests\Api\Directory.Build.props = Tests\Api\Directory.Build.props + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -144,6 +153,10 @@ Global {97A2540A-7FB4-4D8B-B003-3F8CAA9CED87}.Debug|Any CPU.Build.0 = Debug|Any CPU {97A2540A-7FB4-4D8B-B003-3F8CAA9CED87}.Release|Any CPU.ActiveCfg = Release|Any CPU {97A2540A-7FB4-4D8B-B003-3F8CAA9CED87}.Release|Any CPU.Build.0 = Release|Any CPU + {2A729DA1-0C27-4C68-AB39-7D7BCB00D49F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2A729DA1-0C27-4C68-AB39-7D7BCB00D49F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2A729DA1-0C27-4C68-AB39-7D7BCB00D49F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2A729DA1-0C27-4C68-AB39-7D7BCB00D49F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -163,6 +176,9 @@ Global {B6C45D8A-A545-402E-A6B0-47BC7D9BBCF5} = {61F335A6-9CE0-4040-A34F-E70B1A55077D} {425BA8BA-7795-4749-BFC1-6FA853EBC6B7} = {B6C45D8A-A545-402E-A6B0-47BC7D9BBCF5} {97A2540A-7FB4-4D8B-B003-3F8CAA9CED87} = {B6C45D8A-A545-402E-A6B0-47BC7D9BBCF5} + {8A44FA00-968E-4CEC-90E6-94A878B9DEB2} = {61F335A6-9CE0-4040-A34F-E70B1A55077D} + {2A729DA1-0C27-4C68-AB39-7D7BCB00D49F} = {8A44FA00-968E-4CEC-90E6-94A878B9DEB2} + {0AEBB1A6-07D6-46DC-BC78-9771D380EBC0} = {2FDB2AAE-E5CE-483E-A1A6-EC0B0A4AD67B} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {EC4D8481-B9FD-41B5-832A-369210993DF4} diff --git a/Tests/Api/Directory.Build.props b/Tests/Api/Directory.Build.props new file mode 100644 index 000000000..c8e3e039b --- /dev/null +++ b/Tests/Api/Directory.Build.props @@ -0,0 +1,39 @@ + + + + + + + net8.0 + + + + latest + disable + enable + false + 701;1702;CA1845 + ..\..\..\Build\Tests\$(MSBuildProjectName) + + + + annotations + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/ApiAcceptance.cs b/Tests/Api/Testably.Abstractions.Api.Tests/ApiAcceptance.cs new file mode 100644 index 000000000..57ae4f19e --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/ApiAcceptance.cs @@ -0,0 +1,31 @@ +using NUnit.Framework; + +namespace Testably.Abstractions.Api.Tests; + +public sealed class ApiAcceptance +{ + /// + /// Execute this test to update the expected public API to the current API surface. + /// + [TestCase] + [Explicit] + public void AcceptApiChanges() + { + string[] assemblyNames = + { + "Testably.Abstractions", + "Testably.Abstractions.AccessControl", + "Testably.Abstractions.Compression", + "Testably.Abstractions.Interface", + "Testably.Abstractions.Testing" + }; + foreach (string assemblyName in assemblyNames) + { + foreach (string framework in Helper.GetTargetFrameworks()) + { + string publicApi = Helper.CreatePublicApi(framework, assemblyName); + Helper.SetExpectedApi(framework, assemblyName, publicApi); + } + } + } +} diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/ApiApprovalTests.cs b/Tests/Api/Testably.Abstractions.Api.Tests/ApiApprovalTests.cs new file mode 100644 index 000000000..3a795e251 --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/ApiApprovalTests.cs @@ -0,0 +1,85 @@ +using NUnit.Framework; +using System.Collections; + +namespace Testably.Abstractions.Api.Tests; + +/// +/// Whenever a test fails, this means that the public API surface changed. +/// If the change was intentional, execute the test to take over the +/// current public API surface. The changes will become part of the pull request and will be reviewed accordingly. +/// +public sealed class ApiApprovalTests +{ + [TestCaseSource(typeof(TargetFrameworksTheoryData))] + public void VerifyPublicApiForTestablyAbstractions(string framework) + { + const string assemblyName = "Testably.Abstractions"; + + string publicApi = Helper.CreatePublicApi(framework, assemblyName); + string expectedApi = Helper.GetExpectedApi(framework, assemblyName); + + Assert.That(publicApi, Is.EqualTo(expectedApi)); + } + + [TestCaseSource(typeof(TargetFrameworksTheoryData))] + public void VerifyPublicApiForTestablyAbstractionsAccessControl(string framework) + { + const string assemblyName = "Testably.Abstractions.AccessControl"; + + string publicApi = Helper.CreatePublicApi(framework, assemblyName); + string expectedApi = Helper.GetExpectedApi(framework, assemblyName); + + Assert.That(publicApi, Is.EqualTo(expectedApi)); + } + + [TestCaseSource(typeof(TargetFrameworksTheoryData))] + public void VerifyPublicApiForTestablyAbstractionsCompression(string framework) + { + const string assemblyName = "Testably.Abstractions.Compression"; + + string publicApi = Helper.CreatePublicApi(framework, assemblyName); + string expectedApi = Helper.GetExpectedApi(framework, assemblyName); + + Assert.That(publicApi, Is.EqualTo(expectedApi)); + } + + [TestCaseSource(typeof(TargetFrameworksTheoryData))] + public void VerifyPublicApiForTestablyAbstractionsInterface(string framework) + { + const string assemblyName = "Testably.Abstractions.Interface"; + + string publicApi = Helper.CreatePublicApi(framework, assemblyName); + string expectedApi = Helper.GetExpectedApi(framework, assemblyName); + + Assert.That(publicApi, Is.EqualTo(expectedApi)); + } + + [TestCaseSource(typeof(TargetFrameworksTheoryData))] + public void VerifyPublicApiForTestablyAbstractionsTesting(string framework) + { + const string assemblyName = "Testably.Abstractions.Testing"; + + string publicApi = Helper.CreatePublicApi(framework, assemblyName); + string expectedApi = Helper.GetExpectedApi(framework, assemblyName); + + Assert.That(publicApi, Is.EqualTo(expectedApi)); + } + + private class TargetFrameworksTheoryData : IEnumerable + { + #region IEnumerable Members + + public IEnumerator GetEnumerator() + { + foreach (string targetFramework in Helper.GetTargetFrameworks()) + { + yield return new object[] + { + targetFramework + }; + } + } + + #endregion + } +} diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.AccessControl_net6.0.txt b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.AccessControl_net6.0.txt new file mode 100644 index 000000000..7b8a689b4 --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.AccessControl_net6.0.txt @@ -0,0 +1,54 @@ +[assembly: System.CLSCompliant(true)] +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/Testably/Testably.Abstractions.git")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Testably.Abstractions.AccessControl.Tests")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName=".NET 6.0")] +namespace Testably.Abstractions +{ + public static class DirectoryAclExtensions + { + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static void CreateDirectory(this System.IO.Abstractions.IDirectory directory, string path, System.Security.AccessControl.DirectorySecurity directorySecurity) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.DirectorySecurity GetAccessControl(this System.IO.Abstractions.IDirectory directory, string path) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.DirectorySecurity GetAccessControl(this System.IO.Abstractions.IDirectory directory, string path, System.Security.AccessControl.AccessControlSections includeSections) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static void SetAccessControl(this System.IO.Abstractions.IDirectory directory, string path, System.Security.AccessControl.DirectorySecurity directorySecurity) { } + } + public static class DirectoryInfoAclExtensions + { + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static void Create(this System.IO.Abstractions.IDirectoryInfo directoryInfo, System.Security.AccessControl.DirectorySecurity directorySecurity) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.DirectorySecurity GetAccessControl(this System.IO.Abstractions.IDirectoryInfo directoryInfo) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.DirectorySecurity GetAccessControl(this System.IO.Abstractions.IDirectoryInfo directoryInfo, System.Security.AccessControl.AccessControlSections includeSections) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static void SetAccessControl(this System.IO.Abstractions.IDirectoryInfo directoryInfo, System.Security.AccessControl.DirectorySecurity directorySecurity) { } + } + public static class FileAclExtensions + { + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.Abstractions.IFile file, string path) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.Abstractions.IFile file, string path, System.Security.AccessControl.AccessControlSections includeSections) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static void SetAccessControl(this System.IO.Abstractions.IFile file, string path, System.Security.AccessControl.FileSecurity fileSecurity) { } + } + public static class FileInfoAclExtensions + { + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.Abstractions.IFileInfo fileInfo) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.Abstractions.IFileInfo fileInfo, System.Security.AccessControl.AccessControlSections includeSections) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static void SetAccessControl(this System.IO.Abstractions.IFileInfo fileInfo, System.Security.AccessControl.FileSecurity fileSecurity) { } + } + public static class FileStreamAclExtensions + { + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.Abstractions.FileSystemStream fileStream) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static void SetAccessControl(this System.IO.Abstractions.FileSystemStream fileStream, System.Security.AccessControl.FileSecurity fileSecurity) { } + } +} \ No newline at end of file diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.AccessControl_net7.0.txt b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.AccessControl_net7.0.txt new file mode 100644 index 000000000..539134e6e --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.AccessControl_net7.0.txt @@ -0,0 +1,54 @@ +[assembly: System.CLSCompliant(true)] +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/Testably/Testably.Abstractions.git")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Testably.Abstractions.AccessControl.Tests")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v7.0", FrameworkDisplayName=".NET 7.0")] +namespace Testably.Abstractions +{ + public static class DirectoryAclExtensions + { + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static void CreateDirectory(this System.IO.Abstractions.IDirectory directory, string path, System.Security.AccessControl.DirectorySecurity directorySecurity) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.DirectorySecurity GetAccessControl(this System.IO.Abstractions.IDirectory directory, string path) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.DirectorySecurity GetAccessControl(this System.IO.Abstractions.IDirectory directory, string path, System.Security.AccessControl.AccessControlSections includeSections) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static void SetAccessControl(this System.IO.Abstractions.IDirectory directory, string path, System.Security.AccessControl.DirectorySecurity directorySecurity) { } + } + public static class DirectoryInfoAclExtensions + { + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static void Create(this System.IO.Abstractions.IDirectoryInfo directoryInfo, System.Security.AccessControl.DirectorySecurity directorySecurity) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.DirectorySecurity GetAccessControl(this System.IO.Abstractions.IDirectoryInfo directoryInfo) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.DirectorySecurity GetAccessControl(this System.IO.Abstractions.IDirectoryInfo directoryInfo, System.Security.AccessControl.AccessControlSections includeSections) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static void SetAccessControl(this System.IO.Abstractions.IDirectoryInfo directoryInfo, System.Security.AccessControl.DirectorySecurity directorySecurity) { } + } + public static class FileAclExtensions + { + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.Abstractions.IFile file, string path) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.Abstractions.IFile file, string path, System.Security.AccessControl.AccessControlSections includeSections) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static void SetAccessControl(this System.IO.Abstractions.IFile file, string path, System.Security.AccessControl.FileSecurity fileSecurity) { } + } + public static class FileInfoAclExtensions + { + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.Abstractions.IFileInfo fileInfo) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.Abstractions.IFileInfo fileInfo, System.Security.AccessControl.AccessControlSections includeSections) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static void SetAccessControl(this System.IO.Abstractions.IFileInfo fileInfo, System.Security.AccessControl.FileSecurity fileSecurity) { } + } + public static class FileStreamAclExtensions + { + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.Abstractions.FileSystemStream fileStream) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static void SetAccessControl(this System.IO.Abstractions.FileSystemStream fileStream, System.Security.AccessControl.FileSecurity fileSecurity) { } + } +} \ No newline at end of file diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.AccessControl_net8.0.txt b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.AccessControl_net8.0.txt new file mode 100644 index 000000000..20a2d9ebf --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.AccessControl_net8.0.txt @@ -0,0 +1,54 @@ +[assembly: System.CLSCompliant(true)] +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/Testably/Testably.Abstractions.git")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Testably.Abstractions.AccessControl.Tests")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName=".NET 8.0")] +namespace Testably.Abstractions +{ + public static class DirectoryAclExtensions + { + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static void CreateDirectory(this System.IO.Abstractions.IDirectory directory, string path, System.Security.AccessControl.DirectorySecurity directorySecurity) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.DirectorySecurity GetAccessControl(this System.IO.Abstractions.IDirectory directory, string path) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.DirectorySecurity GetAccessControl(this System.IO.Abstractions.IDirectory directory, string path, System.Security.AccessControl.AccessControlSections includeSections) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static void SetAccessControl(this System.IO.Abstractions.IDirectory directory, string path, System.Security.AccessControl.DirectorySecurity directorySecurity) { } + } + public static class DirectoryInfoAclExtensions + { + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static void Create(this System.IO.Abstractions.IDirectoryInfo directoryInfo, System.Security.AccessControl.DirectorySecurity directorySecurity) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.DirectorySecurity GetAccessControl(this System.IO.Abstractions.IDirectoryInfo directoryInfo) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.DirectorySecurity GetAccessControl(this System.IO.Abstractions.IDirectoryInfo directoryInfo, System.Security.AccessControl.AccessControlSections includeSections) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static void SetAccessControl(this System.IO.Abstractions.IDirectoryInfo directoryInfo, System.Security.AccessControl.DirectorySecurity directorySecurity) { } + } + public static class FileAclExtensions + { + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.Abstractions.IFile file, string path) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.Abstractions.IFile file, string path, System.Security.AccessControl.AccessControlSections includeSections) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static void SetAccessControl(this System.IO.Abstractions.IFile file, string path, System.Security.AccessControl.FileSecurity fileSecurity) { } + } + public static class FileInfoAclExtensions + { + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.Abstractions.IFileInfo fileInfo) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.Abstractions.IFileInfo fileInfo, System.Security.AccessControl.AccessControlSections includeSections) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static void SetAccessControl(this System.IO.Abstractions.IFileInfo fileInfo, System.Security.AccessControl.FileSecurity fileSecurity) { } + } + public static class FileStreamAclExtensions + { + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.Abstractions.FileSystemStream fileStream) { } + [System.Runtime.Versioning.SupportedOSPlatform("windows")] + public static void SetAccessControl(this System.IO.Abstractions.FileSystemStream fileStream, System.Security.AccessControl.FileSecurity fileSecurity) { } + } +} \ No newline at end of file diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.AccessControl_netstandard2.0.txt b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.AccessControl_netstandard2.0.txt new file mode 100644 index 000000000..32433a482 --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.AccessControl_netstandard2.0.txt @@ -0,0 +1,54 @@ +[assembly: System.CLSCompliant(true)] +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/Testably/Testably.Abstractions.git")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Testably.Abstractions.AccessControl.Tests")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName=".NET Standard 2.0")] +namespace Testably.Abstractions +{ + public static class DirectoryAclExtensions + { + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static void CreateDirectory(this System.IO.Abstractions.IDirectory directory, string path, System.Security.AccessControl.DirectorySecurity directorySecurity) { } + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.DirectorySecurity GetAccessControl(this System.IO.Abstractions.IDirectory directory, string path) { } + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.DirectorySecurity GetAccessControl(this System.IO.Abstractions.IDirectory directory, string path, System.Security.AccessControl.AccessControlSections includeSections) { } + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static void SetAccessControl(this System.IO.Abstractions.IDirectory directory, string path, System.Security.AccessControl.DirectorySecurity directorySecurity) { } + } + public static class DirectoryInfoAclExtensions + { + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static void Create(this System.IO.Abstractions.IDirectoryInfo directoryInfo, System.Security.AccessControl.DirectorySecurity directorySecurity) { } + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.DirectorySecurity GetAccessControl(this System.IO.Abstractions.IDirectoryInfo directoryInfo) { } + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.DirectorySecurity GetAccessControl(this System.IO.Abstractions.IDirectoryInfo directoryInfo, System.Security.AccessControl.AccessControlSections includeSections) { } + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static void SetAccessControl(this System.IO.Abstractions.IDirectoryInfo directoryInfo, System.Security.AccessControl.DirectorySecurity directorySecurity) { } + } + public static class FileAclExtensions + { + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.Abstractions.IFile file, string path) { } + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.Abstractions.IFile file, string path, System.Security.AccessControl.AccessControlSections includeSections) { } + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static void SetAccessControl(this System.IO.Abstractions.IFile file, string path, System.Security.AccessControl.FileSecurity fileSecurity) { } + } + public static class FileInfoAclExtensions + { + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.Abstractions.IFileInfo fileInfo) { } + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.Abstractions.IFileInfo fileInfo, System.Security.AccessControl.AccessControlSections includeSections) { } + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static void SetAccessControl(this System.IO.Abstractions.IFileInfo fileInfo, System.Security.AccessControl.FileSecurity fileSecurity) { } + } + public static class FileStreamAclExtensions + { + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.Abstractions.FileSystemStream fileStream) { } + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static void SetAccessControl(this System.IO.Abstractions.FileSystemStream fileStream, System.Security.AccessControl.FileSecurity fileSecurity) { } + } +} \ No newline at end of file diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.AccessControl_netstandard2.1.txt b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.AccessControl_netstandard2.1.txt new file mode 100644 index 000000000..705a18c51 --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.AccessControl_netstandard2.1.txt @@ -0,0 +1,54 @@ +[assembly: System.CLSCompliant(true)] +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/Testably/Testably.Abstractions.git")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Testably.Abstractions.AccessControl.Tests")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName=".NET Standard 2.1")] +namespace Testably.Abstractions +{ + public static class DirectoryAclExtensions + { + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static void CreateDirectory(this System.IO.Abstractions.IDirectory directory, string path, System.Security.AccessControl.DirectorySecurity directorySecurity) { } + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.DirectorySecurity GetAccessControl(this System.IO.Abstractions.IDirectory directory, string path) { } + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.DirectorySecurity GetAccessControl(this System.IO.Abstractions.IDirectory directory, string path, System.Security.AccessControl.AccessControlSections includeSections) { } + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static void SetAccessControl(this System.IO.Abstractions.IDirectory directory, string path, System.Security.AccessControl.DirectorySecurity directorySecurity) { } + } + public static class DirectoryInfoAclExtensions + { + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static void Create(this System.IO.Abstractions.IDirectoryInfo directoryInfo, System.Security.AccessControl.DirectorySecurity directorySecurity) { } + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.DirectorySecurity GetAccessControl(this System.IO.Abstractions.IDirectoryInfo directoryInfo) { } + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.DirectorySecurity GetAccessControl(this System.IO.Abstractions.IDirectoryInfo directoryInfo, System.Security.AccessControl.AccessControlSections includeSections) { } + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static void SetAccessControl(this System.IO.Abstractions.IDirectoryInfo directoryInfo, System.Security.AccessControl.DirectorySecurity directorySecurity) { } + } + public static class FileAclExtensions + { + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.Abstractions.IFile file, string path) { } + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.Abstractions.IFile file, string path, System.Security.AccessControl.AccessControlSections includeSections) { } + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static void SetAccessControl(this System.IO.Abstractions.IFile file, string path, System.Security.AccessControl.FileSecurity fileSecurity) { } + } + public static class FileInfoAclExtensions + { + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.Abstractions.IFileInfo fileInfo) { } + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.Abstractions.IFileInfo fileInfo, System.Security.AccessControl.AccessControlSections includeSections) { } + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static void SetAccessControl(this System.IO.Abstractions.IFileInfo fileInfo, System.Security.AccessControl.FileSecurity fileSecurity) { } + } + public static class FileStreamAclExtensions + { + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static System.Security.AccessControl.FileSecurity GetAccessControl(this System.IO.Abstractions.FileSystemStream fileStream) { } + [Testably.Abstractions.Polyfills.SupportedOSPlatform("windows")] + public static void SetAccessControl(this System.IO.Abstractions.FileSystemStream fileStream, System.Security.AccessControl.FileSecurity fileSecurity) { } + } +} \ No newline at end of file diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Compression_net6.0.txt b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Compression_net6.0.txt new file mode 100644 index 000000000..17a57d99e --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Compression_net6.0.txt @@ -0,0 +1,58 @@ +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/Testably/Testably.Abstractions.git")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Testably.Abstractions.Compression.Tests")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName=".NET 6.0")] +namespace Testably.Abstractions +{ + public static class FileSystemExtensions + { + public static Testably.Abstractions.IZipArchiveFactory ZipArchive(this System.IO.Abstractions.IFileSystem fileSystem) { } + public static Testably.Abstractions.IZipFile ZipFile(this System.IO.Abstractions.IFileSystem fileSystem) { } + } + public interface IZipArchive : System.IDisposable, System.IO.Abstractions.IFileSystemEntity + { + System.Collections.ObjectModel.ReadOnlyCollection Entries { get; } + System.IO.Compression.ZipArchiveMode Mode { get; } + Testably.Abstractions.IZipArchiveEntry CreateEntry(string entryName); + Testably.Abstractions.IZipArchiveEntry CreateEntry(string entryName, System.IO.Compression.CompressionLevel compressionLevel); + Testably.Abstractions.IZipArchiveEntry CreateEntryFromFile(string sourceFileName, string entryName); + Testably.Abstractions.IZipArchiveEntry CreateEntryFromFile(string sourceFileName, string entryName, System.IO.Compression.CompressionLevel compressionLevel); + void ExtractToDirectory(string destinationDirectoryName); + void ExtractToDirectory(string destinationDirectoryName, bool overwriteFiles); + Testably.Abstractions.IZipArchiveEntry? GetEntry(string entryName); + } + public interface IZipArchiveEntry : System.IO.Abstractions.IFileSystemEntity + { + Testably.Abstractions.IZipArchive Archive { get; } + long CompressedLength { get; } + uint Crc32 { get; } + int ExternalAttributes { get; set; } + string FullName { get; } + System.DateTimeOffset LastWriteTime { get; set; } + long Length { get; } + string Name { get; } + void Delete(); + void ExtractToFile(string destinationFileName); + void ExtractToFile(string destinationFileName, bool overwrite); + System.IO.Stream Open(); + } + public interface IZipArchiveFactory : System.IO.Abstractions.IFileSystemEntity + { + Testably.Abstractions.IZipArchive New(System.IO.Stream stream); + Testably.Abstractions.IZipArchive New(System.IO.Stream stream, System.IO.Compression.ZipArchiveMode mode); + Testably.Abstractions.IZipArchive New(System.IO.Stream stream, System.IO.Compression.ZipArchiveMode mode, bool leaveOpen); + Testably.Abstractions.IZipArchive New(System.IO.Stream stream, System.IO.Compression.ZipArchiveMode mode, bool leaveOpen, System.Text.Encoding? entryNameEncoding); + } + public interface IZipFile : System.IO.Abstractions.IFileSystemEntity + { + void CreateFromDirectory(string sourceDirectoryName, string destinationArchiveFileName); + void CreateFromDirectory(string sourceDirectoryName, string destinationArchiveFileName, System.IO.Compression.CompressionLevel compressionLevel, bool includeBaseDirectory); + void CreateFromDirectory(string sourceDirectoryName, string destinationArchiveFileName, System.IO.Compression.CompressionLevel compressionLevel, bool includeBaseDirectory, System.Text.Encoding entryNameEncoding); + void ExtractToDirectory(string sourceArchiveFileName, string destinationDirectoryName); + void ExtractToDirectory(string sourceArchiveFileName, string destinationDirectoryName, bool overwriteFiles); + void ExtractToDirectory(string sourceArchiveFileName, string destinationDirectoryName, System.Text.Encoding? entryNameEncoding); + void ExtractToDirectory(string sourceArchiveFileName, string destinationDirectoryName, System.Text.Encoding? entryNameEncoding, bool overwriteFiles); + Testably.Abstractions.IZipArchive Open(string archiveFileName, System.IO.Compression.ZipArchiveMode mode); + Testably.Abstractions.IZipArchive Open(string archiveFileName, System.IO.Compression.ZipArchiveMode mode, System.Text.Encoding? entryNameEncoding); + Testably.Abstractions.IZipArchive OpenRead(string archiveFileName); + } +} \ No newline at end of file diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Compression_net7.0.txt b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Compression_net7.0.txt new file mode 100644 index 000000000..d142ce372 --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Compression_net7.0.txt @@ -0,0 +1,61 @@ +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/Testably/Testably.Abstractions.git")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Testably.Abstractions.Compression.Tests")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v7.0", FrameworkDisplayName=".NET 7.0")] +namespace Testably.Abstractions +{ + public static class FileSystemExtensions + { + public static Testably.Abstractions.IZipArchiveFactory ZipArchive(this System.IO.Abstractions.IFileSystem fileSystem) { } + public static Testably.Abstractions.IZipFile ZipFile(this System.IO.Abstractions.IFileSystem fileSystem) { } + } + public interface IZipArchive : System.IDisposable, System.IO.Abstractions.IFileSystemEntity + { + string Comment { get; set; } + System.Collections.ObjectModel.ReadOnlyCollection Entries { get; } + System.IO.Compression.ZipArchiveMode Mode { get; } + Testably.Abstractions.IZipArchiveEntry CreateEntry(string entryName); + Testably.Abstractions.IZipArchiveEntry CreateEntry(string entryName, System.IO.Compression.CompressionLevel compressionLevel); + Testably.Abstractions.IZipArchiveEntry CreateEntryFromFile(string sourceFileName, string entryName); + Testably.Abstractions.IZipArchiveEntry CreateEntryFromFile(string sourceFileName, string entryName, System.IO.Compression.CompressionLevel compressionLevel); + void ExtractToDirectory(string destinationDirectoryName); + void ExtractToDirectory(string destinationDirectoryName, bool overwriteFiles); + Testably.Abstractions.IZipArchiveEntry? GetEntry(string entryName); + } + public interface IZipArchiveEntry : System.IO.Abstractions.IFileSystemEntity + { + Testably.Abstractions.IZipArchive Archive { get; } + string Comment { get; set; } + long CompressedLength { get; } + uint Crc32 { get; } + int ExternalAttributes { get; set; } + string FullName { get; } + bool IsEncrypted { get; } + System.DateTimeOffset LastWriteTime { get; set; } + long Length { get; } + string Name { get; } + void Delete(); + void ExtractToFile(string destinationFileName); + void ExtractToFile(string destinationFileName, bool overwrite); + System.IO.Stream Open(); + } + public interface IZipArchiveFactory : System.IO.Abstractions.IFileSystemEntity + { + Testably.Abstractions.IZipArchive New(System.IO.Stream stream); + Testably.Abstractions.IZipArchive New(System.IO.Stream stream, System.IO.Compression.ZipArchiveMode mode); + Testably.Abstractions.IZipArchive New(System.IO.Stream stream, System.IO.Compression.ZipArchiveMode mode, bool leaveOpen); + Testably.Abstractions.IZipArchive New(System.IO.Stream stream, System.IO.Compression.ZipArchiveMode mode, bool leaveOpen, System.Text.Encoding? entryNameEncoding); + } + public interface IZipFile : System.IO.Abstractions.IFileSystemEntity + { + void CreateFromDirectory(string sourceDirectoryName, string destinationArchiveFileName); + void CreateFromDirectory(string sourceDirectoryName, string destinationArchiveFileName, System.IO.Compression.CompressionLevel compressionLevel, bool includeBaseDirectory); + void CreateFromDirectory(string sourceDirectoryName, string destinationArchiveFileName, System.IO.Compression.CompressionLevel compressionLevel, bool includeBaseDirectory, System.Text.Encoding entryNameEncoding); + void ExtractToDirectory(string sourceArchiveFileName, string destinationDirectoryName); + void ExtractToDirectory(string sourceArchiveFileName, string destinationDirectoryName, bool overwriteFiles); + void ExtractToDirectory(string sourceArchiveFileName, string destinationDirectoryName, System.Text.Encoding? entryNameEncoding); + void ExtractToDirectory(string sourceArchiveFileName, string destinationDirectoryName, System.Text.Encoding? entryNameEncoding, bool overwriteFiles); + Testably.Abstractions.IZipArchive Open(string archiveFileName, System.IO.Compression.ZipArchiveMode mode); + Testably.Abstractions.IZipArchive Open(string archiveFileName, System.IO.Compression.ZipArchiveMode mode, System.Text.Encoding? entryNameEncoding); + Testably.Abstractions.IZipArchive OpenRead(string archiveFileName); + } +} \ No newline at end of file diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Compression_net8.0.txt b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Compression_net8.0.txt new file mode 100644 index 000000000..dc62146f1 --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Compression_net8.0.txt @@ -0,0 +1,68 @@ +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/Testably/Testably.Abstractions.git")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Testably.Abstractions.Compression.Tests")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName=".NET 8.0")] +namespace Testably.Abstractions +{ + public static class FileSystemExtensions + { + public static Testably.Abstractions.IZipArchiveFactory ZipArchive(this System.IO.Abstractions.IFileSystem fileSystem) { } + public static Testably.Abstractions.IZipFile ZipFile(this System.IO.Abstractions.IFileSystem fileSystem) { } + } + public interface IZipArchive : System.IDisposable, System.IO.Abstractions.IFileSystemEntity + { + string Comment { get; set; } + System.Collections.ObjectModel.ReadOnlyCollection Entries { get; } + System.IO.Compression.ZipArchiveMode Mode { get; } + Testably.Abstractions.IZipArchiveEntry CreateEntry(string entryName); + Testably.Abstractions.IZipArchiveEntry CreateEntry(string entryName, System.IO.Compression.CompressionLevel compressionLevel); + Testably.Abstractions.IZipArchiveEntry CreateEntryFromFile(string sourceFileName, string entryName); + Testably.Abstractions.IZipArchiveEntry CreateEntryFromFile(string sourceFileName, string entryName, System.IO.Compression.CompressionLevel compressionLevel); + void ExtractToDirectory(string destinationDirectoryName); + void ExtractToDirectory(string destinationDirectoryName, bool overwriteFiles); + Testably.Abstractions.IZipArchiveEntry? GetEntry(string entryName); + } + public interface IZipArchiveEntry : System.IO.Abstractions.IFileSystemEntity + { + Testably.Abstractions.IZipArchive Archive { get; } + string Comment { get; set; } + long CompressedLength { get; } + uint Crc32 { get; } + int ExternalAttributes { get; set; } + string FullName { get; } + bool IsEncrypted { get; } + System.DateTimeOffset LastWriteTime { get; set; } + long Length { get; } + string Name { get; } + void Delete(); + void ExtractToFile(string destinationFileName); + void ExtractToFile(string destinationFileName, bool overwrite); + System.IO.Stream Open(); + } + public interface IZipArchiveFactory : System.IO.Abstractions.IFileSystemEntity + { + Testably.Abstractions.IZipArchive New(System.IO.Stream stream); + Testably.Abstractions.IZipArchive New(System.IO.Stream stream, System.IO.Compression.ZipArchiveMode mode); + Testably.Abstractions.IZipArchive New(System.IO.Stream stream, System.IO.Compression.ZipArchiveMode mode, bool leaveOpen); + Testably.Abstractions.IZipArchive New(System.IO.Stream stream, System.IO.Compression.ZipArchiveMode mode, bool leaveOpen, System.Text.Encoding? entryNameEncoding); + } + public interface IZipFile : System.IO.Abstractions.IFileSystemEntity + { + void CreateFromDirectory(string sourceDirectoryName, System.IO.Stream destination); + void CreateFromDirectory(string sourceDirectoryName, string destinationArchiveFileName); + void CreateFromDirectory(string sourceDirectoryName, System.IO.Stream destination, System.IO.Compression.CompressionLevel compressionLevel, bool includeBaseDirectory); + void CreateFromDirectory(string sourceDirectoryName, string destinationArchiveFileName, System.IO.Compression.CompressionLevel compressionLevel, bool includeBaseDirectory); + void CreateFromDirectory(string sourceDirectoryName, System.IO.Stream destination, System.IO.Compression.CompressionLevel compressionLevel, bool includeBaseDirectory, System.Text.Encoding entryNameEncoding); + void CreateFromDirectory(string sourceDirectoryName, string destinationArchiveFileName, System.IO.Compression.CompressionLevel compressionLevel, bool includeBaseDirectory, System.Text.Encoding entryNameEncoding); + void ExtractToDirectory(System.IO.Stream source, string destinationDirectoryName); + void ExtractToDirectory(string sourceArchiveFileName, string destinationDirectoryName); + void ExtractToDirectory(System.IO.Stream source, string destinationDirectoryName, bool overwriteFiles); + void ExtractToDirectory(System.IO.Stream source, string destinationDirectoryName, System.Text.Encoding entryNameEncoding); + void ExtractToDirectory(string sourceArchiveFileName, string destinationDirectoryName, bool overwriteFiles); + void ExtractToDirectory(string sourceArchiveFileName, string destinationDirectoryName, System.Text.Encoding? entryNameEncoding); + void ExtractToDirectory(System.IO.Stream source, string destinationDirectoryName, System.Text.Encoding entryNameEncoding, bool overwriteFiles); + void ExtractToDirectory(string sourceArchiveFileName, string destinationDirectoryName, System.Text.Encoding? entryNameEncoding, bool overwriteFiles); + Testably.Abstractions.IZipArchive Open(string archiveFileName, System.IO.Compression.ZipArchiveMode mode); + Testably.Abstractions.IZipArchive Open(string archiveFileName, System.IO.Compression.ZipArchiveMode mode, System.Text.Encoding? entryNameEncoding); + Testably.Abstractions.IZipArchive OpenRead(string archiveFileName); + } +} \ No newline at end of file diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Compression_netstandard2.0.txt b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Compression_netstandard2.0.txt new file mode 100644 index 000000000..edb0821bd --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Compression_netstandard2.0.txt @@ -0,0 +1,53 @@ +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/Testably/Testably.Abstractions.git")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Testably.Abstractions.Compression.Tests")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName=".NET Standard 2.0")] +namespace Testably.Abstractions +{ + public static class FileSystemExtensions + { + public static Testably.Abstractions.IZipArchiveFactory ZipArchive(this System.IO.Abstractions.IFileSystem fileSystem) { } + public static Testably.Abstractions.IZipFile ZipFile(this System.IO.Abstractions.IFileSystem fileSystem) { } + } + public interface IZipArchive : System.IDisposable, System.IO.Abstractions.IFileSystemEntity + { + System.Collections.ObjectModel.ReadOnlyCollection Entries { get; } + System.IO.Compression.ZipArchiveMode Mode { get; } + Testably.Abstractions.IZipArchiveEntry CreateEntry(string entryName); + Testably.Abstractions.IZipArchiveEntry CreateEntry(string entryName, System.IO.Compression.CompressionLevel compressionLevel); + Testably.Abstractions.IZipArchiveEntry CreateEntryFromFile(string sourceFileName, string entryName); + Testably.Abstractions.IZipArchiveEntry CreateEntryFromFile(string sourceFileName, string entryName, System.IO.Compression.CompressionLevel compressionLevel); + void ExtractToDirectory(string destinationDirectoryName); + Testably.Abstractions.IZipArchiveEntry? GetEntry(string entryName); + } + public interface IZipArchiveEntry : System.IO.Abstractions.IFileSystemEntity + { + Testably.Abstractions.IZipArchive Archive { get; } + long CompressedLength { get; } + string FullName { get; } + System.DateTimeOffset LastWriteTime { get; set; } + long Length { get; } + string Name { get; } + void Delete(); + void ExtractToFile(string destinationFileName); + void ExtractToFile(string destinationFileName, bool overwrite); + System.IO.Stream Open(); + } + public interface IZipArchiveFactory : System.IO.Abstractions.IFileSystemEntity + { + Testably.Abstractions.IZipArchive New(System.IO.Stream stream); + Testably.Abstractions.IZipArchive New(System.IO.Stream stream, System.IO.Compression.ZipArchiveMode mode); + Testably.Abstractions.IZipArchive New(System.IO.Stream stream, System.IO.Compression.ZipArchiveMode mode, bool leaveOpen); + Testably.Abstractions.IZipArchive New(System.IO.Stream stream, System.IO.Compression.ZipArchiveMode mode, bool leaveOpen, System.Text.Encoding? entryNameEncoding); + } + public interface IZipFile : System.IO.Abstractions.IFileSystemEntity + { + void CreateFromDirectory(string sourceDirectoryName, string destinationArchiveFileName); + void CreateFromDirectory(string sourceDirectoryName, string destinationArchiveFileName, System.IO.Compression.CompressionLevel compressionLevel, bool includeBaseDirectory); + void CreateFromDirectory(string sourceDirectoryName, string destinationArchiveFileName, System.IO.Compression.CompressionLevel compressionLevel, bool includeBaseDirectory, System.Text.Encoding entryNameEncoding); + void ExtractToDirectory(string sourceArchiveFileName, string destinationDirectoryName); + void ExtractToDirectory(string sourceArchiveFileName, string destinationDirectoryName, System.Text.Encoding? entryNameEncoding); + Testably.Abstractions.IZipArchive Open(string archiveFileName, System.IO.Compression.ZipArchiveMode mode); + Testably.Abstractions.IZipArchive Open(string archiveFileName, System.IO.Compression.ZipArchiveMode mode, System.Text.Encoding? entryNameEncoding); + Testably.Abstractions.IZipArchive OpenRead(string archiveFileName); + } +} \ No newline at end of file diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Compression_netstandard2.1.txt b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Compression_netstandard2.1.txt new file mode 100644 index 000000000..cb758e33f --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Compression_netstandard2.1.txt @@ -0,0 +1,58 @@ +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/Testably/Testably.Abstractions.git")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Testably.Abstractions.Compression.Tests")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName=".NET Standard 2.1")] +namespace Testably.Abstractions +{ + public static class FileSystemExtensions + { + public static Testably.Abstractions.IZipArchiveFactory ZipArchive(this System.IO.Abstractions.IFileSystem fileSystem) { } + public static Testably.Abstractions.IZipFile ZipFile(this System.IO.Abstractions.IFileSystem fileSystem) { } + } + public interface IZipArchive : System.IDisposable, System.IO.Abstractions.IFileSystemEntity + { + System.Collections.ObjectModel.ReadOnlyCollection Entries { get; } + System.IO.Compression.ZipArchiveMode Mode { get; } + Testably.Abstractions.IZipArchiveEntry CreateEntry(string entryName); + Testably.Abstractions.IZipArchiveEntry CreateEntry(string entryName, System.IO.Compression.CompressionLevel compressionLevel); + Testably.Abstractions.IZipArchiveEntry CreateEntryFromFile(string sourceFileName, string entryName); + Testably.Abstractions.IZipArchiveEntry CreateEntryFromFile(string sourceFileName, string entryName, System.IO.Compression.CompressionLevel compressionLevel); + void ExtractToDirectory(string destinationDirectoryName); + void ExtractToDirectory(string destinationDirectoryName, bool overwriteFiles); + Testably.Abstractions.IZipArchiveEntry? GetEntry(string entryName); + } + public interface IZipArchiveEntry : System.IO.Abstractions.IFileSystemEntity + { + Testably.Abstractions.IZipArchive Archive { get; } + long CompressedLength { get; } + uint Crc32 { get; } + int ExternalAttributes { get; set; } + string FullName { get; } + System.DateTimeOffset LastWriteTime { get; set; } + long Length { get; } + string Name { get; } + void Delete(); + void ExtractToFile(string destinationFileName); + void ExtractToFile(string destinationFileName, bool overwrite); + System.IO.Stream Open(); + } + public interface IZipArchiveFactory : System.IO.Abstractions.IFileSystemEntity + { + Testably.Abstractions.IZipArchive New(System.IO.Stream stream); + Testably.Abstractions.IZipArchive New(System.IO.Stream stream, System.IO.Compression.ZipArchiveMode mode); + Testably.Abstractions.IZipArchive New(System.IO.Stream stream, System.IO.Compression.ZipArchiveMode mode, bool leaveOpen); + Testably.Abstractions.IZipArchive New(System.IO.Stream stream, System.IO.Compression.ZipArchiveMode mode, bool leaveOpen, System.Text.Encoding? entryNameEncoding); + } + public interface IZipFile : System.IO.Abstractions.IFileSystemEntity + { + void CreateFromDirectory(string sourceDirectoryName, string destinationArchiveFileName); + void CreateFromDirectory(string sourceDirectoryName, string destinationArchiveFileName, System.IO.Compression.CompressionLevel compressionLevel, bool includeBaseDirectory); + void CreateFromDirectory(string sourceDirectoryName, string destinationArchiveFileName, System.IO.Compression.CompressionLevel compressionLevel, bool includeBaseDirectory, System.Text.Encoding entryNameEncoding); + void ExtractToDirectory(string sourceArchiveFileName, string destinationDirectoryName); + void ExtractToDirectory(string sourceArchiveFileName, string destinationDirectoryName, bool overwriteFiles); + void ExtractToDirectory(string sourceArchiveFileName, string destinationDirectoryName, System.Text.Encoding? entryNameEncoding); + void ExtractToDirectory(string sourceArchiveFileName, string destinationDirectoryName, System.Text.Encoding? entryNameEncoding, bool overwriteFiles); + Testably.Abstractions.IZipArchive Open(string archiveFileName, System.IO.Compression.ZipArchiveMode mode); + Testably.Abstractions.IZipArchive Open(string archiveFileName, System.IO.Compression.ZipArchiveMode mode, System.Text.Encoding? entryNameEncoding); + Testably.Abstractions.IZipArchive OpenRead(string archiveFileName); + } +} \ No newline at end of file diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Interface_net6.0.txt b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Interface_net6.0.txt new file mode 100644 index 000000000..1d027049c --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Interface_net6.0.txt @@ -0,0 +1,195 @@ +[assembly: System.CLSCompliant(true)] +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/Testably/Testably.Abstractions.git")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName=".NET 6.0")] +namespace Testably.Abstractions.Helpers +{ + public abstract class GuidSystemBase : Testably.Abstractions.RandomSystem.IGuid, Testably.Abstractions.RandomSystem.IRandomSystemEntity + { + protected GuidSystemBase(Testably.Abstractions.IRandomSystem randomSystem) { } + public System.Guid Empty { get; } + public Testably.Abstractions.IRandomSystem RandomSystem { get; } + public abstract System.Guid NewGuid(); + public System.Guid Parse(System.ReadOnlySpan input) { } + public System.Guid Parse(string input) { } + public System.Guid ParseExact(System.ReadOnlySpan input, System.ReadOnlySpan format) { } + public System.Guid ParseExact(string input, string format) { } + public bool TryParse(System.ReadOnlySpan input, out System.Guid result) { } + public bool TryParse(string? input, out System.Guid result) { } + public bool TryParseExact(System.ReadOnlySpan input, System.ReadOnlySpan format, out System.Guid result) { } + public bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? input, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? format, out System.Guid result) { } + } + public interface IFileSystemExtensibility + { + T? RetrieveMetadata(string key); + void StoreMetadata(string key, T? value); + bool TryGetWrappedInstance([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? wrappedInstance); + } + public abstract class PathSystemBase : System.IO.Abstractions.IFileSystemEntity, System.IO.Abstractions.IPath + { + protected PathSystemBase(System.IO.Abstractions.IFileSystem fileSystem) { } + public virtual char AltDirectorySeparatorChar { get; } + public virtual char DirectorySeparatorChar { get; } + public System.IO.Abstractions.IFileSystem FileSystem { get; } + public virtual char PathSeparator { get; } + public virtual char VolumeSeparatorChar { get; } + [return: System.Diagnostics.CodeAnalysis.NotNullIfNotNull("path")] + public virtual string? ChangeExtension(string? path, string? extension) { } + public virtual string Combine(params string[] paths) { } + public virtual string Combine(string path1, string path2) { } + public virtual string Combine(string path1, string path2, string path3) { } + public virtual string Combine(string path1, string path2, string path3, string path4) { } + public virtual bool EndsInDirectorySeparator(System.ReadOnlySpan path) { } + public virtual bool EndsInDirectorySeparator(string path) { } + public virtual System.ReadOnlySpan GetDirectoryName(System.ReadOnlySpan path) { } + public virtual string? GetDirectoryName(string? path) { } + public virtual System.ReadOnlySpan GetExtension(System.ReadOnlySpan path) { } + [return: System.Diagnostics.CodeAnalysis.NotNullIfNotNull("path")] + public virtual string? GetExtension(string? path) { } + public virtual System.ReadOnlySpan GetFileName(System.ReadOnlySpan path) { } + [return: System.Diagnostics.CodeAnalysis.NotNullIfNotNull("path")] + public virtual string? GetFileName(string? path) { } + public virtual System.ReadOnlySpan GetFileNameWithoutExtension(System.ReadOnlySpan path) { } + [return: System.Diagnostics.CodeAnalysis.NotNullIfNotNull("path")] + public virtual string? GetFileNameWithoutExtension(string? path) { } + public virtual string GetFullPath(string path) { } + public virtual string GetFullPath(string path, string basePath) { } + public virtual char[] GetInvalidFileNameChars() { } + public virtual char[] GetInvalidPathChars() { } + public virtual System.ReadOnlySpan GetPathRoot(System.ReadOnlySpan path) { } + public virtual string? GetPathRoot(string? path) { } + public virtual string GetRandomFileName() { } + public virtual string GetRelativePath(string relativeTo, string path) { } + [System.Obsolete("Insecure temporary file creation methods should not be used. Use `Path.Combine(Pa" + + "th.GetTempPath(), Path.GetRandomFileName())` instead.")] + public virtual string GetTempFileName() { } + public virtual string GetTempPath() { } + public virtual bool HasExtension(System.ReadOnlySpan path) { } + public virtual bool HasExtension([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? path) { } + public virtual bool IsPathFullyQualified(System.ReadOnlySpan path) { } + public virtual bool IsPathFullyQualified(string path) { } + public virtual bool IsPathRooted(System.ReadOnlySpan path) { } + public virtual bool IsPathRooted(string? path) { } + public virtual string Join(params string?[] paths) { } + public virtual string Join(System.ReadOnlySpan path1, System.ReadOnlySpan path2) { } + public virtual string Join(string? path1, string? path2) { } + public virtual string Join(System.ReadOnlySpan path1, System.ReadOnlySpan path2, System.ReadOnlySpan path3) { } + public virtual string Join(string? path1, string? path2, string? path3) { } + public virtual string Join(System.ReadOnlySpan path1, System.ReadOnlySpan path2, System.ReadOnlySpan path3, System.ReadOnlySpan path4) { } + public virtual string Join(string? path1, string? path2, string? path3, string? path4) { } + public virtual System.ReadOnlySpan TrimEndingDirectorySeparator(System.ReadOnlySpan path) { } + public virtual string TrimEndingDirectorySeparator(string path) { } + public virtual bool TryJoin(System.ReadOnlySpan path1, System.ReadOnlySpan path2, System.Span destination, out int charsWritten) { } + public virtual bool TryJoin(System.ReadOnlySpan path1, System.ReadOnlySpan path2, System.ReadOnlySpan path3, System.Span destination, out int charsWritten) { } + } + public sealed class RandomWrapper : Testably.Abstractions.RandomSystem.IRandom + { + public RandomWrapper(System.Random instance) { } + public int Next() { } + public int Next(int maxValue) { } + public int Next(int minValue, int maxValue) { } + public void NextBytes(byte[] buffer) { } + public void NextBytes(System.Span buffer) { } + public double NextDouble() { } + public long NextInt64() { } + public long NextInt64(long maxValue) { } + public long NextInt64(long minValue, long maxValue) { } + public float NextSingle() { } + } +} +namespace Testably.Abstractions +{ + public interface IRandomSystem + { + Testably.Abstractions.RandomSystem.IGuid Guid { get; } + Testably.Abstractions.RandomSystem.IRandomFactory Random { get; } + } + public interface ITimeSystem + { + Testably.Abstractions.TimeSystem.IDateTime DateTime { get; } + Testably.Abstractions.TimeSystem.ITask Task { get; } + Testably.Abstractions.TimeSystem.IThread Thread { get; } + Testably.Abstractions.TimeSystem.ITimerFactory Timer { get; } + } +} +namespace Testably.Abstractions.RandomSystem +{ + public interface IGuid : Testably.Abstractions.RandomSystem.IRandomSystemEntity + { + System.Guid Empty { get; } + System.Guid NewGuid(); + System.Guid Parse(System.ReadOnlySpan input); + System.Guid Parse(string input); + System.Guid ParseExact(System.ReadOnlySpan input, System.ReadOnlySpan format); + System.Guid ParseExact(string input, string format); + bool TryParse(System.ReadOnlySpan input, out System.Guid result); + bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? input, out System.Guid result); + bool TryParseExact(System.ReadOnlySpan input, System.ReadOnlySpan format, out System.Guid result); + bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? input, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? format, out System.Guid result); + } + public interface IRandom + { + int Next(); + int Next(int maxValue); + int Next(int minValue, int maxValue); + void NextBytes(byte[] buffer); + void NextBytes(System.Span buffer); + double NextDouble(); + long NextInt64(); + long NextInt64(long maxValue); + long NextInt64(long minValue, long maxValue); + float NextSingle(); + } + public interface IRandomFactory : Testably.Abstractions.RandomSystem.IRandomSystemEntity + { + Testably.Abstractions.RandomSystem.IRandom Shared { get; } + Testably.Abstractions.RandomSystem.IRandom New(); + Testably.Abstractions.RandomSystem.IRandom New(int seed); + } + public interface IRandomSystemEntity + { + Testably.Abstractions.IRandomSystem RandomSystem { get; } + } +} +namespace Testably.Abstractions.TimeSystem +{ + public interface IDateTime : Testably.Abstractions.TimeSystem.ITimeSystemEntity + { + System.DateTime MaxValue { get; } + System.DateTime MinValue { get; } + System.DateTime Now { get; } + System.DateTime Today { get; } + System.DateTime UnixEpoch { get; } + System.DateTime UtcNow { get; } + } + public interface ITask : Testably.Abstractions.TimeSystem.ITimeSystemEntity + { + System.Threading.Tasks.Task Delay(int millisecondsDelay); + System.Threading.Tasks.Task Delay(System.TimeSpan delay); + System.Threading.Tasks.Task Delay(int millisecondsDelay, System.Threading.CancellationToken cancellationToken); + System.Threading.Tasks.Task Delay(System.TimeSpan delay, System.Threading.CancellationToken cancellationToken); + } + public interface IThread : Testably.Abstractions.TimeSystem.ITimeSystemEntity + { + void Sleep(int millisecondsTimeout); + void Sleep(System.TimeSpan timeout); + } + public interface ITimeSystemEntity + { + Testably.Abstractions.ITimeSystem TimeSystem { get; } + } + public interface ITimer : System.IAsyncDisposable, System.IDisposable, Testably.Abstractions.TimeSystem.ITimeSystemEntity + { + bool Change(int dueTime, int period); + bool Change(long dueTime, long period); + bool Change(System.TimeSpan dueTime, System.TimeSpan period); + bool Dispose(System.Threading.WaitHandle notifyObject); + } + public interface ITimerFactory : Testably.Abstractions.TimeSystem.ITimeSystemEntity + { + Testably.Abstractions.TimeSystem.ITimer New(System.Threading.TimerCallback callback); + Testably.Abstractions.TimeSystem.ITimer New(System.Threading.TimerCallback callback, object? state, int dueTime, int period); + Testably.Abstractions.TimeSystem.ITimer New(System.Threading.TimerCallback callback, object? state, long dueTime, long period); + Testably.Abstractions.TimeSystem.ITimer New(System.Threading.TimerCallback callback, object? state, System.TimeSpan dueTime, System.TimeSpan period); + Testably.Abstractions.TimeSystem.ITimer Wrap(System.Threading.Timer timer); + } +} \ No newline at end of file diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Interface_net7.0.txt b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Interface_net7.0.txt new file mode 100644 index 000000000..275897c47 --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Interface_net7.0.txt @@ -0,0 +1,204 @@ +[assembly: System.CLSCompliant(true)] +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/Testably/Testably.Abstractions.git")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v7.0", FrameworkDisplayName=".NET 7.0")] +namespace Testably.Abstractions.Helpers +{ + public abstract class GuidSystemBase : Testably.Abstractions.RandomSystem.IGuid, Testably.Abstractions.RandomSystem.IRandomSystemEntity + { + protected GuidSystemBase(Testably.Abstractions.IRandomSystem randomSystem) { } + public System.Guid Empty { get; } + public Testably.Abstractions.IRandomSystem RandomSystem { get; } + public abstract System.Guid NewGuid(); + public System.Guid Parse(System.ReadOnlySpan input) { } + public System.Guid Parse(string input) { } + public System.Guid Parse(System.ReadOnlySpan s, System.IFormatProvider? provider) { } + public System.Guid Parse(string s, System.IFormatProvider? provider) { } + public System.Guid ParseExact(System.ReadOnlySpan input, System.ReadOnlySpan format) { } + public System.Guid ParseExact(string input, string format) { } + public bool TryParse(System.ReadOnlySpan input, out System.Guid result) { } + public bool TryParse(string? input, out System.Guid result) { } + public bool TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out System.Guid result) { } + public bool TryParse(string? s, System.IFormatProvider? provider, out System.Guid result) { } + public bool TryParseExact(System.ReadOnlySpan input, System.ReadOnlySpan format, out System.Guid result) { } + public bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? input, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? format, out System.Guid result) { } + } + public interface IFileSystemExtensibility + { + T? RetrieveMetadata(string key); + void StoreMetadata(string key, T? value); + bool TryGetWrappedInstance([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? wrappedInstance); + } + public abstract class PathSystemBase : System.IO.Abstractions.IFileSystemEntity, System.IO.Abstractions.IPath + { + protected PathSystemBase(System.IO.Abstractions.IFileSystem fileSystem) { } + public virtual char AltDirectorySeparatorChar { get; } + public virtual char DirectorySeparatorChar { get; } + public System.IO.Abstractions.IFileSystem FileSystem { get; } + public virtual char PathSeparator { get; } + public virtual char VolumeSeparatorChar { get; } + [return: System.Diagnostics.CodeAnalysis.NotNullIfNotNull("path")] + public virtual string? ChangeExtension(string? path, string? extension) { } + public virtual string Combine(params string[] paths) { } + public virtual string Combine(string path1, string path2) { } + public virtual string Combine(string path1, string path2, string path3) { } + public virtual string Combine(string path1, string path2, string path3, string path4) { } + public virtual bool EndsInDirectorySeparator(System.ReadOnlySpan path) { } + public virtual bool EndsInDirectorySeparator(string path) { } + public abstract bool Exists([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? path); + public virtual System.ReadOnlySpan GetDirectoryName(System.ReadOnlySpan path) { } + public virtual string? GetDirectoryName(string? path) { } + public virtual System.ReadOnlySpan GetExtension(System.ReadOnlySpan path) { } + [return: System.Diagnostics.CodeAnalysis.NotNullIfNotNull("path")] + public virtual string? GetExtension(string? path) { } + public virtual System.ReadOnlySpan GetFileName(System.ReadOnlySpan path) { } + [return: System.Diagnostics.CodeAnalysis.NotNullIfNotNull("path")] + public virtual string? GetFileName(string? path) { } + public virtual System.ReadOnlySpan GetFileNameWithoutExtension(System.ReadOnlySpan path) { } + [return: System.Diagnostics.CodeAnalysis.NotNullIfNotNull("path")] + public virtual string? GetFileNameWithoutExtension(string? path) { } + public virtual string GetFullPath(string path) { } + public virtual string GetFullPath(string path, string basePath) { } + public virtual char[] GetInvalidFileNameChars() { } + public virtual char[] GetInvalidPathChars() { } + public virtual System.ReadOnlySpan GetPathRoot(System.ReadOnlySpan path) { } + public virtual string? GetPathRoot(string? path) { } + public virtual string GetRandomFileName() { } + public virtual string GetRelativePath(string relativeTo, string path) { } + [System.Obsolete("Insecure temporary file creation methods should not be used. Use `Path.Combine(Pa" + + "th.GetTempPath(), Path.GetRandomFileName())` instead.")] + public virtual string GetTempFileName() { } + public virtual string GetTempPath() { } + public virtual bool HasExtension(System.ReadOnlySpan path) { } + public virtual bool HasExtension([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? path) { } + public virtual bool IsPathFullyQualified(System.ReadOnlySpan path) { } + public virtual bool IsPathFullyQualified(string path) { } + public virtual bool IsPathRooted(System.ReadOnlySpan path) { } + public virtual bool IsPathRooted(string? path) { } + public virtual string Join(params string?[] paths) { } + public virtual string Join(System.ReadOnlySpan path1, System.ReadOnlySpan path2) { } + public virtual string Join(string? path1, string? path2) { } + public virtual string Join(System.ReadOnlySpan path1, System.ReadOnlySpan path2, System.ReadOnlySpan path3) { } + public virtual string Join(string? path1, string? path2, string? path3) { } + public virtual string Join(System.ReadOnlySpan path1, System.ReadOnlySpan path2, System.ReadOnlySpan path3, System.ReadOnlySpan path4) { } + public virtual string Join(string? path1, string? path2, string? path3, string? path4) { } + public virtual System.ReadOnlySpan TrimEndingDirectorySeparator(System.ReadOnlySpan path) { } + public virtual string TrimEndingDirectorySeparator(string path) { } + public virtual bool TryJoin(System.ReadOnlySpan path1, System.ReadOnlySpan path2, System.Span destination, out int charsWritten) { } + public virtual bool TryJoin(System.ReadOnlySpan path1, System.ReadOnlySpan path2, System.ReadOnlySpan path3, System.Span destination, out int charsWritten) { } + } + public sealed class RandomWrapper : Testably.Abstractions.RandomSystem.IRandom + { + public RandomWrapper(System.Random instance) { } + public int Next() { } + public int Next(int maxValue) { } + public int Next(int minValue, int maxValue) { } + public void NextBytes(byte[] buffer) { } + public void NextBytes(System.Span buffer) { } + public double NextDouble() { } + public long NextInt64() { } + public long NextInt64(long maxValue) { } + public long NextInt64(long minValue, long maxValue) { } + public float NextSingle() { } + } +} +namespace Testably.Abstractions +{ + public interface IRandomSystem + { + Testably.Abstractions.RandomSystem.IGuid Guid { get; } + Testably.Abstractions.RandomSystem.IRandomFactory Random { get; } + } + public interface ITimeSystem + { + Testably.Abstractions.TimeSystem.IDateTime DateTime { get; } + Testably.Abstractions.TimeSystem.ITask Task { get; } + Testably.Abstractions.TimeSystem.IThread Thread { get; } + Testably.Abstractions.TimeSystem.ITimerFactory Timer { get; } + } +} +namespace Testably.Abstractions.RandomSystem +{ + public interface IGuid : Testably.Abstractions.RandomSystem.IRandomSystemEntity + { + System.Guid Empty { get; } + System.Guid NewGuid(); + System.Guid Parse(System.ReadOnlySpan input); + System.Guid Parse(string input); + System.Guid Parse(System.ReadOnlySpan s, System.IFormatProvider? provider); + System.Guid Parse(string s, System.IFormatProvider? provider); + System.Guid ParseExact(System.ReadOnlySpan input, System.ReadOnlySpan format); + System.Guid ParseExact(string input, string format); + bool TryParse(System.ReadOnlySpan input, out System.Guid result); + bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? input, out System.Guid result); + bool TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out System.Guid result); + bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? s, System.IFormatProvider? provider, out System.Guid result); + bool TryParseExact(System.ReadOnlySpan input, System.ReadOnlySpan format, out System.Guid result); + bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? input, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? format, out System.Guid result); + } + public interface IRandom + { + int Next(); + int Next(int maxValue); + int Next(int minValue, int maxValue); + void NextBytes(byte[] buffer); + void NextBytes(System.Span buffer); + double NextDouble(); + long NextInt64(); + long NextInt64(long maxValue); + long NextInt64(long minValue, long maxValue); + float NextSingle(); + } + public interface IRandomFactory : Testably.Abstractions.RandomSystem.IRandomSystemEntity + { + Testably.Abstractions.RandomSystem.IRandom Shared { get; } + Testably.Abstractions.RandomSystem.IRandom New(); + Testably.Abstractions.RandomSystem.IRandom New(int seed); + } + public interface IRandomSystemEntity + { + Testably.Abstractions.IRandomSystem RandomSystem { get; } + } +} +namespace Testably.Abstractions.TimeSystem +{ + public interface IDateTime : Testably.Abstractions.TimeSystem.ITimeSystemEntity + { + System.DateTime MaxValue { get; } + System.DateTime MinValue { get; } + System.DateTime Now { get; } + System.DateTime Today { get; } + System.DateTime UnixEpoch { get; } + System.DateTime UtcNow { get; } + } + public interface ITask : Testably.Abstractions.TimeSystem.ITimeSystemEntity + { + System.Threading.Tasks.Task Delay(int millisecondsDelay); + System.Threading.Tasks.Task Delay(System.TimeSpan delay); + System.Threading.Tasks.Task Delay(int millisecondsDelay, System.Threading.CancellationToken cancellationToken); + System.Threading.Tasks.Task Delay(System.TimeSpan delay, System.Threading.CancellationToken cancellationToken); + } + public interface IThread : Testably.Abstractions.TimeSystem.ITimeSystemEntity + { + void Sleep(int millisecondsTimeout); + void Sleep(System.TimeSpan timeout); + } + public interface ITimeSystemEntity + { + Testably.Abstractions.ITimeSystem TimeSystem { get; } + } + public interface ITimer : System.IAsyncDisposable, System.IDisposable, Testably.Abstractions.TimeSystem.ITimeSystemEntity + { + bool Change(int dueTime, int period); + bool Change(long dueTime, long period); + bool Change(System.TimeSpan dueTime, System.TimeSpan period); + bool Dispose(System.Threading.WaitHandle notifyObject); + } + public interface ITimerFactory : Testably.Abstractions.TimeSystem.ITimeSystemEntity + { + Testably.Abstractions.TimeSystem.ITimer New(System.Threading.TimerCallback callback); + Testably.Abstractions.TimeSystem.ITimer New(System.Threading.TimerCallback callback, object? state, int dueTime, int period); + Testably.Abstractions.TimeSystem.ITimer New(System.Threading.TimerCallback callback, object? state, long dueTime, long period); + Testably.Abstractions.TimeSystem.ITimer New(System.Threading.TimerCallback callback, object? state, System.TimeSpan dueTime, System.TimeSpan period); + Testably.Abstractions.TimeSystem.ITimer Wrap(System.Threading.Timer timer); + } +} \ No newline at end of file diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Interface_net8.0.txt b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Interface_net8.0.txt new file mode 100644 index 000000000..dd2048a37 --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Interface_net8.0.txt @@ -0,0 +1,214 @@ +[assembly: System.CLSCompliant(true)] +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/Testably/Testably.Abstractions.git")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName=".NET 8.0")] +namespace Testably.Abstractions.Helpers +{ + public abstract class GuidSystemBase : Testably.Abstractions.RandomSystem.IGuid, Testably.Abstractions.RandomSystem.IRandomSystemEntity + { + protected GuidSystemBase(Testably.Abstractions.IRandomSystem randomSystem) { } + public System.Guid Empty { get; } + public Testably.Abstractions.IRandomSystem RandomSystem { get; } + public abstract System.Guid NewGuid(); + public System.Guid Parse(System.ReadOnlySpan input) { } + public System.Guid Parse(string input) { } + public System.Guid Parse(System.ReadOnlySpan s, System.IFormatProvider? provider) { } + public System.Guid Parse(string s, System.IFormatProvider? provider) { } + public System.Guid ParseExact(System.ReadOnlySpan input, System.ReadOnlySpan format) { } + public System.Guid ParseExact(string input, string format) { } + public bool TryParse(System.ReadOnlySpan input, out System.Guid result) { } + public bool TryParse(string? input, out System.Guid result) { } + public bool TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out System.Guid result) { } + public bool TryParse(string? s, System.IFormatProvider? provider, out System.Guid result) { } + public bool TryParseExact(System.ReadOnlySpan input, System.ReadOnlySpan format, out System.Guid result) { } + public bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? input, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? format, out System.Guid result) { } + } + public interface IFileSystemExtensibility + { + T? RetrieveMetadata(string key); + void StoreMetadata(string key, T? value); + bool TryGetWrappedInstance([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? wrappedInstance); + } + public abstract class PathSystemBase : System.IO.Abstractions.IFileSystemEntity, System.IO.Abstractions.IPath + { + protected PathSystemBase(System.IO.Abstractions.IFileSystem fileSystem) { } + public virtual char AltDirectorySeparatorChar { get; } + public virtual char DirectorySeparatorChar { get; } + public System.IO.Abstractions.IFileSystem FileSystem { get; } + public virtual char PathSeparator { get; } + public virtual char VolumeSeparatorChar { get; } + [return: System.Diagnostics.CodeAnalysis.NotNullIfNotNull("path")] + public virtual string? ChangeExtension(string? path, string? extension) { } + public virtual string Combine(params string[] paths) { } + public virtual string Combine(string path1, string path2) { } + public virtual string Combine(string path1, string path2, string path3) { } + public virtual string Combine(string path1, string path2, string path3, string path4) { } + public virtual bool EndsInDirectorySeparator(System.ReadOnlySpan path) { } + public virtual bool EndsInDirectorySeparator(string path) { } + public abstract bool Exists([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? path); + public virtual System.ReadOnlySpan GetDirectoryName(System.ReadOnlySpan path) { } + public virtual string? GetDirectoryName(string? path) { } + public virtual System.ReadOnlySpan GetExtension(System.ReadOnlySpan path) { } + [return: System.Diagnostics.CodeAnalysis.NotNullIfNotNull("path")] + public virtual string? GetExtension(string? path) { } + public virtual System.ReadOnlySpan GetFileName(System.ReadOnlySpan path) { } + [return: System.Diagnostics.CodeAnalysis.NotNullIfNotNull("path")] + public virtual string? GetFileName(string? path) { } + public virtual System.ReadOnlySpan GetFileNameWithoutExtension(System.ReadOnlySpan path) { } + [return: System.Diagnostics.CodeAnalysis.NotNullIfNotNull("path")] + public virtual string? GetFileNameWithoutExtension(string? path) { } + public virtual string GetFullPath(string path) { } + public virtual string GetFullPath(string path, string basePath) { } + public virtual char[] GetInvalidFileNameChars() { } + public virtual char[] GetInvalidPathChars() { } + public virtual System.ReadOnlySpan GetPathRoot(System.ReadOnlySpan path) { } + public virtual string? GetPathRoot(string? path) { } + public virtual string GetRandomFileName() { } + public virtual string GetRelativePath(string relativeTo, string path) { } + [System.Obsolete("Insecure temporary file creation methods should not be used. Use `Path.Combine(Pa" + + "th.GetTempPath(), Path.GetRandomFileName())` instead.")] + public virtual string GetTempFileName() { } + public virtual string GetTempPath() { } + public virtual bool HasExtension(System.ReadOnlySpan path) { } + public virtual bool HasExtension([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? path) { } + public virtual bool IsPathFullyQualified(System.ReadOnlySpan path) { } + public virtual bool IsPathFullyQualified(string path) { } + public virtual bool IsPathRooted(System.ReadOnlySpan path) { } + public virtual bool IsPathRooted(string? path) { } + public virtual string Join(params string?[] paths) { } + public virtual string Join(System.ReadOnlySpan path1, System.ReadOnlySpan path2) { } + public virtual string Join(string? path1, string? path2) { } + public virtual string Join(System.ReadOnlySpan path1, System.ReadOnlySpan path2, System.ReadOnlySpan path3) { } + public virtual string Join(string? path1, string? path2, string? path3) { } + public virtual string Join(System.ReadOnlySpan path1, System.ReadOnlySpan path2, System.ReadOnlySpan path3, System.ReadOnlySpan path4) { } + public virtual string Join(string? path1, string? path2, string? path3, string? path4) { } + public virtual System.ReadOnlySpan TrimEndingDirectorySeparator(System.ReadOnlySpan path) { } + public virtual string TrimEndingDirectorySeparator(string path) { } + public virtual bool TryJoin(System.ReadOnlySpan path1, System.ReadOnlySpan path2, System.Span destination, out int charsWritten) { } + public virtual bool TryJoin(System.ReadOnlySpan path1, System.ReadOnlySpan path2, System.ReadOnlySpan path3, System.Span destination, out int charsWritten) { } + } + public sealed class RandomWrapper : Testably.Abstractions.RandomSystem.IRandom + { + public RandomWrapper(System.Random instance) { } + public T[] GetItems(System.ReadOnlySpan choices, int length) { } + public void GetItems(System.ReadOnlySpan choices, System.Span destination) { } + public T[] GetItems(T[] choices, int length) { } + public int Next() { } + public int Next(int maxValue) { } + public int Next(int minValue, int maxValue) { } + public void NextBytes(byte[] buffer) { } + public void NextBytes(System.Span buffer) { } + public double NextDouble() { } + public long NextInt64() { } + public long NextInt64(long maxValue) { } + public long NextInt64(long minValue, long maxValue) { } + public float NextSingle() { } + public void Shuffle(System.Span values) { } + public void Shuffle(T[] values) { } + } +} +namespace Testably.Abstractions +{ + public interface IRandomSystem + { + Testably.Abstractions.RandomSystem.IGuid Guid { get; } + Testably.Abstractions.RandomSystem.IRandomFactory Random { get; } + } + public interface ITimeSystem + { + Testably.Abstractions.TimeSystem.IDateTime DateTime { get; } + Testably.Abstractions.TimeSystem.ITask Task { get; } + Testably.Abstractions.TimeSystem.IThread Thread { get; } + Testably.Abstractions.TimeSystem.ITimerFactory Timer { get; } + } +} +namespace Testably.Abstractions.RandomSystem +{ + public interface IGuid : Testably.Abstractions.RandomSystem.IRandomSystemEntity + { + System.Guid Empty { get; } + System.Guid NewGuid(); + System.Guid Parse(System.ReadOnlySpan input); + System.Guid Parse(string input); + System.Guid Parse(System.ReadOnlySpan s, System.IFormatProvider? provider); + System.Guid Parse(string s, System.IFormatProvider? provider); + System.Guid ParseExact(System.ReadOnlySpan input, System.ReadOnlySpan format); + System.Guid ParseExact(string input, string format); + bool TryParse(System.ReadOnlySpan input, out System.Guid result); + bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? input, out System.Guid result); + bool TryParse(System.ReadOnlySpan s, System.IFormatProvider? provider, out System.Guid result); + bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? s, System.IFormatProvider? provider, out System.Guid result); + bool TryParseExact(System.ReadOnlySpan input, System.ReadOnlySpan format, out System.Guid result); + bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? input, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? format, out System.Guid result); + } + public interface IRandom + { + T[] GetItems(System.ReadOnlySpan choices, int length); + void GetItems(System.ReadOnlySpan choices, System.Span destination); + T[] GetItems(T[] choices, int length); + int Next(); + int Next(int maxValue); + int Next(int minValue, int maxValue); + void NextBytes(byte[] buffer); + void NextBytes(System.Span buffer); + double NextDouble(); + long NextInt64(); + long NextInt64(long maxValue); + long NextInt64(long minValue, long maxValue); + float NextSingle(); + void Shuffle(System.Span values); + void Shuffle(T[] values); + } + public interface IRandomFactory : Testably.Abstractions.RandomSystem.IRandomSystemEntity + { + Testably.Abstractions.RandomSystem.IRandom Shared { get; } + Testably.Abstractions.RandomSystem.IRandom New(); + Testably.Abstractions.RandomSystem.IRandom New(int seed); + } + public interface IRandomSystemEntity + { + Testably.Abstractions.IRandomSystem RandomSystem { get; } + } +} +namespace Testably.Abstractions.TimeSystem +{ + public interface IDateTime : Testably.Abstractions.TimeSystem.ITimeSystemEntity + { + System.DateTime MaxValue { get; } + System.DateTime MinValue { get; } + System.DateTime Now { get; } + System.DateTime Today { get; } + System.DateTime UnixEpoch { get; } + System.DateTime UtcNow { get; } + } + public interface ITask : Testably.Abstractions.TimeSystem.ITimeSystemEntity + { + System.Threading.Tasks.Task Delay(int millisecondsDelay); + System.Threading.Tasks.Task Delay(System.TimeSpan delay); + System.Threading.Tasks.Task Delay(int millisecondsDelay, System.Threading.CancellationToken cancellationToken); + System.Threading.Tasks.Task Delay(System.TimeSpan delay, System.Threading.CancellationToken cancellationToken); + } + public interface IThread : Testably.Abstractions.TimeSystem.ITimeSystemEntity + { + void Sleep(int millisecondsTimeout); + void Sleep(System.TimeSpan timeout); + } + public interface ITimeSystemEntity + { + Testably.Abstractions.ITimeSystem TimeSystem { get; } + } + public interface ITimer : System.IAsyncDisposable, System.IDisposable, Testably.Abstractions.TimeSystem.ITimeSystemEntity + { + bool Change(int dueTime, int period); + bool Change(long dueTime, long period); + bool Change(System.TimeSpan dueTime, System.TimeSpan period); + bool Dispose(System.Threading.WaitHandle notifyObject); + } + public interface ITimerFactory : Testably.Abstractions.TimeSystem.ITimeSystemEntity + { + Testably.Abstractions.TimeSystem.ITimer New(System.Threading.TimerCallback callback); + Testably.Abstractions.TimeSystem.ITimer New(System.Threading.TimerCallback callback, object? state, int dueTime, int period); + Testably.Abstractions.TimeSystem.ITimer New(System.Threading.TimerCallback callback, object? state, long dueTime, long period); + Testably.Abstractions.TimeSystem.ITimer New(System.Threading.TimerCallback callback, object? state, System.TimeSpan dueTime, System.TimeSpan period); + Testably.Abstractions.TimeSystem.ITimer Wrap(System.Threading.Timer timer); + } +} \ No newline at end of file diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Interface_netstandard2.0.txt b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Interface_netstandard2.0.txt new file mode 100644 index 000000000..2856eed15 --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Interface_netstandard2.0.txt @@ -0,0 +1,152 @@ +[assembly: System.CLSCompliant(true)] +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/Testably/Testably.Abstractions.git")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName=".NET Standard 2.0")] +namespace Testably.Abstractions.Helpers +{ + public abstract class GuidSystemBase : Testably.Abstractions.RandomSystem.IGuid, Testably.Abstractions.RandomSystem.IRandomSystemEntity + { + protected GuidSystemBase(Testably.Abstractions.IRandomSystem randomSystem) { } + public System.Guid Empty { get; } + public Testably.Abstractions.IRandomSystem RandomSystem { get; } + public abstract System.Guid NewGuid(); + } + public interface IFileSystemExtensibility + { + T? RetrieveMetadata(string key); + void StoreMetadata(string key, T? value); + bool TryGetWrappedInstance([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? wrappedInstance); + } + public abstract class PathSystemBase : System.IO.Abstractions.IFileSystemEntity, System.IO.Abstractions.IPath + { + protected PathSystemBase(System.IO.Abstractions.IFileSystem fileSystem) { } + public virtual char AltDirectorySeparatorChar { get; } + public virtual char DirectorySeparatorChar { get; } + public System.IO.Abstractions.IFileSystem FileSystem { get; } + public virtual char PathSeparator { get; } + public virtual char VolumeSeparatorChar { get; } + [return: System.Diagnostics.CodeAnalysis.NotNullIfNotNull("path")] + public virtual string? ChangeExtension(string? path, string? extension) { } + public virtual string Combine(params string[] paths) { } + public virtual string Combine(string path1, string path2) { } + public virtual string Combine(string path1, string path2, string path3) { } + public virtual string Combine(string path1, string path2, string path3, string path4) { } + public virtual string? GetDirectoryName(string? path) { } + [return: System.Diagnostics.CodeAnalysis.NotNullIfNotNull("path")] + public virtual string? GetExtension(string? path) { } + [return: System.Diagnostics.CodeAnalysis.NotNullIfNotNull("path")] + public virtual string? GetFileName(string? path) { } + [return: System.Diagnostics.CodeAnalysis.NotNullIfNotNull("path")] + public virtual string? GetFileNameWithoutExtension(string? path) { } + public virtual string GetFullPath(string path) { } + public virtual char[] GetInvalidFileNameChars() { } + public virtual char[] GetInvalidPathChars() { } + public virtual string? GetPathRoot(string? path) { } + public virtual string GetRandomFileName() { } + public virtual string GetTempFileName() { } + public virtual string GetTempPath() { } + public virtual bool HasExtension([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? path) { } + public virtual bool IsPathRooted(string? path) { } + } + public sealed class RandomWrapper : Testably.Abstractions.RandomSystem.IRandom + { + public RandomWrapper(System.Random instance) { } + public int Next() { } + public int Next(int maxValue) { } + public int Next(int minValue, int maxValue) { } + public void NextBytes(byte[] buffer) { } + public double NextDouble() { } + } +} +namespace Testably.Abstractions +{ + public interface IRandomSystem + { + Testably.Abstractions.RandomSystem.IGuid Guid { get; } + Testably.Abstractions.RandomSystem.IRandomFactory Random { get; } + } + public interface ITimeSystem + { + Testably.Abstractions.TimeSystem.IDateTime DateTime { get; } + Testably.Abstractions.TimeSystem.ITask Task { get; } + Testably.Abstractions.TimeSystem.IThread Thread { get; } + Testably.Abstractions.TimeSystem.ITimerFactory Timer { get; } + } +} +namespace Testably.Abstractions.Polyfills +{ + [System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Module | System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Field | System.AttributeTargets.Event | System.AttributeTargets.Interface, AllowMultiple=true, Inherited=false)] + public sealed class SupportedOSPlatformAttribute : System.Attribute + { + public SupportedOSPlatformAttribute(string platformName) { } + public string PlatformName { get; } + } +} +namespace Testably.Abstractions.RandomSystem +{ + public interface IGuid : Testably.Abstractions.RandomSystem.IRandomSystemEntity + { + System.Guid Empty { get; } + System.Guid NewGuid(); + } + public interface IRandom + { + int Next(); + int Next(int maxValue); + int Next(int minValue, int maxValue); + void NextBytes(byte[] buffer); + double NextDouble(); + } + public interface IRandomFactory : Testably.Abstractions.RandomSystem.IRandomSystemEntity + { + Testably.Abstractions.RandomSystem.IRandom Shared { get; } + Testably.Abstractions.RandomSystem.IRandom New(); + Testably.Abstractions.RandomSystem.IRandom New(int seed); + } + public interface IRandomSystemEntity + { + Testably.Abstractions.IRandomSystem RandomSystem { get; } + } +} +namespace Testably.Abstractions.TimeSystem +{ + public interface IDateTime : Testably.Abstractions.TimeSystem.ITimeSystemEntity + { + System.DateTime MaxValue { get; } + System.DateTime MinValue { get; } + System.DateTime Now { get; } + System.DateTime Today { get; } + System.DateTime UnixEpoch { get; } + System.DateTime UtcNow { get; } + } + public interface ITask : Testably.Abstractions.TimeSystem.ITimeSystemEntity + { + System.Threading.Tasks.Task Delay(int millisecondsDelay); + System.Threading.Tasks.Task Delay(System.TimeSpan delay); + System.Threading.Tasks.Task Delay(int millisecondsDelay, System.Threading.CancellationToken cancellationToken); + System.Threading.Tasks.Task Delay(System.TimeSpan delay, System.Threading.CancellationToken cancellationToken); + } + public interface IThread : Testably.Abstractions.TimeSystem.ITimeSystemEntity + { + void Sleep(int millisecondsTimeout); + void Sleep(System.TimeSpan timeout); + } + public interface ITimeSystemEntity + { + Testably.Abstractions.ITimeSystem TimeSystem { get; } + } + public interface ITimer : System.IDisposable, Testably.Abstractions.TimeSystem.ITimeSystemEntity + { + bool Change(int dueTime, int period); + bool Change(long dueTime, long period); + bool Change(System.TimeSpan dueTime, System.TimeSpan period); + bool Dispose(System.Threading.WaitHandle notifyObject); + } + public interface ITimerFactory : Testably.Abstractions.TimeSystem.ITimeSystemEntity + { + Testably.Abstractions.TimeSystem.ITimer New(System.Threading.TimerCallback callback); + Testably.Abstractions.TimeSystem.ITimer New(System.Threading.TimerCallback callback, object? state, int dueTime, int period); + Testably.Abstractions.TimeSystem.ITimer New(System.Threading.TimerCallback callback, object? state, long dueTime, long period); + Testably.Abstractions.TimeSystem.ITimer New(System.Threading.TimerCallback callback, object? state, System.TimeSpan dueTime, System.TimeSpan period); + Testably.Abstractions.TimeSystem.ITimer Wrap(System.Threading.Timer timer); + } +} \ No newline at end of file diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Interface_netstandard2.1.txt b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Interface_netstandard2.1.txt new file mode 100644 index 000000000..b1da22d0d --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Interface_netstandard2.1.txt @@ -0,0 +1,187 @@ +[assembly: System.CLSCompliant(true)] +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/Testably/Testably.Abstractions.git")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName=".NET Standard 2.1")] +namespace Testably.Abstractions.Helpers +{ + public abstract class GuidSystemBase : Testably.Abstractions.RandomSystem.IGuid, Testably.Abstractions.RandomSystem.IRandomSystemEntity + { + protected GuidSystemBase(Testably.Abstractions.IRandomSystem randomSystem) { } + public System.Guid Empty { get; } + public Testably.Abstractions.IRandomSystem RandomSystem { get; } + public abstract System.Guid NewGuid(); + public System.Guid Parse(System.ReadOnlySpan input) { } + public System.Guid Parse(string input) { } + public System.Guid ParseExact(System.ReadOnlySpan input, System.ReadOnlySpan format) { } + public System.Guid ParseExact(string input, string format) { } + public bool TryParse(System.ReadOnlySpan input, out System.Guid result) { } + public bool TryParse(string? input, out System.Guid result) { } + public bool TryParseExact(System.ReadOnlySpan input, System.ReadOnlySpan format, out System.Guid result) { } + public bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? input, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? format, out System.Guid result) { } + } + public interface IFileSystemExtensibility + { + T? RetrieveMetadata(string key); + void StoreMetadata(string key, T? value); + bool TryGetWrappedInstance([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out T? wrappedInstance); + } + public abstract class PathSystemBase : System.IO.Abstractions.IFileSystemEntity, System.IO.Abstractions.IPath + { + protected PathSystemBase(System.IO.Abstractions.IFileSystem fileSystem) { } + public virtual char AltDirectorySeparatorChar { get; } + public virtual char DirectorySeparatorChar { get; } + public System.IO.Abstractions.IFileSystem FileSystem { get; } + public virtual char PathSeparator { get; } + public virtual char VolumeSeparatorChar { get; } + [return: System.Diagnostics.CodeAnalysis.NotNullIfNotNull("path")] + public virtual string? ChangeExtension(string? path, string? extension) { } + public virtual string Combine(params string[] paths) { } + public virtual string Combine(string path1, string path2) { } + public virtual string Combine(string path1, string path2, string path3) { } + public virtual string Combine(string path1, string path2, string path3, string path4) { } + public virtual System.ReadOnlySpan GetDirectoryName(System.ReadOnlySpan path) { } + public virtual string? GetDirectoryName(string? path) { } + public virtual System.ReadOnlySpan GetExtension(System.ReadOnlySpan path) { } + [return: System.Diagnostics.CodeAnalysis.NotNullIfNotNull("path")] + public virtual string? GetExtension(string? path) { } + public virtual System.ReadOnlySpan GetFileName(System.ReadOnlySpan path) { } + [return: System.Diagnostics.CodeAnalysis.NotNullIfNotNull("path")] + public virtual string? GetFileName(string? path) { } + public virtual System.ReadOnlySpan GetFileNameWithoutExtension(System.ReadOnlySpan path) { } + [return: System.Diagnostics.CodeAnalysis.NotNullIfNotNull("path")] + public virtual string? GetFileNameWithoutExtension(string? path) { } + public virtual string GetFullPath(string path) { } + public virtual string GetFullPath(string path, string basePath) { } + public virtual char[] GetInvalidFileNameChars() { } + public virtual char[] GetInvalidPathChars() { } + public virtual System.ReadOnlySpan GetPathRoot(System.ReadOnlySpan path) { } + public virtual string? GetPathRoot(string? path) { } + public virtual string GetRandomFileName() { } + public virtual string GetRelativePath(string relativeTo, string path) { } + [System.Obsolete("Insecure temporary file creation methods should not be used. Use `Path.Combine(Pa" + + "th.GetTempPath(), Path.GetRandomFileName())` instead.")] + public virtual string GetTempFileName() { } + public virtual string GetTempPath() { } + public virtual bool HasExtension(System.ReadOnlySpan path) { } + public virtual bool HasExtension([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? path) { } + public virtual bool IsPathFullyQualified(System.ReadOnlySpan path) { } + public virtual bool IsPathFullyQualified(string path) { } + public virtual bool IsPathRooted(System.ReadOnlySpan path) { } + public virtual bool IsPathRooted(string? path) { } + public virtual string Join(System.ReadOnlySpan path1, System.ReadOnlySpan path2) { } + public virtual string Join(System.ReadOnlySpan path1, System.ReadOnlySpan path2, System.ReadOnlySpan path3) { } + public virtual bool TryJoin(System.ReadOnlySpan path1, System.ReadOnlySpan path2, System.Span destination, out int charsWritten) { } + public virtual bool TryJoin(System.ReadOnlySpan path1, System.ReadOnlySpan path2, System.ReadOnlySpan path3, System.Span destination, out int charsWritten) { } + } + public sealed class RandomWrapper : Testably.Abstractions.RandomSystem.IRandom + { + public RandomWrapper(System.Random instance) { } + public int Next() { } + public int Next(int maxValue) { } + public int Next(int minValue, int maxValue) { } + public void NextBytes(byte[] buffer) { } + public void NextBytes(System.Span buffer) { } + public double NextDouble() { } + } +} +namespace Testably.Abstractions +{ + public interface IRandomSystem + { + Testably.Abstractions.RandomSystem.IGuid Guid { get; } + Testably.Abstractions.RandomSystem.IRandomFactory Random { get; } + } + public interface ITimeSystem + { + Testably.Abstractions.TimeSystem.IDateTime DateTime { get; } + Testably.Abstractions.TimeSystem.ITask Task { get; } + Testably.Abstractions.TimeSystem.IThread Thread { get; } + Testably.Abstractions.TimeSystem.ITimerFactory Timer { get; } + } +} +namespace Testably.Abstractions.Polyfills +{ + [System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Module | System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Enum | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Field | System.AttributeTargets.Event | System.AttributeTargets.Interface, AllowMultiple=true, Inherited=false)] + public sealed class SupportedOSPlatformAttribute : System.Attribute + { + public SupportedOSPlatformAttribute(string platformName) { } + public string PlatformName { get; } + } +} +namespace Testably.Abstractions.RandomSystem +{ + public interface IGuid : Testably.Abstractions.RandomSystem.IRandomSystemEntity + { + System.Guid Empty { get; } + System.Guid NewGuid(); + System.Guid Parse(System.ReadOnlySpan input); + System.Guid Parse(string input); + System.Guid ParseExact(System.ReadOnlySpan input, System.ReadOnlySpan format); + System.Guid ParseExact(string input, string format); + bool TryParse(System.ReadOnlySpan input, out System.Guid result); + bool TryParse([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? input, out System.Guid result); + bool TryParseExact(System.ReadOnlySpan input, System.ReadOnlySpan format, out System.Guid result); + bool TryParseExact([System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? input, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] string? format, out System.Guid result); + } + public interface IRandom + { + int Next(); + int Next(int maxValue); + int Next(int minValue, int maxValue); + void NextBytes(byte[] buffer); + void NextBytes(System.Span buffer); + double NextDouble(); + } + public interface IRandomFactory : Testably.Abstractions.RandomSystem.IRandomSystemEntity + { + Testably.Abstractions.RandomSystem.IRandom Shared { get; } + Testably.Abstractions.RandomSystem.IRandom New(); + Testably.Abstractions.RandomSystem.IRandom New(int seed); + } + public interface IRandomSystemEntity + { + Testably.Abstractions.IRandomSystem RandomSystem { get; } + } +} +namespace Testably.Abstractions.TimeSystem +{ + public interface IDateTime : Testably.Abstractions.TimeSystem.ITimeSystemEntity + { + System.DateTime MaxValue { get; } + System.DateTime MinValue { get; } + System.DateTime Now { get; } + System.DateTime Today { get; } + System.DateTime UnixEpoch { get; } + System.DateTime UtcNow { get; } + } + public interface ITask : Testably.Abstractions.TimeSystem.ITimeSystemEntity + { + System.Threading.Tasks.Task Delay(int millisecondsDelay); + System.Threading.Tasks.Task Delay(System.TimeSpan delay); + System.Threading.Tasks.Task Delay(int millisecondsDelay, System.Threading.CancellationToken cancellationToken); + System.Threading.Tasks.Task Delay(System.TimeSpan delay, System.Threading.CancellationToken cancellationToken); + } + public interface IThread : Testably.Abstractions.TimeSystem.ITimeSystemEntity + { + void Sleep(int millisecondsTimeout); + void Sleep(System.TimeSpan timeout); + } + public interface ITimeSystemEntity + { + Testably.Abstractions.ITimeSystem TimeSystem { get; } + } + public interface ITimer : System.IAsyncDisposable, System.IDisposable, Testably.Abstractions.TimeSystem.ITimeSystemEntity + { + bool Change(int dueTime, int period); + bool Change(long dueTime, long period); + bool Change(System.TimeSpan dueTime, System.TimeSpan period); + bool Dispose(System.Threading.WaitHandle notifyObject); + } + public interface ITimerFactory : Testably.Abstractions.TimeSystem.ITimeSystemEntity + { + Testably.Abstractions.TimeSystem.ITimer New(System.Threading.TimerCallback callback); + Testably.Abstractions.TimeSystem.ITimer New(System.Threading.TimerCallback callback, object? state, int dueTime, int period); + Testably.Abstractions.TimeSystem.ITimer New(System.Threading.TimerCallback callback, object? state, long dueTime, long period); + Testably.Abstractions.TimeSystem.ITimer New(System.Threading.TimerCallback callback, object? state, System.TimeSpan dueTime, System.TimeSpan period); + Testably.Abstractions.TimeSystem.ITimer Wrap(System.Threading.Timer timer); + } +} \ No newline at end of file diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Testing_net6.0.txt b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Testing_net6.0.txt new file mode 100644 index 000000000..6f1ca6fc6 --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Testing_net6.0.txt @@ -0,0 +1,361 @@ +[assembly: System.CLSCompliant(true)] +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/Testably/Testably.Abstractions.git")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Testably.Abstractions.Testing.Tests")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName=".NET 6.0")] +namespace Testably.Abstractions.Testing.FileSystem +{ + public class ChangeDescription + { + public System.IO.WatcherChangeTypes ChangeType { get; } + public Testably.Abstractions.Testing.FileSystemTypes FileSystemType { get; } + public string? Name { get; } + public System.IO.NotifyFilters NotifyFilters { get; } + public string? OldName { get; } + public string? OldPath { get; } + public string Path { get; } + public override string ToString() { } + } + public class DefaultAccessControlStrategy : Testably.Abstractions.Testing.FileSystem.IAccessControlStrategy + { + public DefaultAccessControlStrategy(System.Func callback) { } + public bool IsAccessGranted(string fullPath, Testably.Abstractions.Helpers.IFileSystemExtensibility extensibility) { } + } + public class DefaultSafeFileHandleStrategy : Testably.Abstractions.Testing.FileSystem.ISafeFileHandleStrategy + { + public DefaultSafeFileHandleStrategy(System.Func callback) { } + [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage(Justification="SafeFileHandle cannot be unit tested.")] + public Testably.Abstractions.Testing.FileSystem.SafeFileHandleMock MapSafeFileHandle(Microsoft.Win32.SafeHandles.SafeFileHandle fileHandle) { } + } + public interface IAccessControlStrategy + { + bool IsAccessGranted(string fullPath, Testably.Abstractions.Helpers.IFileSystemExtensibility extensibility); + } + public interface IInterceptionHandler : System.IO.Abstractions.IFileSystemEntity + { + Testably.Abstractions.Testing.MockFileSystem Event(System.Action interceptionCallback, System.Func? predicate = null); + } + public interface INotificationHandler : System.IO.Abstractions.IFileSystemEntity + { + Testably.Abstractions.Testing.Notification.IAwaitableCallback OnEvent(System.Action? notificationCallback = null, System.Func? predicate = null); + } + public interface ISafeFileHandleStrategy + { + Testably.Abstractions.Testing.FileSystem.SafeFileHandleMock MapSafeFileHandle(Microsoft.Win32.SafeHandles.SafeFileHandle fileHandle); + } + public class NullAccessControlStrategy : Testably.Abstractions.Testing.FileSystem.IAccessControlStrategy + { + public NullAccessControlStrategy() { } + public bool IsAccessGranted(string fullPath, Testably.Abstractions.Helpers.IFileSystemExtensibility extensibility) { } + } + public class NullSafeFileHandleStrategy : Testably.Abstractions.Testing.FileSystem.ISafeFileHandleStrategy + { + public NullSafeFileHandleStrategy() { } + [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage(Justification="SafeFileHandle cannot be unit tested.")] + public Testably.Abstractions.Testing.FileSystem.SafeFileHandleMock MapSafeFileHandle(Microsoft.Win32.SafeHandles.SafeFileHandle fileHandle) { } + } + public class SafeFileHandleMock + { + public SafeFileHandleMock(string path, System.IO.FileMode mode = 3, System.IO.FileShare share = 0) { } + public System.IO.FileMode Mode { get; } + public string Path { get; } + public System.IO.FileShare Share { get; } + } +} +namespace Testably.Abstractions.Testing.FileSystemInitializer +{ + public class DirectoryDescription : Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription + { + public DirectoryDescription(string name) { } + public DirectoryDescription(string name, params Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription[] children) { } + public Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription[] Children { get; } + public override Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription this[string path] { get; } + } + public class FileDescription : Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription + { + public FileDescription(string name, byte[] bytes) { } + public FileDescription(string name, string? content = null) { } + public byte[]? Bytes { get; } + public string? Content { get; } + public bool IsReadOnly { get; set; } + public override Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription this[string? path] { get; } + } + public abstract class FileSystemInfoDescription + { + protected FileSystemInfoDescription(string name) { } + public abstract Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription this[string path] { get; } + public string Name { get; } + } + public interface IDirectoryCleaner : System.IDisposable + { + string BasePath { get; } + } + public interface IFileManipulator : System.IO.Abstractions.IFileSystemEntity + { + System.IO.Abstractions.IFileInfo File { get; } + Testably.Abstractions.Testing.FileSystemInitializer.IFileManipulator HasBytesContent(byte[] bytes); + Testably.Abstractions.Testing.FileSystemInitializer.IFileManipulator HasStringContent(string contents); + } + public interface IFileSystemDirectoryInitializer : Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer + where out TFileSystem : System.IO.Abstractions.IFileSystem + { + System.IO.Abstractions.IDirectoryInfo Directory { get; } + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemDirectoryInitializer Initialized(System.Action> subdirectoryInitializer); + } + public interface IFileSystemFileInitializer : Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer + where out TFileSystem : System.IO.Abstractions.IFileSystem + { + System.IO.Abstractions.IFileInfo File { get; } + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemFileInitializer Which(System.Action fileManipulation); + } + public interface IFileSystemInitializer + where out TFileSystem : System.IO.Abstractions.IFileSystem + { + System.IO.Abstractions.IDirectoryInfo BaseDirectory { get; } + TFileSystem FileSystem { get; } + System.IO.Abstractions.IFileSystemInfo this[int index] { get; } + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer With(params Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription[] descriptions); + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer With(TDescription[] descriptions) + where TDescription : Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription; + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemFileInitializer WithAFile(string? extension = null); + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemDirectoryInitializer WithASubdirectory(); + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemFileInitializer WithFile(string fileName); + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer WithSubdirectories(params string[] paths); + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemDirectoryInitializer WithSubdirectory(string directoryName); + } + [System.Serializable] + public class TestingException : System.Exception + { + public TestingException(string message) { } + protected TestingException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public TestingException(string message, System.Exception inner) { } + } +} +namespace Testably.Abstractions.Testing +{ + public static class FileSystemInitializerExtensions + { + public static Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer Initialize(this TFileSystem fileSystem, System.Action? options = null) + where TFileSystem : System.IO.Abstractions.IFileSystem { } + public static void InitializeEmbeddedResourcesFromAssembly(this System.IO.Abstractions.IFileSystem fileSystem, string directoryPath, System.Reflection.Assembly assembly, string? relativePath = null, string searchPattern = "*", System.IO.SearchOption searchOption = 1) { } + public static Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer InitializeIn(this TFileSystem fileSystem, string basePath, System.Action? options = null) + where TFileSystem : System.IO.Abstractions.IFileSystem { } + public static Testably.Abstractions.Testing.FileSystemInitializer.IDirectoryCleaner SetCurrentDirectoryToEmptyTemporaryDirectory(this System.IO.Abstractions.IFileSystem fileSystem, string? prefix = null, System.Action? logger = null) { } + } + public class FileSystemInitializerOptions + { + public FileSystemInitializerOptions() { } + public bool InitializeTempDirectory { get; set; } + } + [System.Flags] + public enum FileSystemTypes + { + Directory = 1, + File = 2, + DirectoryOrFile = 3, + } + public static class InterceptionHandlerExtensions + { + public static Testably.Abstractions.Testing.MockFileSystem Changing(this Testably.Abstractions.Testing.FileSystem.IInterceptionHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action interceptionCallback, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + public static Testably.Abstractions.Testing.MockFileSystem Creating(this Testably.Abstractions.Testing.FileSystem.IInterceptionHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action interceptionCallback, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + public static Testably.Abstractions.Testing.MockFileSystem Deleting(this Testably.Abstractions.Testing.FileSystem.IInterceptionHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action interceptionCallback, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + } + public sealed class MockFileSystem : System.IO.Abstractions.IFileSystem + { + public MockFileSystem() { } + public System.IO.Abstractions.IDirectory Directory { get; } + public System.IO.Abstractions.IDirectoryInfoFactory DirectoryInfo { get; } + public System.IO.Abstractions.IDriveInfoFactory DriveInfo { get; } + public System.IO.Abstractions.IFile File { get; } + public System.IO.Abstractions.IFileInfoFactory FileInfo { get; } + public System.IO.Abstractions.IFileStreamFactory FileStream { get; } + public System.IO.Abstractions.IFileSystemWatcherFactory FileSystemWatcher { get; } + public Testably.Abstractions.Testing.FileSystem.IInterceptionHandler Intercept { get; } + public Testably.Abstractions.Testing.FileSystem.INotificationHandler Notify { get; } + public System.IO.Abstractions.IPath Path { get; } + public Testably.Abstractions.IRandomSystem RandomSystem { get; } + public Testably.Abstractions.Testing.Statistics.IFileSystemStatistics Statistics { get; } + public Testably.Abstractions.ITimeSystem TimeSystem { get; } + public override string ToString() { } + public Testably.Abstractions.Testing.MockFileSystem WithAccessControlStrategy(Testably.Abstractions.Testing.FileSystem.IAccessControlStrategy accessControlStrategy) { } + public Testably.Abstractions.Testing.MockFileSystem WithDrive(string? drive, System.Action? driveCallback = null) { } + public Testably.Abstractions.Testing.MockFileSystem WithSafeFileHandleStrategy(Testably.Abstractions.Testing.FileSystem.ISafeFileHandleStrategy safeFileHandleStrategy) { } + } + public static class MockFileSystemExtensions + { + public static System.IO.Abstractions.IDriveInfo GetDefaultDrive(this Testably.Abstractions.Testing.MockFileSystem mockFileSystem) { } + public static Testably.Abstractions.Testing.MockFileSystem WithDrive(this Testably.Abstractions.Testing.MockFileSystem mockFileSystem, System.Action driveCallback) { } + public static Testably.Abstractions.Testing.MockFileSystem WithUncDrive(this Testably.Abstractions.Testing.MockFileSystem mockFileSystem, string server, System.Action? driveCallback = null) { } + } + public sealed class MockRandomSystem : Testably.Abstractions.IRandomSystem + { + public MockRandomSystem() { } + public MockRandomSystem(Testably.Abstractions.Testing.RandomSystem.IRandomProvider randomProviderProvider) { } + public Testably.Abstractions.RandomSystem.IGuid Guid { get; } + public Testably.Abstractions.RandomSystem.IRandomFactory Random { get; } + public Testably.Abstractions.Testing.RandomSystem.IRandomProvider RandomProvider { get; } + public override string ToString() { } + } + public sealed class MockTimeSystem : Testably.Abstractions.ITimeSystem + { + public MockTimeSystem() { } + public MockTimeSystem(System.DateTime time) { } + public MockTimeSystem(Testably.Abstractions.Testing.TimeSystem.ITimeProvider timeProvider) { } + public Testably.Abstractions.TimeSystem.IDateTime DateTime { get; } + public Testably.Abstractions.Testing.TimeSystem.INotificationHandler On { get; } + public Testably.Abstractions.TimeSystem.ITask Task { get; } + public Testably.Abstractions.TimeSystem.IThread Thread { get; } + public Testably.Abstractions.Testing.TimeSystem.ITimeProvider TimeProvider { get; } + public Testably.Abstractions.TimeSystem.ITimerFactory Timer { get; } + public Testably.Abstractions.Testing.TimeSystem.ITimerHandler TimerHandler { get; } + public override string ToString() { } + public Testably.Abstractions.Testing.MockTimeSystem WithTimerStrategy(Testably.Abstractions.Testing.TimeSystem.ITimerStrategy timerStrategy) { } + } + public static class Notification + { + public static Testably.Abstractions.Testing.Notification.IAwaitableCallback ExecuteWhileWaiting(this Testably.Abstractions.Testing.Notification.IAwaitableCallback awaitable, System.Action callback) { } + public static Testably.Abstractions.Testing.Notification.IAwaitableCallback ExecuteWhileWaiting(this Testably.Abstractions.Testing.Notification.IAwaitableCallback awaitable, System.Func callback) { } + public interface IAwaitableCallback : System.IDisposable + { + void Wait(System.Func? filter = null, int timeout = 30000, int count = 1, System.Action? executeWhenWaiting = null); + } + public interface IAwaitableCallback : System.IDisposable, Testably.Abstractions.Testing.Notification.IAwaitableCallback + { + TFunc Wait(System.Func? filter = null, int timeout = 30000, int count = 1, System.Action? executeWhenWaiting = null); + } + } + public static class NotificationHandlerExtensions + { + public static Testably.Abstractions.Testing.Notification.IAwaitableCallback OnChanged(this Testably.Abstractions.Testing.FileSystem.INotificationHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action? notificationCallback = null, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + public static Testably.Abstractions.Testing.Notification.IAwaitableCallback OnCreated(this Testably.Abstractions.Testing.FileSystem.INotificationHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action? notificationCallback = null, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + public static Testably.Abstractions.Testing.Notification.IAwaitableCallback OnDeleted(this Testably.Abstractions.Testing.FileSystem.INotificationHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action? notificationCallback = null, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + } + public static class RandomProvider + { + public static Testably.Abstractions.Testing.RandomSystem.IRandomProvider Default() { } + public static Testably.Abstractions.Testing.RandomSystem.IRandomProvider Generate(int seed = -1, Testably.Abstractions.Testing.RandomProvider.Generator? guidGenerator = null, Testably.Abstractions.Testing.RandomProvider.Generator? intGenerator = null, Testably.Abstractions.Testing.RandomProvider.Generator? longGenerator = null, Testably.Abstractions.Testing.RandomProvider.Generator? singleGenerator = null, Testably.Abstractions.Testing.RandomProvider.Generator? doubleGenerator = null, Testably.Abstractions.Testing.RandomProvider.Generator? byteGenerator = null) { } + public sealed class Generator : System.IDisposable + { + public void Dispose() { } + public T GetNext() { } + public static Testably.Abstractions.Testing.RandomProvider.Generator FromArray(T[] values) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator FromCallback(System.Func callback) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator FromEnumerable(System.Collections.Generic.IEnumerable enumerable) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator FromValue(T value) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator op_Implicit(System.Func callback) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator op_Implicit(T value) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator op_Implicit(T[] values) { } + } + } + public static class TimeProvider + { + public static Testably.Abstractions.Testing.TimeSystem.ITimeProvider Now() { } + public static Testably.Abstractions.Testing.TimeSystem.ITimeProvider Random() { } + public static Testably.Abstractions.Testing.TimeSystem.ITimeProvider Use(System.DateTime time) { } + } +} +namespace Testably.Abstractions.Testing.RandomSystem +{ + public interface IRandomProvider + { + System.Guid GetGuid(); + Testably.Abstractions.RandomSystem.IRandom GetRandom(int seed = -1); + } +} +namespace Testably.Abstractions.Testing.Statistics +{ + public interface IFileSystemStatistics + { + Testably.Abstractions.Testing.Statistics.IStatistics Directory { get; } + Testably.Abstractions.Testing.Statistics.IPathStatistics DirectoryInfo { get; } + Testably.Abstractions.Testing.Statistics.IPathStatistics DriveInfo { get; } + Testably.Abstractions.Testing.Statistics.IStatistics File { get; } + Testably.Abstractions.Testing.Statistics.IPathStatistics FileInfo { get; } + Testably.Abstractions.Testing.Statistics.IPathStatistics FileStream { get; } + Testably.Abstractions.Testing.Statistics.IPathStatistics FileSystemWatcher { get; } + Testably.Abstractions.Testing.Statistics.IStatistics Path { get; } + } + public interface IPathStatistics : Testably.Abstractions.Testing.Statistics.IStatistics + { + Testably.Abstractions.Testing.Statistics.IStatistics this[string path] { get; } + } + public interface IStatistics + { + Testably.Abstractions.Testing.Statistics.MethodStatistic[] Methods { get; } + } + public sealed class MethodStatistic + { + public int Counter { get; } + public string Name { get; } + public Testably.Abstractions.Testing.Statistics.ParameterDescription[] Parameters { get; } + public override string ToString() { } + } + public abstract class ParameterDescription + { + protected ParameterDescription(bool isOutParameter) { } + public bool IsOutParameter { get; } + public bool Is(System.Func comparer) { } + public bool Is(System.ReadOnlySpan value) { } + public bool Is(System.Span value) { } + public bool Is(T value) { } + public bool Is(T[] value) { } + public static Testably.Abstractions.Testing.Statistics.ParameterDescription FromOutParameter(T value) { } + public static Testably.Abstractions.Testing.Statistics.ParameterDescription FromParameter(System.ReadOnlySpan value) { } + public static Testably.Abstractions.Testing.Statistics.ParameterDescription FromParameter(System.Span value) { } + public static Testably.Abstractions.Testing.Statistics.ParameterDescription FromParameter(T value) { } + } +} +namespace Testably.Abstractions.Testing.Storage +{ + public interface IStorageDrive : System.IO.Abstractions.IDriveInfo, System.IO.Abstractions.IFileSystemEntity + { + bool IsUncPath { get; } + Testably.Abstractions.Testing.Storage.IStorageDrive ChangeUsedBytes(long usedBytesDelta); + Testably.Abstractions.Testing.Storage.IStorageDrive SetDriveFormat(string driveFormat = "NTFS"); + Testably.Abstractions.Testing.Storage.IStorageDrive SetDriveType(System.IO.DriveType driveType = 3); + Testably.Abstractions.Testing.Storage.IStorageDrive SetIsReady(bool isReady = true); + Testably.Abstractions.Testing.Storage.IStorageDrive SetTotalSize(long totalSize = 1073741824); + } +} +namespace Testably.Abstractions.Testing.TimeSystem +{ + public interface INotificationHandler + { + Testably.Abstractions.Testing.Notification.IAwaitableCallback DateTimeRead(System.Action? callback = null, System.Func? predicate = null); + Testably.Abstractions.Testing.Notification.IAwaitableCallback TaskDelay(System.Action? callback = null, System.Func? predicate = null); + Testably.Abstractions.Testing.Notification.IAwaitableCallback ThreadSleep(System.Action? callback = null, System.Func? predicate = null); + } + public interface ITimeProvider + { + System.DateTime MaxValue { get; set; } + System.DateTime MinValue { get; set; } + System.DateTime UnixEpoch { get; set; } + void AdvanceBy(System.TimeSpan interval); + System.DateTime Read(); + void SetTo(System.DateTime value); + } + public interface ITimerHandler + { + Testably.Abstractions.Testing.TimeSystem.ITimerMock this[int index] { get; } + } + public interface ITimerMock : System.IAsyncDisposable, System.IDisposable, Testably.Abstractions.TimeSystem.ITimeSystemEntity, Testably.Abstractions.TimeSystem.ITimer + { + Testably.Abstractions.Testing.TimeSystem.ITimerMock Wait(int executionCount = 1, int timeout = 10000, System.Action? callback = null); + } + public interface ITimerStrategy + { + Testably.Abstractions.Testing.TimeSystem.TimerMode Mode { get; } + bool SwallowExceptions { get; } + } + public enum TimerMode + { + StartImmediately = 1, + StartOnMockWait = 2, + } + public class TimerStrategy : Testably.Abstractions.Testing.TimeSystem.ITimerStrategy + { + public TimerStrategy(Testably.Abstractions.Testing.TimeSystem.TimerMode mode = 1, bool swallowExceptions = false) { } + public Testably.Abstractions.Testing.TimeSystem.TimerMode Mode { get; } + public bool SwallowExceptions { get; } + public static Testably.Abstractions.Testing.TimeSystem.ITimerStrategy Default { get; } + } +} \ No newline at end of file diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Testing_net7.0.txt b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Testing_net7.0.txt new file mode 100644 index 000000000..78523af71 --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Testing_net7.0.txt @@ -0,0 +1,361 @@ +[assembly: System.CLSCompliant(true)] +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/Testably/Testably.Abstractions.git")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Testably.Abstractions.Testing.Tests")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v7.0", FrameworkDisplayName=".NET 7.0")] +namespace Testably.Abstractions.Testing.FileSystem +{ + public class ChangeDescription + { + public System.IO.WatcherChangeTypes ChangeType { get; } + public Testably.Abstractions.Testing.FileSystemTypes FileSystemType { get; } + public string? Name { get; } + public System.IO.NotifyFilters NotifyFilters { get; } + public string? OldName { get; } + public string? OldPath { get; } + public string Path { get; } + public override string ToString() { } + } + public class DefaultAccessControlStrategy : Testably.Abstractions.Testing.FileSystem.IAccessControlStrategy + { + public DefaultAccessControlStrategy(System.Func callback) { } + public bool IsAccessGranted(string fullPath, Testably.Abstractions.Helpers.IFileSystemExtensibility extensibility) { } + } + public class DefaultSafeFileHandleStrategy : Testably.Abstractions.Testing.FileSystem.ISafeFileHandleStrategy + { + public DefaultSafeFileHandleStrategy(System.Func callback) { } + [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage(Justification="SafeFileHandle cannot be unit tested.")] + public Testably.Abstractions.Testing.FileSystem.SafeFileHandleMock MapSafeFileHandle(Microsoft.Win32.SafeHandles.SafeFileHandle fileHandle) { } + } + public interface IAccessControlStrategy + { + bool IsAccessGranted(string fullPath, Testably.Abstractions.Helpers.IFileSystemExtensibility extensibility); + } + public interface IInterceptionHandler : System.IO.Abstractions.IFileSystemEntity + { + Testably.Abstractions.Testing.MockFileSystem Event(System.Action interceptionCallback, System.Func? predicate = null); + } + public interface INotificationHandler : System.IO.Abstractions.IFileSystemEntity + { + Testably.Abstractions.Testing.Notification.IAwaitableCallback OnEvent(System.Action? notificationCallback = null, System.Func? predicate = null); + } + public interface ISafeFileHandleStrategy + { + Testably.Abstractions.Testing.FileSystem.SafeFileHandleMock MapSafeFileHandle(Microsoft.Win32.SafeHandles.SafeFileHandle fileHandle); + } + public class NullAccessControlStrategy : Testably.Abstractions.Testing.FileSystem.IAccessControlStrategy + { + public NullAccessControlStrategy() { } + public bool IsAccessGranted(string fullPath, Testably.Abstractions.Helpers.IFileSystemExtensibility extensibility) { } + } + public class NullSafeFileHandleStrategy : Testably.Abstractions.Testing.FileSystem.ISafeFileHandleStrategy + { + public NullSafeFileHandleStrategy() { } + [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage(Justification="SafeFileHandle cannot be unit tested.")] + public Testably.Abstractions.Testing.FileSystem.SafeFileHandleMock MapSafeFileHandle(Microsoft.Win32.SafeHandles.SafeFileHandle fileHandle) { } + } + public class SafeFileHandleMock + { + public SafeFileHandleMock(string path, System.IO.FileMode mode = 3, System.IO.FileShare share = 0) { } + public System.IO.FileMode Mode { get; } + public string Path { get; } + public System.IO.FileShare Share { get; } + } +} +namespace Testably.Abstractions.Testing.FileSystemInitializer +{ + public class DirectoryDescription : Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription + { + public DirectoryDescription(string name) { } + public DirectoryDescription(string name, params Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription[] children) { } + public Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription[] Children { get; } + public override Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription this[string path] { get; } + } + public class FileDescription : Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription + { + public FileDescription(string name, byte[] bytes) { } + public FileDescription(string name, string? content = null) { } + public byte[]? Bytes { get; } + public string? Content { get; } + public bool IsReadOnly { get; set; } + public override Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription this[string? path] { get; } + } + public abstract class FileSystemInfoDescription + { + protected FileSystemInfoDescription(string name) { } + public abstract Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription this[string path] { get; } + public string Name { get; } + } + public interface IDirectoryCleaner : System.IDisposable + { + string BasePath { get; } + } + public interface IFileManipulator : System.IO.Abstractions.IFileSystemEntity + { + System.IO.Abstractions.IFileInfo File { get; } + Testably.Abstractions.Testing.FileSystemInitializer.IFileManipulator HasBytesContent(byte[] bytes); + Testably.Abstractions.Testing.FileSystemInitializer.IFileManipulator HasStringContent(string contents); + } + public interface IFileSystemDirectoryInitializer : Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer + where out TFileSystem : System.IO.Abstractions.IFileSystem + { + System.IO.Abstractions.IDirectoryInfo Directory { get; } + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemDirectoryInitializer Initialized(System.Action> subdirectoryInitializer); + } + public interface IFileSystemFileInitializer : Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer + where out TFileSystem : System.IO.Abstractions.IFileSystem + { + System.IO.Abstractions.IFileInfo File { get; } + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemFileInitializer Which(System.Action fileManipulation); + } + public interface IFileSystemInitializer + where out TFileSystem : System.IO.Abstractions.IFileSystem + { + System.IO.Abstractions.IDirectoryInfo BaseDirectory { get; } + TFileSystem FileSystem { get; } + System.IO.Abstractions.IFileSystemInfo this[int index] { get; } + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer With(params Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription[] descriptions); + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer With(TDescription[] descriptions) + where TDescription : Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription; + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemFileInitializer WithAFile(string? extension = null); + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemDirectoryInitializer WithASubdirectory(); + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemFileInitializer WithFile(string fileName); + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer WithSubdirectories(params string[] paths); + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemDirectoryInitializer WithSubdirectory(string directoryName); + } + [System.Serializable] + public class TestingException : System.Exception + { + public TestingException(string message) { } + protected TestingException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public TestingException(string message, System.Exception inner) { } + } +} +namespace Testably.Abstractions.Testing +{ + public static class FileSystemInitializerExtensions + { + public static Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer Initialize(this TFileSystem fileSystem, System.Action? options = null) + where TFileSystem : System.IO.Abstractions.IFileSystem { } + public static void InitializeEmbeddedResourcesFromAssembly(this System.IO.Abstractions.IFileSystem fileSystem, string directoryPath, System.Reflection.Assembly assembly, string? relativePath = null, string searchPattern = "*", System.IO.SearchOption searchOption = 1) { } + public static Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer InitializeIn(this TFileSystem fileSystem, string basePath, System.Action? options = null) + where TFileSystem : System.IO.Abstractions.IFileSystem { } + public static Testably.Abstractions.Testing.FileSystemInitializer.IDirectoryCleaner SetCurrentDirectoryToEmptyTemporaryDirectory(this System.IO.Abstractions.IFileSystem fileSystem, string? prefix = null, System.Action? logger = null) { } + } + public class FileSystemInitializerOptions + { + public FileSystemInitializerOptions() { } + public bool InitializeTempDirectory { get; set; } + } + [System.Flags] + public enum FileSystemTypes + { + Directory = 1, + File = 2, + DirectoryOrFile = 3, + } + public static class InterceptionHandlerExtensions + { + public static Testably.Abstractions.Testing.MockFileSystem Changing(this Testably.Abstractions.Testing.FileSystem.IInterceptionHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action interceptionCallback, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + public static Testably.Abstractions.Testing.MockFileSystem Creating(this Testably.Abstractions.Testing.FileSystem.IInterceptionHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action interceptionCallback, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + public static Testably.Abstractions.Testing.MockFileSystem Deleting(this Testably.Abstractions.Testing.FileSystem.IInterceptionHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action interceptionCallback, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + } + public sealed class MockFileSystem : System.IO.Abstractions.IFileSystem + { + public MockFileSystem() { } + public System.IO.Abstractions.IDirectory Directory { get; } + public System.IO.Abstractions.IDirectoryInfoFactory DirectoryInfo { get; } + public System.IO.Abstractions.IDriveInfoFactory DriveInfo { get; } + public System.IO.Abstractions.IFile File { get; } + public System.IO.Abstractions.IFileInfoFactory FileInfo { get; } + public System.IO.Abstractions.IFileStreamFactory FileStream { get; } + public System.IO.Abstractions.IFileSystemWatcherFactory FileSystemWatcher { get; } + public Testably.Abstractions.Testing.FileSystem.IInterceptionHandler Intercept { get; } + public Testably.Abstractions.Testing.FileSystem.INotificationHandler Notify { get; } + public System.IO.Abstractions.IPath Path { get; } + public Testably.Abstractions.IRandomSystem RandomSystem { get; } + public Testably.Abstractions.Testing.Statistics.IFileSystemStatistics Statistics { get; } + public Testably.Abstractions.ITimeSystem TimeSystem { get; } + public override string ToString() { } + public Testably.Abstractions.Testing.MockFileSystem WithAccessControlStrategy(Testably.Abstractions.Testing.FileSystem.IAccessControlStrategy accessControlStrategy) { } + public Testably.Abstractions.Testing.MockFileSystem WithDrive(string? drive, System.Action? driveCallback = null) { } + public Testably.Abstractions.Testing.MockFileSystem WithSafeFileHandleStrategy(Testably.Abstractions.Testing.FileSystem.ISafeFileHandleStrategy safeFileHandleStrategy) { } + } + public static class MockFileSystemExtensions + { + public static System.IO.Abstractions.IDriveInfo GetDefaultDrive(this Testably.Abstractions.Testing.MockFileSystem mockFileSystem) { } + public static Testably.Abstractions.Testing.MockFileSystem WithDrive(this Testably.Abstractions.Testing.MockFileSystem mockFileSystem, System.Action driveCallback) { } + public static Testably.Abstractions.Testing.MockFileSystem WithUncDrive(this Testably.Abstractions.Testing.MockFileSystem mockFileSystem, string server, System.Action? driveCallback = null) { } + } + public sealed class MockRandomSystem : Testably.Abstractions.IRandomSystem + { + public MockRandomSystem() { } + public MockRandomSystem(Testably.Abstractions.Testing.RandomSystem.IRandomProvider randomProviderProvider) { } + public Testably.Abstractions.RandomSystem.IGuid Guid { get; } + public Testably.Abstractions.RandomSystem.IRandomFactory Random { get; } + public Testably.Abstractions.Testing.RandomSystem.IRandomProvider RandomProvider { get; } + public override string ToString() { } + } + public sealed class MockTimeSystem : Testably.Abstractions.ITimeSystem + { + public MockTimeSystem() { } + public MockTimeSystem(System.DateTime time) { } + public MockTimeSystem(Testably.Abstractions.Testing.TimeSystem.ITimeProvider timeProvider) { } + public Testably.Abstractions.TimeSystem.IDateTime DateTime { get; } + public Testably.Abstractions.Testing.TimeSystem.INotificationHandler On { get; } + public Testably.Abstractions.TimeSystem.ITask Task { get; } + public Testably.Abstractions.TimeSystem.IThread Thread { get; } + public Testably.Abstractions.Testing.TimeSystem.ITimeProvider TimeProvider { get; } + public Testably.Abstractions.TimeSystem.ITimerFactory Timer { get; } + public Testably.Abstractions.Testing.TimeSystem.ITimerHandler TimerHandler { get; } + public override string ToString() { } + public Testably.Abstractions.Testing.MockTimeSystem WithTimerStrategy(Testably.Abstractions.Testing.TimeSystem.ITimerStrategy timerStrategy) { } + } + public static class Notification + { + public static Testably.Abstractions.Testing.Notification.IAwaitableCallback ExecuteWhileWaiting(this Testably.Abstractions.Testing.Notification.IAwaitableCallback awaitable, System.Action callback) { } + public static Testably.Abstractions.Testing.Notification.IAwaitableCallback ExecuteWhileWaiting(this Testably.Abstractions.Testing.Notification.IAwaitableCallback awaitable, System.Func callback) { } + public interface IAwaitableCallback : System.IDisposable + { + void Wait(System.Func? filter = null, int timeout = 30000, int count = 1, System.Action? executeWhenWaiting = null); + } + public interface IAwaitableCallback : System.IDisposable, Testably.Abstractions.Testing.Notification.IAwaitableCallback + { + TFunc Wait(System.Func? filter = null, int timeout = 30000, int count = 1, System.Action? executeWhenWaiting = null); + } + } + public static class NotificationHandlerExtensions + { + public static Testably.Abstractions.Testing.Notification.IAwaitableCallback OnChanged(this Testably.Abstractions.Testing.FileSystem.INotificationHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action? notificationCallback = null, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + public static Testably.Abstractions.Testing.Notification.IAwaitableCallback OnCreated(this Testably.Abstractions.Testing.FileSystem.INotificationHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action? notificationCallback = null, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + public static Testably.Abstractions.Testing.Notification.IAwaitableCallback OnDeleted(this Testably.Abstractions.Testing.FileSystem.INotificationHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action? notificationCallback = null, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + } + public static class RandomProvider + { + public static Testably.Abstractions.Testing.RandomSystem.IRandomProvider Default() { } + public static Testably.Abstractions.Testing.RandomSystem.IRandomProvider Generate(int seed = -1, Testably.Abstractions.Testing.RandomProvider.Generator? guidGenerator = null, Testably.Abstractions.Testing.RandomProvider.Generator? intGenerator = null, Testably.Abstractions.Testing.RandomProvider.Generator? longGenerator = null, Testably.Abstractions.Testing.RandomProvider.Generator? singleGenerator = null, Testably.Abstractions.Testing.RandomProvider.Generator? doubleGenerator = null, Testably.Abstractions.Testing.RandomProvider.Generator? byteGenerator = null) { } + public sealed class Generator : System.IDisposable + { + public void Dispose() { } + public T GetNext() { } + public static Testably.Abstractions.Testing.RandomProvider.Generator FromArray(T[] values) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator FromCallback(System.Func callback) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator FromEnumerable(System.Collections.Generic.IEnumerable enumerable) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator FromValue(T value) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator op_Implicit(System.Func callback) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator op_Implicit(T value) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator op_Implicit(T[] values) { } + } + } + public static class TimeProvider + { + public static Testably.Abstractions.Testing.TimeSystem.ITimeProvider Now() { } + public static Testably.Abstractions.Testing.TimeSystem.ITimeProvider Random() { } + public static Testably.Abstractions.Testing.TimeSystem.ITimeProvider Use(System.DateTime time) { } + } +} +namespace Testably.Abstractions.Testing.RandomSystem +{ + public interface IRandomProvider + { + System.Guid GetGuid(); + Testably.Abstractions.RandomSystem.IRandom GetRandom(int seed = -1); + } +} +namespace Testably.Abstractions.Testing.Statistics +{ + public interface IFileSystemStatistics + { + Testably.Abstractions.Testing.Statistics.IStatistics Directory { get; } + Testably.Abstractions.Testing.Statistics.IPathStatistics DirectoryInfo { get; } + Testably.Abstractions.Testing.Statistics.IPathStatistics DriveInfo { get; } + Testably.Abstractions.Testing.Statistics.IStatistics File { get; } + Testably.Abstractions.Testing.Statistics.IPathStatistics FileInfo { get; } + Testably.Abstractions.Testing.Statistics.IPathStatistics FileStream { get; } + Testably.Abstractions.Testing.Statistics.IPathStatistics FileSystemWatcher { get; } + Testably.Abstractions.Testing.Statistics.IStatistics Path { get; } + } + public interface IPathStatistics : Testably.Abstractions.Testing.Statistics.IStatistics + { + Testably.Abstractions.Testing.Statistics.IStatistics this[string path] { get; } + } + public interface IStatistics + { + Testably.Abstractions.Testing.Statistics.MethodStatistic[] Methods { get; } + } + public sealed class MethodStatistic + { + public int Counter { get; } + public string Name { get; } + public Testably.Abstractions.Testing.Statistics.ParameterDescription[] Parameters { get; } + public override string ToString() { } + } + public abstract class ParameterDescription + { + protected ParameterDescription(bool isOutParameter) { } + public bool IsOutParameter { get; } + public bool Is(System.Func comparer) { } + public bool Is(System.ReadOnlySpan value) { } + public bool Is(System.Span value) { } + public bool Is(T value) { } + public bool Is(T[] value) { } + public static Testably.Abstractions.Testing.Statistics.ParameterDescription FromOutParameter(T value) { } + public static Testably.Abstractions.Testing.Statistics.ParameterDescription FromParameter(System.ReadOnlySpan value) { } + public static Testably.Abstractions.Testing.Statistics.ParameterDescription FromParameter(System.Span value) { } + public static Testably.Abstractions.Testing.Statistics.ParameterDescription FromParameter(T value) { } + } +} +namespace Testably.Abstractions.Testing.Storage +{ + public interface IStorageDrive : System.IO.Abstractions.IDriveInfo, System.IO.Abstractions.IFileSystemEntity + { + bool IsUncPath { get; } + Testably.Abstractions.Testing.Storage.IStorageDrive ChangeUsedBytes(long usedBytesDelta); + Testably.Abstractions.Testing.Storage.IStorageDrive SetDriveFormat(string driveFormat = "NTFS"); + Testably.Abstractions.Testing.Storage.IStorageDrive SetDriveType(System.IO.DriveType driveType = 3); + Testably.Abstractions.Testing.Storage.IStorageDrive SetIsReady(bool isReady = true); + Testably.Abstractions.Testing.Storage.IStorageDrive SetTotalSize(long totalSize = 1073741824); + } +} +namespace Testably.Abstractions.Testing.TimeSystem +{ + public interface INotificationHandler + { + Testably.Abstractions.Testing.Notification.IAwaitableCallback DateTimeRead(System.Action? callback = null, System.Func? predicate = null); + Testably.Abstractions.Testing.Notification.IAwaitableCallback TaskDelay(System.Action? callback = null, System.Func? predicate = null); + Testably.Abstractions.Testing.Notification.IAwaitableCallback ThreadSleep(System.Action? callback = null, System.Func? predicate = null); + } + public interface ITimeProvider + { + System.DateTime MaxValue { get; set; } + System.DateTime MinValue { get; set; } + System.DateTime UnixEpoch { get; set; } + void AdvanceBy(System.TimeSpan interval); + System.DateTime Read(); + void SetTo(System.DateTime value); + } + public interface ITimerHandler + { + Testably.Abstractions.Testing.TimeSystem.ITimerMock this[int index] { get; } + } + public interface ITimerMock : System.IAsyncDisposable, System.IDisposable, Testably.Abstractions.TimeSystem.ITimeSystemEntity, Testably.Abstractions.TimeSystem.ITimer + { + Testably.Abstractions.Testing.TimeSystem.ITimerMock Wait(int executionCount = 1, int timeout = 10000, System.Action? callback = null); + } + public interface ITimerStrategy + { + Testably.Abstractions.Testing.TimeSystem.TimerMode Mode { get; } + bool SwallowExceptions { get; } + } + public enum TimerMode + { + StartImmediately = 1, + StartOnMockWait = 2, + } + public class TimerStrategy : Testably.Abstractions.Testing.TimeSystem.ITimerStrategy + { + public TimerStrategy(Testably.Abstractions.Testing.TimeSystem.TimerMode mode = 1, bool swallowExceptions = false) { } + public Testably.Abstractions.Testing.TimeSystem.TimerMode Mode { get; } + public bool SwallowExceptions { get; } + public static Testably.Abstractions.Testing.TimeSystem.ITimerStrategy Default { get; } + } +} \ No newline at end of file diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Testing_net8.0.txt b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Testing_net8.0.txt new file mode 100644 index 000000000..14d174cdf --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Testing_net8.0.txt @@ -0,0 +1,359 @@ +[assembly: System.CLSCompliant(true)] +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/Testably/Testably.Abstractions.git")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Testably.Abstractions.Testing.Tests")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName=".NET 8.0")] +namespace Testably.Abstractions.Testing.FileSystem +{ + public class ChangeDescription + { + public System.IO.WatcherChangeTypes ChangeType { get; } + public Testably.Abstractions.Testing.FileSystemTypes FileSystemType { get; } + public string? Name { get; } + public System.IO.NotifyFilters NotifyFilters { get; } + public string? OldName { get; } + public string? OldPath { get; } + public string Path { get; } + public override string ToString() { } + } + public class DefaultAccessControlStrategy : Testably.Abstractions.Testing.FileSystem.IAccessControlStrategy + { + public DefaultAccessControlStrategy(System.Func callback) { } + public bool IsAccessGranted(string fullPath, Testably.Abstractions.Helpers.IFileSystemExtensibility extensibility) { } + } + public class DefaultSafeFileHandleStrategy : Testably.Abstractions.Testing.FileSystem.ISafeFileHandleStrategy + { + public DefaultSafeFileHandleStrategy(System.Func callback) { } + [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage(Justification="SafeFileHandle cannot be unit tested.")] + public Testably.Abstractions.Testing.FileSystem.SafeFileHandleMock MapSafeFileHandle(Microsoft.Win32.SafeHandles.SafeFileHandle fileHandle) { } + } + public interface IAccessControlStrategy + { + bool IsAccessGranted(string fullPath, Testably.Abstractions.Helpers.IFileSystemExtensibility extensibility); + } + public interface IInterceptionHandler : System.IO.Abstractions.IFileSystemEntity + { + Testably.Abstractions.Testing.MockFileSystem Event(System.Action interceptionCallback, System.Func? predicate = null); + } + public interface INotificationHandler : System.IO.Abstractions.IFileSystemEntity + { + Testably.Abstractions.Testing.Notification.IAwaitableCallback OnEvent(System.Action? notificationCallback = null, System.Func? predicate = null); + } + public interface ISafeFileHandleStrategy + { + Testably.Abstractions.Testing.FileSystem.SafeFileHandleMock MapSafeFileHandle(Microsoft.Win32.SafeHandles.SafeFileHandle fileHandle); + } + public class NullAccessControlStrategy : Testably.Abstractions.Testing.FileSystem.IAccessControlStrategy + { + public NullAccessControlStrategy() { } + public bool IsAccessGranted(string fullPath, Testably.Abstractions.Helpers.IFileSystemExtensibility extensibility) { } + } + public class NullSafeFileHandleStrategy : Testably.Abstractions.Testing.FileSystem.ISafeFileHandleStrategy + { + public NullSafeFileHandleStrategy() { } + [System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage(Justification="SafeFileHandle cannot be unit tested.")] + public Testably.Abstractions.Testing.FileSystem.SafeFileHandleMock MapSafeFileHandle(Microsoft.Win32.SafeHandles.SafeFileHandle fileHandle) { } + } + public class SafeFileHandleMock + { + public SafeFileHandleMock(string path, System.IO.FileMode mode = 3, System.IO.FileShare share = 0) { } + public System.IO.FileMode Mode { get; } + public string Path { get; } + public System.IO.FileShare Share { get; } + } +} +namespace Testably.Abstractions.Testing.FileSystemInitializer +{ + public class DirectoryDescription : Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription + { + public DirectoryDescription(string name) { } + public DirectoryDescription(string name, params Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription[] children) { } + public Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription[] Children { get; } + public override Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription this[string path] { get; } + } + public class FileDescription : Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription + { + public FileDescription(string name, byte[] bytes) { } + public FileDescription(string name, string? content = null) { } + public byte[]? Bytes { get; } + public string? Content { get; } + public bool IsReadOnly { get; set; } + public override Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription this[string? path] { get; } + } + public abstract class FileSystemInfoDescription + { + protected FileSystemInfoDescription(string name) { } + public abstract Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription this[string path] { get; } + public string Name { get; } + } + public interface IDirectoryCleaner : System.IDisposable + { + string BasePath { get; } + } + public interface IFileManipulator : System.IO.Abstractions.IFileSystemEntity + { + System.IO.Abstractions.IFileInfo File { get; } + Testably.Abstractions.Testing.FileSystemInitializer.IFileManipulator HasBytesContent(byte[] bytes); + Testably.Abstractions.Testing.FileSystemInitializer.IFileManipulator HasStringContent(string contents); + } + public interface IFileSystemDirectoryInitializer : Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer + where out TFileSystem : System.IO.Abstractions.IFileSystem + { + System.IO.Abstractions.IDirectoryInfo Directory { get; } + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemDirectoryInitializer Initialized(System.Action> subdirectoryInitializer); + } + public interface IFileSystemFileInitializer : Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer + where out TFileSystem : System.IO.Abstractions.IFileSystem + { + System.IO.Abstractions.IFileInfo File { get; } + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemFileInitializer Which(System.Action fileManipulation); + } + public interface IFileSystemInitializer + where out TFileSystem : System.IO.Abstractions.IFileSystem + { + System.IO.Abstractions.IDirectoryInfo BaseDirectory { get; } + TFileSystem FileSystem { get; } + System.IO.Abstractions.IFileSystemInfo this[int index] { get; } + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer With(params Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription[] descriptions); + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer With(TDescription[] descriptions) + where TDescription : Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription; + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemFileInitializer WithAFile(string? extension = null); + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemDirectoryInitializer WithASubdirectory(); + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemFileInitializer WithFile(string fileName); + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer WithSubdirectories(params string[] paths); + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemDirectoryInitializer WithSubdirectory(string directoryName); + } + public class TestingException : System.Exception + { + public TestingException(string message) { } + public TestingException(string message, System.Exception inner) { } + } +} +namespace Testably.Abstractions.Testing +{ + public static class FileSystemInitializerExtensions + { + public static Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer Initialize(this TFileSystem fileSystem, System.Action? options = null) + where TFileSystem : System.IO.Abstractions.IFileSystem { } + public static void InitializeEmbeddedResourcesFromAssembly(this System.IO.Abstractions.IFileSystem fileSystem, string directoryPath, System.Reflection.Assembly assembly, string? relativePath = null, string searchPattern = "*", System.IO.SearchOption searchOption = 1) { } + public static Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer InitializeIn(this TFileSystem fileSystem, string basePath, System.Action? options = null) + where TFileSystem : System.IO.Abstractions.IFileSystem { } + public static Testably.Abstractions.Testing.FileSystemInitializer.IDirectoryCleaner SetCurrentDirectoryToEmptyTemporaryDirectory(this System.IO.Abstractions.IFileSystem fileSystem, string? prefix = null, System.Action? logger = null) { } + } + public class FileSystemInitializerOptions + { + public FileSystemInitializerOptions() { } + public bool InitializeTempDirectory { get; set; } + } + [System.Flags] + public enum FileSystemTypes + { + Directory = 1, + File = 2, + DirectoryOrFile = 3, + } + public static class InterceptionHandlerExtensions + { + public static Testably.Abstractions.Testing.MockFileSystem Changing(this Testably.Abstractions.Testing.FileSystem.IInterceptionHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action interceptionCallback, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + public static Testably.Abstractions.Testing.MockFileSystem Creating(this Testably.Abstractions.Testing.FileSystem.IInterceptionHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action interceptionCallback, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + public static Testably.Abstractions.Testing.MockFileSystem Deleting(this Testably.Abstractions.Testing.FileSystem.IInterceptionHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action interceptionCallback, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + } + public sealed class MockFileSystem : System.IO.Abstractions.IFileSystem + { + public MockFileSystem() { } + public System.IO.Abstractions.IDirectory Directory { get; } + public System.IO.Abstractions.IDirectoryInfoFactory DirectoryInfo { get; } + public System.IO.Abstractions.IDriveInfoFactory DriveInfo { get; } + public System.IO.Abstractions.IFile File { get; } + public System.IO.Abstractions.IFileInfoFactory FileInfo { get; } + public System.IO.Abstractions.IFileStreamFactory FileStream { get; } + public System.IO.Abstractions.IFileSystemWatcherFactory FileSystemWatcher { get; } + public Testably.Abstractions.Testing.FileSystem.IInterceptionHandler Intercept { get; } + public Testably.Abstractions.Testing.FileSystem.INotificationHandler Notify { get; } + public System.IO.Abstractions.IPath Path { get; } + public Testably.Abstractions.IRandomSystem RandomSystem { get; } + public Testably.Abstractions.Testing.Statistics.IFileSystemStatistics Statistics { get; } + public Testably.Abstractions.ITimeSystem TimeSystem { get; } + public override string ToString() { } + public Testably.Abstractions.Testing.MockFileSystem WithAccessControlStrategy(Testably.Abstractions.Testing.FileSystem.IAccessControlStrategy accessControlStrategy) { } + public Testably.Abstractions.Testing.MockFileSystem WithDrive(string? drive, System.Action? driveCallback = null) { } + public Testably.Abstractions.Testing.MockFileSystem WithSafeFileHandleStrategy(Testably.Abstractions.Testing.FileSystem.ISafeFileHandleStrategy safeFileHandleStrategy) { } + } + public static class MockFileSystemExtensions + { + public static System.IO.Abstractions.IDriveInfo GetDefaultDrive(this Testably.Abstractions.Testing.MockFileSystem mockFileSystem) { } + public static Testably.Abstractions.Testing.MockFileSystem WithDrive(this Testably.Abstractions.Testing.MockFileSystem mockFileSystem, System.Action driveCallback) { } + public static Testably.Abstractions.Testing.MockFileSystem WithUncDrive(this Testably.Abstractions.Testing.MockFileSystem mockFileSystem, string server, System.Action? driveCallback = null) { } + } + public sealed class MockRandomSystem : Testably.Abstractions.IRandomSystem + { + public MockRandomSystem() { } + public MockRandomSystem(Testably.Abstractions.Testing.RandomSystem.IRandomProvider randomProviderProvider) { } + public Testably.Abstractions.RandomSystem.IGuid Guid { get; } + public Testably.Abstractions.RandomSystem.IRandomFactory Random { get; } + public Testably.Abstractions.Testing.RandomSystem.IRandomProvider RandomProvider { get; } + public override string ToString() { } + } + public sealed class MockTimeSystem : Testably.Abstractions.ITimeSystem + { + public MockTimeSystem() { } + public MockTimeSystem(System.DateTime time) { } + public MockTimeSystem(Testably.Abstractions.Testing.TimeSystem.ITimeProvider timeProvider) { } + public Testably.Abstractions.TimeSystem.IDateTime DateTime { get; } + public Testably.Abstractions.Testing.TimeSystem.INotificationHandler On { get; } + public Testably.Abstractions.TimeSystem.ITask Task { get; } + public Testably.Abstractions.TimeSystem.IThread Thread { get; } + public Testably.Abstractions.Testing.TimeSystem.ITimeProvider TimeProvider { get; } + public Testably.Abstractions.TimeSystem.ITimerFactory Timer { get; } + public Testably.Abstractions.Testing.TimeSystem.ITimerHandler TimerHandler { get; } + public override string ToString() { } + public Testably.Abstractions.Testing.MockTimeSystem WithTimerStrategy(Testably.Abstractions.Testing.TimeSystem.ITimerStrategy timerStrategy) { } + } + public static class Notification + { + public static Testably.Abstractions.Testing.Notification.IAwaitableCallback ExecuteWhileWaiting(this Testably.Abstractions.Testing.Notification.IAwaitableCallback awaitable, System.Action callback) { } + public static Testably.Abstractions.Testing.Notification.IAwaitableCallback ExecuteWhileWaiting(this Testably.Abstractions.Testing.Notification.IAwaitableCallback awaitable, System.Func callback) { } + public interface IAwaitableCallback : System.IDisposable + { + void Wait(System.Func? filter = null, int timeout = 30000, int count = 1, System.Action? executeWhenWaiting = null); + } + public interface IAwaitableCallback : System.IDisposable, Testably.Abstractions.Testing.Notification.IAwaitableCallback + { + TFunc Wait(System.Func? filter = null, int timeout = 30000, int count = 1, System.Action? executeWhenWaiting = null); + } + } + public static class NotificationHandlerExtensions + { + public static Testably.Abstractions.Testing.Notification.IAwaitableCallback OnChanged(this Testably.Abstractions.Testing.FileSystem.INotificationHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action? notificationCallback = null, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + public static Testably.Abstractions.Testing.Notification.IAwaitableCallback OnCreated(this Testably.Abstractions.Testing.FileSystem.INotificationHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action? notificationCallback = null, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + public static Testably.Abstractions.Testing.Notification.IAwaitableCallback OnDeleted(this Testably.Abstractions.Testing.FileSystem.INotificationHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action? notificationCallback = null, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + } + public static class RandomProvider + { + public static Testably.Abstractions.Testing.RandomSystem.IRandomProvider Default() { } + public static Testably.Abstractions.Testing.RandomSystem.IRandomProvider Generate(int seed = -1, Testably.Abstractions.Testing.RandomProvider.Generator? guidGenerator = null, Testably.Abstractions.Testing.RandomProvider.Generator? intGenerator = null, Testably.Abstractions.Testing.RandomProvider.Generator? longGenerator = null, Testably.Abstractions.Testing.RandomProvider.Generator? singleGenerator = null, Testably.Abstractions.Testing.RandomProvider.Generator? doubleGenerator = null, Testably.Abstractions.Testing.RandomProvider.Generator? byteGenerator = null) { } + public sealed class Generator : System.IDisposable + { + public void Dispose() { } + public T GetNext() { } + public static Testably.Abstractions.Testing.RandomProvider.Generator FromArray(T[] values) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator FromCallback(System.Func callback) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator FromEnumerable(System.Collections.Generic.IEnumerable enumerable) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator FromValue(T value) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator op_Implicit(System.Func callback) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator op_Implicit(T value) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator op_Implicit(T[] values) { } + } + } + public static class TimeProvider + { + public static Testably.Abstractions.Testing.TimeSystem.ITimeProvider Now() { } + public static Testably.Abstractions.Testing.TimeSystem.ITimeProvider Random() { } + public static Testably.Abstractions.Testing.TimeSystem.ITimeProvider Use(System.DateTime time) { } + } +} +namespace Testably.Abstractions.Testing.RandomSystem +{ + public interface IRandomProvider + { + System.Guid GetGuid(); + Testably.Abstractions.RandomSystem.IRandom GetRandom(int seed = -1); + } +} +namespace Testably.Abstractions.Testing.Statistics +{ + public interface IFileSystemStatistics + { + Testably.Abstractions.Testing.Statistics.IStatistics Directory { get; } + Testably.Abstractions.Testing.Statistics.IPathStatistics DirectoryInfo { get; } + Testably.Abstractions.Testing.Statistics.IPathStatistics DriveInfo { get; } + Testably.Abstractions.Testing.Statistics.IStatistics File { get; } + Testably.Abstractions.Testing.Statistics.IPathStatistics FileInfo { get; } + Testably.Abstractions.Testing.Statistics.IPathStatistics FileStream { get; } + Testably.Abstractions.Testing.Statistics.IPathStatistics FileSystemWatcher { get; } + Testably.Abstractions.Testing.Statistics.IStatistics Path { get; } + } + public interface IPathStatistics : Testably.Abstractions.Testing.Statistics.IStatistics + { + Testably.Abstractions.Testing.Statistics.IStatistics this[string path] { get; } + } + public interface IStatistics + { + Testably.Abstractions.Testing.Statistics.MethodStatistic[] Methods { get; } + } + public sealed class MethodStatistic + { + public int Counter { get; } + public string Name { get; } + public Testably.Abstractions.Testing.Statistics.ParameterDescription[] Parameters { get; } + public override string ToString() { } + } + public abstract class ParameterDescription + { + protected ParameterDescription(bool isOutParameter) { } + public bool IsOutParameter { get; } + public bool Is(System.Func comparer) { } + public bool Is(System.ReadOnlySpan value) { } + public bool Is(System.Span value) { } + public bool Is(T value) { } + public bool Is(T[] value) { } + public static Testably.Abstractions.Testing.Statistics.ParameterDescription FromOutParameter(T value) { } + public static Testably.Abstractions.Testing.Statistics.ParameterDescription FromParameter(System.ReadOnlySpan value) { } + public static Testably.Abstractions.Testing.Statistics.ParameterDescription FromParameter(System.Span value) { } + public static Testably.Abstractions.Testing.Statistics.ParameterDescription FromParameter(T value) { } + } +} +namespace Testably.Abstractions.Testing.Storage +{ + public interface IStorageDrive : System.IO.Abstractions.IDriveInfo, System.IO.Abstractions.IFileSystemEntity + { + bool IsUncPath { get; } + Testably.Abstractions.Testing.Storage.IStorageDrive ChangeUsedBytes(long usedBytesDelta); + Testably.Abstractions.Testing.Storage.IStorageDrive SetDriveFormat(string driveFormat = "NTFS"); + Testably.Abstractions.Testing.Storage.IStorageDrive SetDriveType(System.IO.DriveType driveType = 3); + Testably.Abstractions.Testing.Storage.IStorageDrive SetIsReady(bool isReady = true); + Testably.Abstractions.Testing.Storage.IStorageDrive SetTotalSize(long totalSize = 1073741824); + } +} +namespace Testably.Abstractions.Testing.TimeSystem +{ + public interface INotificationHandler + { + Testably.Abstractions.Testing.Notification.IAwaitableCallback DateTimeRead(System.Action? callback = null, System.Func? predicate = null); + Testably.Abstractions.Testing.Notification.IAwaitableCallback TaskDelay(System.Action? callback = null, System.Func? predicate = null); + Testably.Abstractions.Testing.Notification.IAwaitableCallback ThreadSleep(System.Action? callback = null, System.Func? predicate = null); + } + public interface ITimeProvider + { + System.DateTime MaxValue { get; set; } + System.DateTime MinValue { get; set; } + System.DateTime UnixEpoch { get; set; } + void AdvanceBy(System.TimeSpan interval); + System.DateTime Read(); + void SetTo(System.DateTime value); + } + public interface ITimerHandler + { + Testably.Abstractions.Testing.TimeSystem.ITimerMock this[int index] { get; } + } + public interface ITimerMock : System.IAsyncDisposable, System.IDisposable, Testably.Abstractions.TimeSystem.ITimeSystemEntity, Testably.Abstractions.TimeSystem.ITimer + { + Testably.Abstractions.Testing.TimeSystem.ITimerMock Wait(int executionCount = 1, int timeout = 10000, System.Action? callback = null); + } + public interface ITimerStrategy + { + Testably.Abstractions.Testing.TimeSystem.TimerMode Mode { get; } + bool SwallowExceptions { get; } + } + public enum TimerMode + { + StartImmediately = 1, + StartOnMockWait = 2, + } + public class TimerStrategy : Testably.Abstractions.Testing.TimeSystem.ITimerStrategy + { + public TimerStrategy(Testably.Abstractions.Testing.TimeSystem.TimerMode mode = 1, bool swallowExceptions = false) { } + public Testably.Abstractions.Testing.TimeSystem.TimerMode Mode { get; } + public bool SwallowExceptions { get; } + public static Testably.Abstractions.Testing.TimeSystem.ITimerStrategy Default { get; } + } +} \ No newline at end of file diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Testing_netstandard2.0.txt b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Testing_netstandard2.0.txt new file mode 100644 index 000000000..b0364d804 --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Testing_netstandard2.0.txt @@ -0,0 +1,355 @@ +[assembly: System.CLSCompliant(true)] +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/Testably/Testably.Abstractions.git")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Testably.Abstractions.Testing.Tests")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName=".NET Standard 2.0")] +namespace Testably.Abstractions.Testing.FileSystem +{ + public class ChangeDescription + { + public System.IO.WatcherChangeTypes ChangeType { get; } + public Testably.Abstractions.Testing.FileSystemTypes FileSystemType { get; } + public string? Name { get; } + public System.IO.NotifyFilters NotifyFilters { get; } + public string? OldName { get; } + public string? OldPath { get; } + public string Path { get; } + public override string ToString() { } + } + public class DefaultAccessControlStrategy : Testably.Abstractions.Testing.FileSystem.IAccessControlStrategy + { + public DefaultAccessControlStrategy(System.Func callback) { } + public bool IsAccessGranted(string fullPath, Testably.Abstractions.Helpers.IFileSystemExtensibility extensibility) { } + } + public class DefaultSafeFileHandleStrategy : Testably.Abstractions.Testing.FileSystem.ISafeFileHandleStrategy + { + public DefaultSafeFileHandleStrategy(System.Func callback) { } + public Testably.Abstractions.Testing.FileSystem.SafeFileHandleMock MapSafeFileHandle(Microsoft.Win32.SafeHandles.SafeFileHandle fileHandle) { } + } + public interface IAccessControlStrategy + { + bool IsAccessGranted(string fullPath, Testably.Abstractions.Helpers.IFileSystemExtensibility extensibility); + } + public interface IInterceptionHandler : System.IO.Abstractions.IFileSystemEntity + { + Testably.Abstractions.Testing.MockFileSystem Event(System.Action interceptionCallback, System.Func? predicate = null); + } + public interface INotificationHandler : System.IO.Abstractions.IFileSystemEntity + { + Testably.Abstractions.Testing.Notification.IAwaitableCallback OnEvent(System.Action? notificationCallback = null, System.Func? predicate = null); + } + public interface ISafeFileHandleStrategy + { + Testably.Abstractions.Testing.FileSystem.SafeFileHandleMock MapSafeFileHandle(Microsoft.Win32.SafeHandles.SafeFileHandle fileHandle); + } + public class NullAccessControlStrategy : Testably.Abstractions.Testing.FileSystem.IAccessControlStrategy + { + public NullAccessControlStrategy() { } + public bool IsAccessGranted(string fullPath, Testably.Abstractions.Helpers.IFileSystemExtensibility extensibility) { } + } + public class NullSafeFileHandleStrategy : Testably.Abstractions.Testing.FileSystem.ISafeFileHandleStrategy + { + public NullSafeFileHandleStrategy() { } + public Testably.Abstractions.Testing.FileSystem.SafeFileHandleMock MapSafeFileHandle(Microsoft.Win32.SafeHandles.SafeFileHandle fileHandle) { } + } + public class SafeFileHandleMock + { + public SafeFileHandleMock(string path, System.IO.FileMode mode = 3, System.IO.FileShare share = 0) { } + public System.IO.FileMode Mode { get; } + public string Path { get; } + public System.IO.FileShare Share { get; } + } +} +namespace Testably.Abstractions.Testing.FileSystemInitializer +{ + public class DirectoryDescription : Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription + { + public DirectoryDescription(string name) { } + public DirectoryDescription(string name, params Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription[] children) { } + public Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription[] Children { get; } + public override Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription this[string path] { get; } + } + public class FileDescription : Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription + { + public FileDescription(string name, byte[] bytes) { } + public FileDescription(string name, string? content = null) { } + public byte[]? Bytes { get; } + public string? Content { get; } + public bool IsReadOnly { get; set; } + public override Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription this[string? path] { get; } + } + public abstract class FileSystemInfoDescription + { + protected FileSystemInfoDescription(string name) { } + public abstract Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription this[string path] { get; } + public string Name { get; } + } + public interface IDirectoryCleaner : System.IDisposable + { + string BasePath { get; } + } + public interface IFileManipulator : System.IO.Abstractions.IFileSystemEntity + { + System.IO.Abstractions.IFileInfo File { get; } + Testably.Abstractions.Testing.FileSystemInitializer.IFileManipulator HasBytesContent(byte[] bytes); + Testably.Abstractions.Testing.FileSystemInitializer.IFileManipulator HasStringContent(string contents); + } + public interface IFileSystemDirectoryInitializer : Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer + where out TFileSystem : System.IO.Abstractions.IFileSystem + { + System.IO.Abstractions.IDirectoryInfo Directory { get; } + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemDirectoryInitializer Initialized(System.Action> subdirectoryInitializer); + } + public interface IFileSystemFileInitializer : Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer + where out TFileSystem : System.IO.Abstractions.IFileSystem + { + System.IO.Abstractions.IFileInfo File { get; } + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemFileInitializer Which(System.Action fileManipulation); + } + public interface IFileSystemInitializer + where out TFileSystem : System.IO.Abstractions.IFileSystem + { + System.IO.Abstractions.IDirectoryInfo BaseDirectory { get; } + TFileSystem FileSystem { get; } + System.IO.Abstractions.IFileSystemInfo this[int index] { get; } + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer With(params Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription[] descriptions); + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer With(TDescription[] descriptions) + where TDescription : Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription; + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemFileInitializer WithAFile(string? extension = null); + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemDirectoryInitializer WithASubdirectory(); + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemFileInitializer WithFile(string fileName); + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer WithSubdirectories(params string[] paths); + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemDirectoryInitializer WithSubdirectory(string directoryName); + } + [System.Serializable] + public class TestingException : System.Exception + { + public TestingException(string message) { } + protected TestingException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public TestingException(string message, System.Exception inner) { } + } +} +namespace Testably.Abstractions.Testing +{ + public static class FileSystemInitializerExtensions + { + public static Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer Initialize(this TFileSystem fileSystem, System.Action? options = null) + where TFileSystem : System.IO.Abstractions.IFileSystem { } + public static void InitializeEmbeddedResourcesFromAssembly(this System.IO.Abstractions.IFileSystem fileSystem, string directoryPath, System.Reflection.Assembly assembly, string? relativePath = null, string searchPattern = "*", System.IO.SearchOption searchOption = 1) { } + public static Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer InitializeIn(this TFileSystem fileSystem, string basePath, System.Action? options = null) + where TFileSystem : System.IO.Abstractions.IFileSystem { } + public static Testably.Abstractions.Testing.FileSystemInitializer.IDirectoryCleaner SetCurrentDirectoryToEmptyTemporaryDirectory(this System.IO.Abstractions.IFileSystem fileSystem, string? prefix = null, System.Action? logger = null) { } + } + public class FileSystemInitializerOptions + { + public FileSystemInitializerOptions() { } + public bool InitializeTempDirectory { get; set; } + } + [System.Flags] + public enum FileSystemTypes + { + Directory = 1, + File = 2, + DirectoryOrFile = 3, + } + public static class InterceptionHandlerExtensions + { + public static Testably.Abstractions.Testing.MockFileSystem Changing(this Testably.Abstractions.Testing.FileSystem.IInterceptionHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action interceptionCallback, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + public static Testably.Abstractions.Testing.MockFileSystem Creating(this Testably.Abstractions.Testing.FileSystem.IInterceptionHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action interceptionCallback, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + public static Testably.Abstractions.Testing.MockFileSystem Deleting(this Testably.Abstractions.Testing.FileSystem.IInterceptionHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action interceptionCallback, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + } + public sealed class MockFileSystem : System.IO.Abstractions.IFileSystem + { + public MockFileSystem() { } + public System.IO.Abstractions.IDirectory Directory { get; } + public System.IO.Abstractions.IDirectoryInfoFactory DirectoryInfo { get; } + public System.IO.Abstractions.IDriveInfoFactory DriveInfo { get; } + public System.IO.Abstractions.IFile File { get; } + public System.IO.Abstractions.IFileInfoFactory FileInfo { get; } + public System.IO.Abstractions.IFileStreamFactory FileStream { get; } + public System.IO.Abstractions.IFileSystemWatcherFactory FileSystemWatcher { get; } + public Testably.Abstractions.Testing.FileSystem.IInterceptionHandler Intercept { get; } + public Testably.Abstractions.Testing.FileSystem.INotificationHandler Notify { get; } + public System.IO.Abstractions.IPath Path { get; } + public Testably.Abstractions.IRandomSystem RandomSystem { get; } + public Testably.Abstractions.Testing.Statistics.IFileSystemStatistics Statistics { get; } + public Testably.Abstractions.ITimeSystem TimeSystem { get; } + public override string ToString() { } + public Testably.Abstractions.Testing.MockFileSystem WithAccessControlStrategy(Testably.Abstractions.Testing.FileSystem.IAccessControlStrategy accessControlStrategy) { } + public Testably.Abstractions.Testing.MockFileSystem WithDrive(string? drive, System.Action? driveCallback = null) { } + public Testably.Abstractions.Testing.MockFileSystem WithSafeFileHandleStrategy(Testably.Abstractions.Testing.FileSystem.ISafeFileHandleStrategy safeFileHandleStrategy) { } + } + public static class MockFileSystemExtensions + { + public static System.IO.Abstractions.IDriveInfo GetDefaultDrive(this Testably.Abstractions.Testing.MockFileSystem mockFileSystem) { } + public static Testably.Abstractions.Testing.MockFileSystem WithDrive(this Testably.Abstractions.Testing.MockFileSystem mockFileSystem, System.Action driveCallback) { } + public static Testably.Abstractions.Testing.MockFileSystem WithUncDrive(this Testably.Abstractions.Testing.MockFileSystem mockFileSystem, string server, System.Action? driveCallback = null) { } + } + public sealed class MockRandomSystem : Testably.Abstractions.IRandomSystem + { + public MockRandomSystem() { } + public MockRandomSystem(Testably.Abstractions.Testing.RandomSystem.IRandomProvider randomProviderProvider) { } + public Testably.Abstractions.RandomSystem.IGuid Guid { get; } + public Testably.Abstractions.RandomSystem.IRandomFactory Random { get; } + public Testably.Abstractions.Testing.RandomSystem.IRandomProvider RandomProvider { get; } + public override string ToString() { } + } + public sealed class MockTimeSystem : Testably.Abstractions.ITimeSystem + { + public MockTimeSystem() { } + public MockTimeSystem(System.DateTime time) { } + public MockTimeSystem(Testably.Abstractions.Testing.TimeSystem.ITimeProvider timeProvider) { } + public Testably.Abstractions.TimeSystem.IDateTime DateTime { get; } + public Testably.Abstractions.Testing.TimeSystem.INotificationHandler On { get; } + public Testably.Abstractions.TimeSystem.ITask Task { get; } + public Testably.Abstractions.TimeSystem.IThread Thread { get; } + public Testably.Abstractions.Testing.TimeSystem.ITimeProvider TimeProvider { get; } + public Testably.Abstractions.TimeSystem.ITimerFactory Timer { get; } + public Testably.Abstractions.Testing.TimeSystem.ITimerHandler TimerHandler { get; } + public override string ToString() { } + public Testably.Abstractions.Testing.MockTimeSystem WithTimerStrategy(Testably.Abstractions.Testing.TimeSystem.ITimerStrategy timerStrategy) { } + } + public static class Notification + { + public static Testably.Abstractions.Testing.Notification.IAwaitableCallback ExecuteWhileWaiting(this Testably.Abstractions.Testing.Notification.IAwaitableCallback awaitable, System.Action callback) { } + public static Testably.Abstractions.Testing.Notification.IAwaitableCallback ExecuteWhileWaiting(this Testably.Abstractions.Testing.Notification.IAwaitableCallback awaitable, System.Func callback) { } + public interface IAwaitableCallback : System.IDisposable + { + void Wait(System.Func? filter = null, int timeout = 30000, int count = 1, System.Action? executeWhenWaiting = null); + } + public interface IAwaitableCallback : System.IDisposable, Testably.Abstractions.Testing.Notification.IAwaitableCallback + { + TFunc Wait(System.Func? filter = null, int timeout = 30000, int count = 1, System.Action? executeWhenWaiting = null); + } + } + public static class NotificationHandlerExtensions + { + public static Testably.Abstractions.Testing.Notification.IAwaitableCallback OnChanged(this Testably.Abstractions.Testing.FileSystem.INotificationHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action? notificationCallback = null, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + public static Testably.Abstractions.Testing.Notification.IAwaitableCallback OnCreated(this Testably.Abstractions.Testing.FileSystem.INotificationHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action? notificationCallback = null, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + public static Testably.Abstractions.Testing.Notification.IAwaitableCallback OnDeleted(this Testably.Abstractions.Testing.FileSystem.INotificationHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action? notificationCallback = null, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + } + public static class RandomProvider + { + public static Testably.Abstractions.Testing.RandomSystem.IRandomProvider Default() { } + public static Testably.Abstractions.Testing.RandomSystem.IRandomProvider Generate(int seed = -1, Testably.Abstractions.Testing.RandomProvider.Generator? guidGenerator = null, Testably.Abstractions.Testing.RandomProvider.Generator? intGenerator = null, Testably.Abstractions.Testing.RandomProvider.Generator? doubleGenerator = null, Testably.Abstractions.Testing.RandomProvider.Generator? byteGenerator = null) { } + public sealed class Generator : System.IDisposable + { + public void Dispose() { } + public T GetNext() { } + public static Testably.Abstractions.Testing.RandomProvider.Generator FromArray(T[] values) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator FromCallback(System.Func callback) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator FromEnumerable(System.Collections.Generic.IEnumerable enumerable) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator FromValue(T value) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator op_Implicit(System.Func callback) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator op_Implicit(T value) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator op_Implicit(T[] values) { } + } + } + public static class TimeProvider + { + public static Testably.Abstractions.Testing.TimeSystem.ITimeProvider Now() { } + public static Testably.Abstractions.Testing.TimeSystem.ITimeProvider Random() { } + public static Testably.Abstractions.Testing.TimeSystem.ITimeProvider Use(System.DateTime time) { } + } +} +namespace Testably.Abstractions.Testing.RandomSystem +{ + public interface IRandomProvider + { + System.Guid GetGuid(); + Testably.Abstractions.RandomSystem.IRandom GetRandom(int seed = -1); + } +} +namespace Testably.Abstractions.Testing.Statistics +{ + public interface IFileSystemStatistics + { + Testably.Abstractions.Testing.Statistics.IStatistics Directory { get; } + Testably.Abstractions.Testing.Statistics.IPathStatistics DirectoryInfo { get; } + Testably.Abstractions.Testing.Statistics.IPathStatistics DriveInfo { get; } + Testably.Abstractions.Testing.Statistics.IStatistics File { get; } + Testably.Abstractions.Testing.Statistics.IPathStatistics FileInfo { get; } + Testably.Abstractions.Testing.Statistics.IPathStatistics FileStream { get; } + Testably.Abstractions.Testing.Statistics.IPathStatistics FileSystemWatcher { get; } + Testably.Abstractions.Testing.Statistics.IStatistics Path { get; } + } + public interface IPathStatistics : Testably.Abstractions.Testing.Statistics.IStatistics + { + Testably.Abstractions.Testing.Statistics.IStatistics this[string path] { get; } + } + public interface IStatistics + { + Testably.Abstractions.Testing.Statistics.MethodStatistic[] Methods { get; } + } + public sealed class MethodStatistic + { + public int Counter { get; } + public string Name { get; } + public Testably.Abstractions.Testing.Statistics.ParameterDescription[] Parameters { get; } + public override string ToString() { } + } + public abstract class ParameterDescription + { + protected ParameterDescription(bool isOutParameter) { } + public bool IsOutParameter { get; } + public bool Is(System.Func comparer) { } + public bool Is(T value) { } + public bool Is(T[] value) { } + public static Testably.Abstractions.Testing.Statistics.ParameterDescription FromOutParameter(T value) { } + public static Testably.Abstractions.Testing.Statistics.ParameterDescription FromParameter(T value) { } + } +} +namespace Testably.Abstractions.Testing.Storage +{ + public interface IStorageDrive : System.IO.Abstractions.IDriveInfo, System.IO.Abstractions.IFileSystemEntity + { + bool IsUncPath { get; } + Testably.Abstractions.Testing.Storage.IStorageDrive ChangeUsedBytes(long usedBytesDelta); + Testably.Abstractions.Testing.Storage.IStorageDrive SetDriveFormat(string driveFormat = "NTFS"); + Testably.Abstractions.Testing.Storage.IStorageDrive SetDriveType(System.IO.DriveType driveType = 3); + Testably.Abstractions.Testing.Storage.IStorageDrive SetIsReady(bool isReady = true); + Testably.Abstractions.Testing.Storage.IStorageDrive SetTotalSize(long totalSize = 1073741824); + } +} +namespace Testably.Abstractions.Testing.TimeSystem +{ + public interface INotificationHandler + { + Testably.Abstractions.Testing.Notification.IAwaitableCallback DateTimeRead(System.Action? callback = null, System.Func? predicate = null); + Testably.Abstractions.Testing.Notification.IAwaitableCallback TaskDelay(System.Action? callback = null, System.Func? predicate = null); + Testably.Abstractions.Testing.Notification.IAwaitableCallback ThreadSleep(System.Action? callback = null, System.Func? predicate = null); + } + public interface ITimeProvider + { + System.DateTime MaxValue { get; set; } + System.DateTime MinValue { get; set; } + System.DateTime UnixEpoch { get; set; } + void AdvanceBy(System.TimeSpan interval); + System.DateTime Read(); + void SetTo(System.DateTime value); + } + public interface ITimerHandler + { + Testably.Abstractions.Testing.TimeSystem.ITimerMock this[int index] { get; } + } + public interface ITimerMock : System.IDisposable, Testably.Abstractions.TimeSystem.ITimeSystemEntity, Testably.Abstractions.TimeSystem.ITimer + { + Testably.Abstractions.Testing.TimeSystem.ITimerMock Wait(int executionCount = 1, int timeout = 10000, System.Action? callback = null); + } + public interface ITimerStrategy + { + Testably.Abstractions.Testing.TimeSystem.TimerMode Mode { get; } + bool SwallowExceptions { get; } + } + public enum TimerMode + { + StartImmediately = 1, + StartOnMockWait = 2, + } + public class TimerStrategy : Testably.Abstractions.Testing.TimeSystem.ITimerStrategy + { + public TimerStrategy(Testably.Abstractions.Testing.TimeSystem.TimerMode mode = 1, bool swallowExceptions = false) { } + public Testably.Abstractions.Testing.TimeSystem.TimerMode Mode { get; } + public bool SwallowExceptions { get; } + public static Testably.Abstractions.Testing.TimeSystem.ITimerStrategy Default { get; } + } +} \ No newline at end of file diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Testing_netstandard2.1.txt b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Testing_netstandard2.1.txt new file mode 100644 index 000000000..91a86c45c --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions.Testing_netstandard2.1.txt @@ -0,0 +1,359 @@ +[assembly: System.CLSCompliant(true)] +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/Testably/Testably.Abstractions.git")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Testably.Abstractions.Testing.Tests")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName=".NET Standard 2.1")] +namespace Testably.Abstractions.Testing.FileSystem +{ + public class ChangeDescription + { + public System.IO.WatcherChangeTypes ChangeType { get; } + public Testably.Abstractions.Testing.FileSystemTypes FileSystemType { get; } + public string? Name { get; } + public System.IO.NotifyFilters NotifyFilters { get; } + public string? OldName { get; } + public string? OldPath { get; } + public string Path { get; } + public override string ToString() { } + } + public class DefaultAccessControlStrategy : Testably.Abstractions.Testing.FileSystem.IAccessControlStrategy + { + public DefaultAccessControlStrategy(System.Func callback) { } + public bool IsAccessGranted(string fullPath, Testably.Abstractions.Helpers.IFileSystemExtensibility extensibility) { } + } + public class DefaultSafeFileHandleStrategy : Testably.Abstractions.Testing.FileSystem.ISafeFileHandleStrategy + { + public DefaultSafeFileHandleStrategy(System.Func callback) { } + public Testably.Abstractions.Testing.FileSystem.SafeFileHandleMock MapSafeFileHandle(Microsoft.Win32.SafeHandles.SafeFileHandle fileHandle) { } + } + public interface IAccessControlStrategy + { + bool IsAccessGranted(string fullPath, Testably.Abstractions.Helpers.IFileSystemExtensibility extensibility); + } + public interface IInterceptionHandler : System.IO.Abstractions.IFileSystemEntity + { + Testably.Abstractions.Testing.MockFileSystem Event(System.Action interceptionCallback, System.Func? predicate = null); + } + public interface INotificationHandler : System.IO.Abstractions.IFileSystemEntity + { + Testably.Abstractions.Testing.Notification.IAwaitableCallback OnEvent(System.Action? notificationCallback = null, System.Func? predicate = null); + } + public interface ISafeFileHandleStrategy + { + Testably.Abstractions.Testing.FileSystem.SafeFileHandleMock MapSafeFileHandle(Microsoft.Win32.SafeHandles.SafeFileHandle fileHandle); + } + public class NullAccessControlStrategy : Testably.Abstractions.Testing.FileSystem.IAccessControlStrategy + { + public NullAccessControlStrategy() { } + public bool IsAccessGranted(string fullPath, Testably.Abstractions.Helpers.IFileSystemExtensibility extensibility) { } + } + public class NullSafeFileHandleStrategy : Testably.Abstractions.Testing.FileSystem.ISafeFileHandleStrategy + { + public NullSafeFileHandleStrategy() { } + public Testably.Abstractions.Testing.FileSystem.SafeFileHandleMock MapSafeFileHandle(Microsoft.Win32.SafeHandles.SafeFileHandle fileHandle) { } + } + public class SafeFileHandleMock + { + public SafeFileHandleMock(string path, System.IO.FileMode mode = 3, System.IO.FileShare share = 0) { } + public System.IO.FileMode Mode { get; } + public string Path { get; } + public System.IO.FileShare Share { get; } + } +} +namespace Testably.Abstractions.Testing.FileSystemInitializer +{ + public class DirectoryDescription : Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription + { + public DirectoryDescription(string name) { } + public DirectoryDescription(string name, params Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription[] children) { } + public Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription[] Children { get; } + public override Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription this[string path] { get; } + } + public class FileDescription : Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription + { + public FileDescription(string name, byte[] bytes) { } + public FileDescription(string name, string? content = null) { } + public byte[]? Bytes { get; } + public string? Content { get; } + public bool IsReadOnly { get; set; } + public override Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription this[string? path] { get; } + } + public abstract class FileSystemInfoDescription + { + protected FileSystemInfoDescription(string name) { } + public abstract Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription this[string path] { get; } + public string Name { get; } + } + public interface IDirectoryCleaner : System.IDisposable + { + string BasePath { get; } + } + public interface IFileManipulator : System.IO.Abstractions.IFileSystemEntity + { + System.IO.Abstractions.IFileInfo File { get; } + Testably.Abstractions.Testing.FileSystemInitializer.IFileManipulator HasBytesContent(byte[] bytes); + Testably.Abstractions.Testing.FileSystemInitializer.IFileManipulator HasStringContent(string contents); + } + public interface IFileSystemDirectoryInitializer : Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer + where out TFileSystem : System.IO.Abstractions.IFileSystem + { + System.IO.Abstractions.IDirectoryInfo Directory { get; } + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemDirectoryInitializer Initialized(System.Action> subdirectoryInitializer); + } + public interface IFileSystemFileInitializer : Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer + where out TFileSystem : System.IO.Abstractions.IFileSystem + { + System.IO.Abstractions.IFileInfo File { get; } + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemFileInitializer Which(System.Action fileManipulation); + } + public interface IFileSystemInitializer + where out TFileSystem : System.IO.Abstractions.IFileSystem + { + System.IO.Abstractions.IDirectoryInfo BaseDirectory { get; } + TFileSystem FileSystem { get; } + System.IO.Abstractions.IFileSystemInfo this[int index] { get; } + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer With(params Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription[] descriptions); + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer With(TDescription[] descriptions) + where TDescription : Testably.Abstractions.Testing.FileSystemInitializer.FileSystemInfoDescription; + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemFileInitializer WithAFile(string? extension = null); + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemDirectoryInitializer WithASubdirectory(); + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemFileInitializer WithFile(string fileName); + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer WithSubdirectories(params string[] paths); + Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemDirectoryInitializer WithSubdirectory(string directoryName); + } + [System.Serializable] + public class TestingException : System.Exception + { + public TestingException(string message) { } + protected TestingException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public TestingException(string message, System.Exception inner) { } + } +} +namespace Testably.Abstractions.Testing +{ + public static class FileSystemInitializerExtensions + { + public static Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer Initialize(this TFileSystem fileSystem, System.Action? options = null) + where TFileSystem : System.IO.Abstractions.IFileSystem { } + public static void InitializeEmbeddedResourcesFromAssembly(this System.IO.Abstractions.IFileSystem fileSystem, string directoryPath, System.Reflection.Assembly assembly, string? relativePath = null, string searchPattern = "*", System.IO.SearchOption searchOption = 1) { } + public static Testably.Abstractions.Testing.FileSystemInitializer.IFileSystemInitializer InitializeIn(this TFileSystem fileSystem, string basePath, System.Action? options = null) + where TFileSystem : System.IO.Abstractions.IFileSystem { } + public static Testably.Abstractions.Testing.FileSystemInitializer.IDirectoryCleaner SetCurrentDirectoryToEmptyTemporaryDirectory(this System.IO.Abstractions.IFileSystem fileSystem, string? prefix = null, System.Action? logger = null) { } + } + public class FileSystemInitializerOptions + { + public FileSystemInitializerOptions() { } + public bool InitializeTempDirectory { get; set; } + } + [System.Flags] + public enum FileSystemTypes + { + Directory = 1, + File = 2, + DirectoryOrFile = 3, + } + public static class InterceptionHandlerExtensions + { + public static Testably.Abstractions.Testing.MockFileSystem Changing(this Testably.Abstractions.Testing.FileSystem.IInterceptionHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action interceptionCallback, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + public static Testably.Abstractions.Testing.MockFileSystem Creating(this Testably.Abstractions.Testing.FileSystem.IInterceptionHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action interceptionCallback, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + public static Testably.Abstractions.Testing.MockFileSystem Deleting(this Testably.Abstractions.Testing.FileSystem.IInterceptionHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action interceptionCallback, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + } + public sealed class MockFileSystem : System.IO.Abstractions.IFileSystem + { + public MockFileSystem() { } + public System.IO.Abstractions.IDirectory Directory { get; } + public System.IO.Abstractions.IDirectoryInfoFactory DirectoryInfo { get; } + public System.IO.Abstractions.IDriveInfoFactory DriveInfo { get; } + public System.IO.Abstractions.IFile File { get; } + public System.IO.Abstractions.IFileInfoFactory FileInfo { get; } + public System.IO.Abstractions.IFileStreamFactory FileStream { get; } + public System.IO.Abstractions.IFileSystemWatcherFactory FileSystemWatcher { get; } + public Testably.Abstractions.Testing.FileSystem.IInterceptionHandler Intercept { get; } + public Testably.Abstractions.Testing.FileSystem.INotificationHandler Notify { get; } + public System.IO.Abstractions.IPath Path { get; } + public Testably.Abstractions.IRandomSystem RandomSystem { get; } + public Testably.Abstractions.Testing.Statistics.IFileSystemStatistics Statistics { get; } + public Testably.Abstractions.ITimeSystem TimeSystem { get; } + public override string ToString() { } + public Testably.Abstractions.Testing.MockFileSystem WithAccessControlStrategy(Testably.Abstractions.Testing.FileSystem.IAccessControlStrategy accessControlStrategy) { } + public Testably.Abstractions.Testing.MockFileSystem WithDrive(string? drive, System.Action? driveCallback = null) { } + public Testably.Abstractions.Testing.MockFileSystem WithSafeFileHandleStrategy(Testably.Abstractions.Testing.FileSystem.ISafeFileHandleStrategy safeFileHandleStrategy) { } + } + public static class MockFileSystemExtensions + { + public static System.IO.Abstractions.IDriveInfo GetDefaultDrive(this Testably.Abstractions.Testing.MockFileSystem mockFileSystem) { } + public static Testably.Abstractions.Testing.MockFileSystem WithDrive(this Testably.Abstractions.Testing.MockFileSystem mockFileSystem, System.Action driveCallback) { } + public static Testably.Abstractions.Testing.MockFileSystem WithUncDrive(this Testably.Abstractions.Testing.MockFileSystem mockFileSystem, string server, System.Action? driveCallback = null) { } + } + public sealed class MockRandomSystem : Testably.Abstractions.IRandomSystem + { + public MockRandomSystem() { } + public MockRandomSystem(Testably.Abstractions.Testing.RandomSystem.IRandomProvider randomProviderProvider) { } + public Testably.Abstractions.RandomSystem.IGuid Guid { get; } + public Testably.Abstractions.RandomSystem.IRandomFactory Random { get; } + public Testably.Abstractions.Testing.RandomSystem.IRandomProvider RandomProvider { get; } + public override string ToString() { } + } + public sealed class MockTimeSystem : Testably.Abstractions.ITimeSystem + { + public MockTimeSystem() { } + public MockTimeSystem(System.DateTime time) { } + public MockTimeSystem(Testably.Abstractions.Testing.TimeSystem.ITimeProvider timeProvider) { } + public Testably.Abstractions.TimeSystem.IDateTime DateTime { get; } + public Testably.Abstractions.Testing.TimeSystem.INotificationHandler On { get; } + public Testably.Abstractions.TimeSystem.ITask Task { get; } + public Testably.Abstractions.TimeSystem.IThread Thread { get; } + public Testably.Abstractions.Testing.TimeSystem.ITimeProvider TimeProvider { get; } + public Testably.Abstractions.TimeSystem.ITimerFactory Timer { get; } + public Testably.Abstractions.Testing.TimeSystem.ITimerHandler TimerHandler { get; } + public override string ToString() { } + public Testably.Abstractions.Testing.MockTimeSystem WithTimerStrategy(Testably.Abstractions.Testing.TimeSystem.ITimerStrategy timerStrategy) { } + } + public static class Notification + { + public static Testably.Abstractions.Testing.Notification.IAwaitableCallback ExecuteWhileWaiting(this Testably.Abstractions.Testing.Notification.IAwaitableCallback awaitable, System.Action callback) { } + public static Testably.Abstractions.Testing.Notification.IAwaitableCallback ExecuteWhileWaiting(this Testably.Abstractions.Testing.Notification.IAwaitableCallback awaitable, System.Func callback) { } + public interface IAwaitableCallback : System.IDisposable + { + void Wait(System.Func? filter = null, int timeout = 30000, int count = 1, System.Action? executeWhenWaiting = null); + } + public interface IAwaitableCallback : System.IDisposable, Testably.Abstractions.Testing.Notification.IAwaitableCallback + { + TFunc Wait(System.Func? filter = null, int timeout = 30000, int count = 1, System.Action? executeWhenWaiting = null); + } + } + public static class NotificationHandlerExtensions + { + public static Testably.Abstractions.Testing.Notification.IAwaitableCallback OnChanged(this Testably.Abstractions.Testing.FileSystem.INotificationHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action? notificationCallback = null, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + public static Testably.Abstractions.Testing.Notification.IAwaitableCallback OnCreated(this Testably.Abstractions.Testing.FileSystem.INotificationHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action? notificationCallback = null, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + public static Testably.Abstractions.Testing.Notification.IAwaitableCallback OnDeleted(this Testably.Abstractions.Testing.FileSystem.INotificationHandler handler, Testably.Abstractions.Testing.FileSystemTypes fileSystemType, System.Action? notificationCallback = null, string path = "", string searchPattern = "*", System.Func? predicate = null) { } + } + public static class RandomProvider + { + public static Testably.Abstractions.Testing.RandomSystem.IRandomProvider Default() { } + public static Testably.Abstractions.Testing.RandomSystem.IRandomProvider Generate(int seed = -1, Testably.Abstractions.Testing.RandomProvider.Generator? guidGenerator = null, Testably.Abstractions.Testing.RandomProvider.Generator? intGenerator = null, Testably.Abstractions.Testing.RandomProvider.Generator? doubleGenerator = null, Testably.Abstractions.Testing.RandomProvider.Generator? byteGenerator = null) { } + public sealed class Generator : System.IDisposable + { + public void Dispose() { } + public T GetNext() { } + public static Testably.Abstractions.Testing.RandomProvider.Generator FromArray(T[] values) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator FromCallback(System.Func callback) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator FromEnumerable(System.Collections.Generic.IEnumerable enumerable) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator FromValue(T value) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator op_Implicit(System.Func callback) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator op_Implicit(T value) { } + public static Testably.Abstractions.Testing.RandomProvider.Generator op_Implicit(T[] values) { } + } + } + public static class TimeProvider + { + public static Testably.Abstractions.Testing.TimeSystem.ITimeProvider Now() { } + public static Testably.Abstractions.Testing.TimeSystem.ITimeProvider Random() { } + public static Testably.Abstractions.Testing.TimeSystem.ITimeProvider Use(System.DateTime time) { } + } +} +namespace Testably.Abstractions.Testing.RandomSystem +{ + public interface IRandomProvider + { + System.Guid GetGuid(); + Testably.Abstractions.RandomSystem.IRandom GetRandom(int seed = -1); + } +} +namespace Testably.Abstractions.Testing.Statistics +{ + public interface IFileSystemStatistics + { + Testably.Abstractions.Testing.Statistics.IStatistics Directory { get; } + Testably.Abstractions.Testing.Statistics.IPathStatistics DirectoryInfo { get; } + Testably.Abstractions.Testing.Statistics.IPathStatistics DriveInfo { get; } + Testably.Abstractions.Testing.Statistics.IStatistics File { get; } + Testably.Abstractions.Testing.Statistics.IPathStatistics FileInfo { get; } + Testably.Abstractions.Testing.Statistics.IPathStatistics FileStream { get; } + Testably.Abstractions.Testing.Statistics.IPathStatistics FileSystemWatcher { get; } + Testably.Abstractions.Testing.Statistics.IStatistics Path { get; } + } + public interface IPathStatistics : Testably.Abstractions.Testing.Statistics.IStatistics + { + Testably.Abstractions.Testing.Statistics.IStatistics this[string path] { get; } + } + public interface IStatistics + { + Testably.Abstractions.Testing.Statistics.MethodStatistic[] Methods { get; } + } + public sealed class MethodStatistic + { + public int Counter { get; } + public string Name { get; } + public Testably.Abstractions.Testing.Statistics.ParameterDescription[] Parameters { get; } + public override string ToString() { } + } + public abstract class ParameterDescription + { + protected ParameterDescription(bool isOutParameter) { } + public bool IsOutParameter { get; } + public bool Is(System.Func comparer) { } + public bool Is(System.ReadOnlySpan value) { } + public bool Is(System.Span value) { } + public bool Is(T value) { } + public bool Is(T[] value) { } + public static Testably.Abstractions.Testing.Statistics.ParameterDescription FromOutParameter(T value) { } + public static Testably.Abstractions.Testing.Statistics.ParameterDescription FromParameter(System.ReadOnlySpan value) { } + public static Testably.Abstractions.Testing.Statistics.ParameterDescription FromParameter(System.Span value) { } + public static Testably.Abstractions.Testing.Statistics.ParameterDescription FromParameter(T value) { } + } +} +namespace Testably.Abstractions.Testing.Storage +{ + public interface IStorageDrive : System.IO.Abstractions.IDriveInfo, System.IO.Abstractions.IFileSystemEntity + { + bool IsUncPath { get; } + Testably.Abstractions.Testing.Storage.IStorageDrive ChangeUsedBytes(long usedBytesDelta); + Testably.Abstractions.Testing.Storage.IStorageDrive SetDriveFormat(string driveFormat = "NTFS"); + Testably.Abstractions.Testing.Storage.IStorageDrive SetDriveType(System.IO.DriveType driveType = 3); + Testably.Abstractions.Testing.Storage.IStorageDrive SetIsReady(bool isReady = true); + Testably.Abstractions.Testing.Storage.IStorageDrive SetTotalSize(long totalSize = 1073741824); + } +} +namespace Testably.Abstractions.Testing.TimeSystem +{ + public interface INotificationHandler + { + Testably.Abstractions.Testing.Notification.IAwaitableCallback DateTimeRead(System.Action? callback = null, System.Func? predicate = null); + Testably.Abstractions.Testing.Notification.IAwaitableCallback TaskDelay(System.Action? callback = null, System.Func? predicate = null); + Testably.Abstractions.Testing.Notification.IAwaitableCallback ThreadSleep(System.Action? callback = null, System.Func? predicate = null); + } + public interface ITimeProvider + { + System.DateTime MaxValue { get; set; } + System.DateTime MinValue { get; set; } + System.DateTime UnixEpoch { get; set; } + void AdvanceBy(System.TimeSpan interval); + System.DateTime Read(); + void SetTo(System.DateTime value); + } + public interface ITimerHandler + { + Testably.Abstractions.Testing.TimeSystem.ITimerMock this[int index] { get; } + } + public interface ITimerMock : System.IAsyncDisposable, System.IDisposable, Testably.Abstractions.TimeSystem.ITimeSystemEntity, Testably.Abstractions.TimeSystem.ITimer + { + Testably.Abstractions.Testing.TimeSystem.ITimerMock Wait(int executionCount = 1, int timeout = 10000, System.Action? callback = null); + } + public interface ITimerStrategy + { + Testably.Abstractions.Testing.TimeSystem.TimerMode Mode { get; } + bool SwallowExceptions { get; } + } + public enum TimerMode + { + StartImmediately = 1, + StartOnMockWait = 2, + } + public class TimerStrategy : Testably.Abstractions.Testing.TimeSystem.ITimerStrategy + { + public TimerStrategy(Testably.Abstractions.Testing.TimeSystem.TimerMode mode = 1, bool swallowExceptions = false) { } + public Testably.Abstractions.Testing.TimeSystem.TimerMode Mode { get; } + public bool SwallowExceptions { get; } + public static Testably.Abstractions.Testing.TimeSystem.ITimerStrategy Default { get; } + } +} \ No newline at end of file diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions_net6.0.txt b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions_net6.0.txt new file mode 100644 index 000000000..aa0b31e17 --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions_net6.0.txt @@ -0,0 +1,33 @@ +[assembly: System.CLSCompliant(true)] +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/Testably/Testably.Abstractions.git")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Testably.Abstractions.Tests")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName=".NET 6.0")] +namespace Testably.Abstractions +{ + public sealed class RealFileSystem : System.IO.Abstractions.IFileSystem + { + public RealFileSystem() { } + public System.IO.Abstractions.IDirectory Directory { get; } + public System.IO.Abstractions.IDirectoryInfoFactory DirectoryInfo { get; } + public System.IO.Abstractions.IDriveInfoFactory DriveInfo { get; } + public System.IO.Abstractions.IFile File { get; } + public System.IO.Abstractions.IFileInfoFactory FileInfo { get; } + public System.IO.Abstractions.IFileStreamFactory FileStream { get; } + public System.IO.Abstractions.IFileSystemWatcherFactory FileSystemWatcher { get; } + public System.IO.Abstractions.IPath Path { get; } + } + public sealed class RealRandomSystem : Testably.Abstractions.IRandomSystem + { + public RealRandomSystem() { } + public Testably.Abstractions.RandomSystem.IGuid Guid { get; } + public Testably.Abstractions.RandomSystem.IRandomFactory Random { get; } + } + public sealed class RealTimeSystem : Testably.Abstractions.ITimeSystem + { + public RealTimeSystem() { } + public Testably.Abstractions.TimeSystem.IDateTime DateTime { get; } + public Testably.Abstractions.TimeSystem.ITask Task { get; } + public Testably.Abstractions.TimeSystem.IThread Thread { get; } + public Testably.Abstractions.TimeSystem.ITimerFactory Timer { get; } + } +} \ No newline at end of file diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions_net7.0.txt b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions_net7.0.txt new file mode 100644 index 000000000..703e74a7c --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions_net7.0.txt @@ -0,0 +1,33 @@ +[assembly: System.CLSCompliant(true)] +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/Testably/Testably.Abstractions.git")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Testably.Abstractions.Tests")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v7.0", FrameworkDisplayName=".NET 7.0")] +namespace Testably.Abstractions +{ + public sealed class RealFileSystem : System.IO.Abstractions.IFileSystem + { + public RealFileSystem() { } + public System.IO.Abstractions.IDirectory Directory { get; } + public System.IO.Abstractions.IDirectoryInfoFactory DirectoryInfo { get; } + public System.IO.Abstractions.IDriveInfoFactory DriveInfo { get; } + public System.IO.Abstractions.IFile File { get; } + public System.IO.Abstractions.IFileInfoFactory FileInfo { get; } + public System.IO.Abstractions.IFileStreamFactory FileStream { get; } + public System.IO.Abstractions.IFileSystemWatcherFactory FileSystemWatcher { get; } + public System.IO.Abstractions.IPath Path { get; } + } + public sealed class RealRandomSystem : Testably.Abstractions.IRandomSystem + { + public RealRandomSystem() { } + public Testably.Abstractions.RandomSystem.IGuid Guid { get; } + public Testably.Abstractions.RandomSystem.IRandomFactory Random { get; } + } + public sealed class RealTimeSystem : Testably.Abstractions.ITimeSystem + { + public RealTimeSystem() { } + public Testably.Abstractions.TimeSystem.IDateTime DateTime { get; } + public Testably.Abstractions.TimeSystem.ITask Task { get; } + public Testably.Abstractions.TimeSystem.IThread Thread { get; } + public Testably.Abstractions.TimeSystem.ITimerFactory Timer { get; } + } +} \ No newline at end of file diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions_net8.0.txt b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions_net8.0.txt new file mode 100644 index 000000000..83375a2e5 --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions_net8.0.txt @@ -0,0 +1,33 @@ +[assembly: System.CLSCompliant(true)] +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/Testably/Testably.Abstractions.git")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Testably.Abstractions.Tests")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName=".NET 8.0")] +namespace Testably.Abstractions +{ + public sealed class RealFileSystem : System.IO.Abstractions.IFileSystem + { + public RealFileSystem() { } + public System.IO.Abstractions.IDirectory Directory { get; } + public System.IO.Abstractions.IDirectoryInfoFactory DirectoryInfo { get; } + public System.IO.Abstractions.IDriveInfoFactory DriveInfo { get; } + public System.IO.Abstractions.IFile File { get; } + public System.IO.Abstractions.IFileInfoFactory FileInfo { get; } + public System.IO.Abstractions.IFileStreamFactory FileStream { get; } + public System.IO.Abstractions.IFileSystemWatcherFactory FileSystemWatcher { get; } + public System.IO.Abstractions.IPath Path { get; } + } + public sealed class RealRandomSystem : Testably.Abstractions.IRandomSystem + { + public RealRandomSystem() { } + public Testably.Abstractions.RandomSystem.IGuid Guid { get; } + public Testably.Abstractions.RandomSystem.IRandomFactory Random { get; } + } + public sealed class RealTimeSystem : Testably.Abstractions.ITimeSystem + { + public RealTimeSystem() { } + public Testably.Abstractions.TimeSystem.IDateTime DateTime { get; } + public Testably.Abstractions.TimeSystem.ITask Task { get; } + public Testably.Abstractions.TimeSystem.IThread Thread { get; } + public Testably.Abstractions.TimeSystem.ITimerFactory Timer { get; } + } +} \ No newline at end of file diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions_netstandard2.0.txt b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions_netstandard2.0.txt new file mode 100644 index 000000000..6c5af245f --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions_netstandard2.0.txt @@ -0,0 +1,33 @@ +[assembly: System.CLSCompliant(true)] +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/Testably/Testably.Abstractions.git")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Testably.Abstractions.Tests")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName=".NET Standard 2.0")] +namespace Testably.Abstractions +{ + public sealed class RealFileSystem : System.IO.Abstractions.IFileSystem + { + public RealFileSystem() { } + public System.IO.Abstractions.IDirectory Directory { get; } + public System.IO.Abstractions.IDirectoryInfoFactory DirectoryInfo { get; } + public System.IO.Abstractions.IDriveInfoFactory DriveInfo { get; } + public System.IO.Abstractions.IFile File { get; } + public System.IO.Abstractions.IFileInfoFactory FileInfo { get; } + public System.IO.Abstractions.IFileStreamFactory FileStream { get; } + public System.IO.Abstractions.IFileSystemWatcherFactory FileSystemWatcher { get; } + public System.IO.Abstractions.IPath Path { get; } + } + public sealed class RealRandomSystem : Testably.Abstractions.IRandomSystem + { + public RealRandomSystem() { } + public Testably.Abstractions.RandomSystem.IGuid Guid { get; } + public Testably.Abstractions.RandomSystem.IRandomFactory Random { get; } + } + public sealed class RealTimeSystem : Testably.Abstractions.ITimeSystem + { + public RealTimeSystem() { } + public Testably.Abstractions.TimeSystem.IDateTime DateTime { get; } + public Testably.Abstractions.TimeSystem.ITask Task { get; } + public Testably.Abstractions.TimeSystem.IThread Thread { get; } + public Testably.Abstractions.TimeSystem.ITimerFactory Timer { get; } + } +} \ No newline at end of file diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions_netstandard2.1.txt b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions_netstandard2.1.txt new file mode 100644 index 000000000..15db8c729 --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/Expected/Testably.Abstractions_netstandard2.1.txt @@ -0,0 +1,33 @@ +[assembly: System.CLSCompliant(true)] +[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/Testably/Testably.Abstractions.git")] +[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Testably.Abstractions.Tests")] +[assembly: System.Runtime.Versioning.TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName=".NET Standard 2.1")] +namespace Testably.Abstractions +{ + public sealed class RealFileSystem : System.IO.Abstractions.IFileSystem + { + public RealFileSystem() { } + public System.IO.Abstractions.IDirectory Directory { get; } + public System.IO.Abstractions.IDirectoryInfoFactory DirectoryInfo { get; } + public System.IO.Abstractions.IDriveInfoFactory DriveInfo { get; } + public System.IO.Abstractions.IFile File { get; } + public System.IO.Abstractions.IFileInfoFactory FileInfo { get; } + public System.IO.Abstractions.IFileStreamFactory FileStream { get; } + public System.IO.Abstractions.IFileSystemWatcherFactory FileSystemWatcher { get; } + public System.IO.Abstractions.IPath Path { get; } + } + public sealed class RealRandomSystem : Testably.Abstractions.IRandomSystem + { + public RealRandomSystem() { } + public Testably.Abstractions.RandomSystem.IGuid Guid { get; } + public Testably.Abstractions.RandomSystem.IRandomFactory Random { get; } + } + public sealed class RealTimeSystem : Testably.Abstractions.ITimeSystem + { + public RealTimeSystem() { } + public Testably.Abstractions.TimeSystem.IDateTime DateTime { get; } + public Testably.Abstractions.TimeSystem.ITask Task { get; } + public Testably.Abstractions.TimeSystem.IThread Thread { get; } + public Testably.Abstractions.TimeSystem.ITimerFactory Timer { get; } + } +} \ No newline at end of file diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Helper.cs b/Tests/Api/Testably.Abstractions.Api.Tests/Helper.cs new file mode 100644 index 000000000..ddcb92cba --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/Helper.cs @@ -0,0 +1,62 @@ +using PublicApiGenerator; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Xml.Linq; +using System.Xml.XPath; + +namespace Testably.Abstractions.Api.Tests; + +public static class Helper +{ + public static string CreatePublicApi(string framework, string assemblyName) + { + string assemblyFile = CombinedPaths("Build", "Binaries", framework, $"{assemblyName}.dll"); + Assembly assembly = Assembly.LoadFile(assemblyFile); + string publicApi = assembly.GeneratePublicApi(options: null); + return publicApi.Replace("\r\n", "\n"); + } + + public static string GetExpectedApi(string framework, string assemblyName) + { + string expectedPath = CombinedPaths("Tests", "Api", "Testably.Abstractions.Api.Tests", + "Expected", $"{assemblyName}_{framework}.txt"); + try + { + return File.ReadAllText(expectedPath) + .Replace("\r\n", "\n"); + } + catch + { + return string.Empty; + } + } + + public static IEnumerable GetTargetFrameworks() + { + string csproj = CombinedPaths("Source", "Directory.Build.props"); + XDocument project = XDocument.Load(csproj); + XElement? targetFrameworks = + project.XPathSelectElement("/Project/PropertyGroup/TargetFrameworks"); + foreach (string targetFramework in targetFrameworks!.Value.Split(';')) + { + yield return targetFramework; + } + } + + public static void SetExpectedApi(string framework, string assemblyName, string publicApi) + { + string expectedPath = CombinedPaths("Tests", "Api", "Testably.Abstractions.Api.Tests", + "Expected", $"{assemblyName}_{framework}.txt"); + Directory.CreateDirectory(Path.GetDirectoryName(expectedPath)!); + File.WriteAllText(expectedPath, publicApi); + } + + private static string CombinedPaths(params string[] paths) => + Path.GetFullPath(Path.Combine(paths.Prepend(GetSolutionDirectory()).ToArray())); + + private static string GetSolutionDirectory([CallerFilePath] string path = "") => + Path.Combine(Path.GetDirectoryName(path)!, "..", "..", ".."); +} diff --git a/Tests/Api/Testably.Abstractions.Api.Tests/Testably.Abstractions.Api.Tests.csproj b/Tests/Api/Testably.Abstractions.Api.Tests/Testably.Abstractions.Api.Tests.csproj new file mode 100644 index 000000000..147ff937f --- /dev/null +++ b/Tests/Api/Testably.Abstractions.Api.Tests/Testably.Abstractions.Api.Tests.csproj @@ -0,0 +1,12 @@ + + + + net8.0 + + + + + + + +