diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index f43b468..6d1a0d9 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -18,22 +18,12 @@ jobs: runs-on: windows-latest steps: - uses: actions/checkout@v1 - - - name: NuGet Setup - uses: actions/setup-dotnet@v4 - with: - dotnet-version: | - 7.0.x - 8.0.x - - name: "NuGet Add Source Organization" - run: if ("${{ secrets.ORGANIZATION_SOURCE_PACKAGE_PASSWORD }}" -ne "") { dotnet nuget add source --username ${{ secrets.ORGANIZATION_SOURCE_PACKAGE_USERNAME }} --password ${{ secrets.ORGANIZATION_SOURCE_PACKAGE_PASSWORD }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/${{github.repository_owner}}/index.json" } - name: Run './build/build.cmd' run: ./build/build.cmd --root ./build env: GitHubToken: ${{ secrets.GITHUB_TOKEN }} - SignFile: ${{ secrets.SIGN_FILE }} - SignPassword: ${{ secrets.SIGN_PASSWORD }} - InstallationFiles: ${{ secrets.INSTALLATION_FILES }} + SignFile: ${{ secrets.SIGN_FILE_AZURE }} + SignPassword: ${{ secrets.SIGN_PASSWORD_AZURE }} NugetApiUrl: ${{ secrets.NUGET_API_URL }} NugetApiKey: ${{ secrets.NUGET_API_KEY }} \ No newline at end of file diff --git a/Build/.nuke/build.schema.json b/Build/.nuke/build.schema.json index 7d7bee1..705bebe 100644 --- a/Build/.nuke/build.schema.json +++ b/Build/.nuke/build.schema.json @@ -222,6 +222,9 @@ "ApplicationType": { "type": "string" }, + "EnableForkedRepository": { + "type": "boolean" + }, "Folder": { "type": "string" }, diff --git a/CHANGELOG.md b/CHANGELOG.md index 98ac1e8..960b899 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,29 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [1.8.0] / 2024-12-16 - 2024-12-19 +### Features +- Make project public +- Fix test filter limit size `arguments` (Fix: #65) +### Application +- Remove `net46` framework, remove `Revit 2017` and `Revit 2018` support. +### Command +- Fix `AppUtils` to show `ProductName`. +- Update `ProcessStart` to show `arguments` length in debug. +- Update `RevitTestProcessStart` to create temp file for test `arguments`. +- Update `RunCommand` to read test `arguments` from temp file. +### Console +- Update `ricaun.Revit.Installation` to `1.3.1`. +- Add `EnvironmentVariable` class, with `ProcessArguments` and `TimeoutNotBusyMaxSeconds` variables. +- Remove not used `RevitAddinDisable` class. +- Update `RevitTestUtils` with `MinimalRevitVersion` to `2019`. +### Build +- Update `ci` to use public `nuget` packages. +### TestAdapter +- Update `ricaun.Security.WinTrust` to `1.1.0`. +### Tests +- Add `net47` with `Revit 2019` tests. + ## [1.7.1] / 2024-12-07 - 2024-12-10 ### Application - Update to use `AssemblyMetadata` to set configuration. (Fix: #64) @@ -546,6 +569,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - [x] TestsFail [vNext]: ../../compare/1.0.0...HEAD +[1.8.0]: ../../compare/1.7.1...1.8.0 [1.7.1]: ../../compare/1.7.0...1.7.1 [1.7.0]: ../../compare/1.6.0...1.7.0 [1.6.0]: ../../compare/1.5.0...1.6.0 diff --git a/Directory.Build.props b/Directory.Build.props index 3677869..1114a19 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,5 +1,5 @@ - 1.7.1 + 1.8.0 \ No newline at end of file diff --git a/README.md b/README.md index 4562740..b0e7f19 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ricaun.RevitTest -[![Revit 2017](https://img.shields.io/badge/Revit-2017+-blue.svg)](https://github.com/ricaun-io/ricaun.RevitTest) +[![Revit 2019](https://img.shields.io/badge/Revit-2019+-blue.svg)](https://github.com/ricaun-io/ricaun.RevitTest) [![Visual Studio 2022](https://img.shields.io/badge/Visual%20Studio-2022-blue)](https://github.com/ricaun-io/ricaun.RevitTest) [![Nuke](https://img.shields.io/badge/Nuke-Build-blue)](https://nuke.build/) [![License MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) diff --git a/README.old.md b/README.old.md deleted file mode 100644 index 2a1fdc3..0000000 --- a/README.old.md +++ /dev/null @@ -1,208 +0,0 @@ -# ricaun.RevitTest - -ricaun.RevitTest is a Framework to execute NUnit tests using Visual Studio and Revit. - -[![Revit 2017](https://img.shields.io/badge/Revit-2017+-blue.svg)](https://github.com/ricaun-io/ricaun.RevitTest) -[![Visual Studio 2022](https://img.shields.io/badge/Visual%20Studio-2022-blue)](https://github.com/ricaun-io/ricaun.RevitTest) -[![Nuke](https://img.shields.io/badge/Nuke-Build-blue)](https://nuke.build/) -[![License MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) -[![Build](https://github.com/ricaun-io/ricaun.RevitTest/actions/workflows/Build.yml/badge.svg)](https://github.com/ricaun-io/ricaun.RevitTest/actions) -[![Release](https://img.shields.io/nuget/v/ricaun.RevitTest.TestAdapter?logo=nuget&label=release&color=blue)](https://www.nuget.org/packages/ricaun.RevitTest.TestAdapter) - -[![ricaun.RevitTest](https://raw.githubusercontent.com/ricaun/test-assets/main/assets/ricaun.RevitTest.png)](https://github.com/ricaun-io/ricaun.RevitTest) - -## WorkFlow - -```mermaid ---- -title: ricaun.RevitTest ---- -flowchart LR - dll(dll) - TestAdapter[TestAdapter] - Console[Console] - Application[Application] - dll--dotnet test-->TestAdapter - TestAdapter--Start-->Console - Console--Run Tests-->Application - Console-.Open/Close.-Revit - subgraph Revit [Revit] - Application - end -``` - -## Wiki - -For more information see [Wiki](https://github.com/ricaun-io/ricaun.RevitTest/wiki). - -## Tests -### PackageReference -```xml - - -``` - -### PropertyGroup -```xml -true -``` - - -## Installation - -* Download and install [ricaun.RevitTest.Console.exe](https://github.com/ricaun-io/ricaun.RevitTest/releases/latest/download/ricaun.RevitTest.Console.zip) - -### RevitTest - -#### Application -* [ricaun.NUnit](https://github.com/ricaun-io/ricaun.NUnit) -* [ricaun.Revit.UI](https://github.com/ricaun-io/ricaun.Revit.UI) -* [ricaun.Revit.UI.Tasks](https://github.com/ricaun-io/ricaun.Revit.UI.Tasks) -* [ricaun.Revit.UI.Busy](https://github.com/ricaun-io/ricaun.Revit.UI.Busy) -* [ricaun.RevitTest.Shared](ricaun.RevitTest.Shared) -#### Command -* [ricaun.NUnit](https://github.com/ricaun-io/ricaun.NUnit) -#### Console -* [ricaun.Revit.Installation](https://github.com/ricaun-io/ricaun.Revit.Installation) -* [ricaun.RevitTest.Command](ricaun.RevitTest.Command) -* [ricaun.RevitTest.Shared](ricaun.RevitTest.Shared) -* [ricaun.RevitTest.Application.bundle.zip](ricaun.RevitTest.Application) -#### Shared -* [ricaun.NUnit](https://github.com/ricaun-io/ricaun.NUnit) -* [ricaun.NamedPipeWrapper.Json](https://github.com/ricaun-io/named-pipe-wrapper-json) -#### TestAdapter -* [ricaun.RevitTest.Console.exe](ricaun.RevitTest.Console) -* [ricaun.RevitTest.Command](ricaun.RevitTest.Command) -* [ricaun.Security.WinTrust](https://github.com/ricaun-io/ricaun.Security.WinTrust) - -## CommandLine - -```bash -.\ricaun.RevitTest.Console.exe --help -.\ricaun.RevitTest.Console.exe --version -``` - -### Read -```bash -.\ricaun.RevitTest.Console.exe --file "C:\Users\ricau\source\repos\TestProject.Tests\TestProject.Tests\bin\Debug\TestProject.Tests.dll" --read -.\ricaun.RevitTest.Console.exe --file "C:\Users\ricau\source\repos\TestProject.Tests\TestProject.Tests\bin\Debug\TestProject.Tests.dll" --read --output "output.json" -``` - -### Test -```bash -.\ricaun.RevitTest.Console.exe --file "C:\Users\ricau\source\repos\TestProject.Tests\TestProject.Tests\bin\Debug\TestProject.Tests.dll" --output "console" -.\ricaun.RevitTest.Console.exe --file "C:\Users\ricau\source\repos\TestProject.Tests\TestProject.Tests\bin\Debug\TestProject.Tests.dll" -v 2021 -o "console" --close -``` - -### Test Language -```bash -.\ricaun.RevitTest.Console.exe --file "D:\Users\ricau\source\repos\RevitTest.Language\RevitTest.Language\bin\Debug\net45\RevitTest.Language.dll" -v 2021 -l -o "console" --language "PTB" --open --close -.\ricaun.RevitTest.Console.exe --file "D:\Users\ricau\source\repos\RevitTest.Language\RevitTest.Language\bin\Debug\net45\RevitTest.Language.dll" -v 2021 -l -o "console" --language "pt" --open --close -``` - -``` -.\ricaun.RevitTest.Console\bin\Debug\ricaun.RevitTest.Console.exe --file "D:\Users\ricau\source\repos\RevitTest0\RevitTest0\bin\Debug\RevitTest0.dll" -v 2021 -o "console" -``` - -## Tests -### PackageReference - -* `ricaun.RevitTest.TestAdapter` -* `NUnit` need to be 3.13.3 -* `IsTestProject` true - -### `dotnet test` -```bash -dotnet test ricaun.RevitTest.Tests.dll -- NUnit.Version=2021 NUnit.Open=true NUnit.Close=true -``` -```bash -dotnet test ricaun.RevitTest.Tests.dll -v:detailed -- NUnit.Version=2021 NUnit.Open=True NUnit.Close=True NUnit.Verbosity=1 -``` -```bash -dotnet test ricaun.RevitTest.Tests.dll --verbosity Normal -- NUnit.Verbosity=2 NUnit.Open=True NUnit.Close=True -``` -```bash -dotnet test ricaun.RevitTest.Tests.dll --settings:.runsettings -``` -```bash -dotnet test ricaun.RevitTest.Tests.dll --settings:.runsettings -- NUnit.Version=2023 -``` -```bash -dotnet test ricaun.RevitTest.Tests.dll -v:detailed -- NUnit.Application="" -``` - -### Environment Variables -``` -RICAUN_REVITTEST_TESTADAPTER_NUNIT_VERSION -RICAUN_REVITTEST_TESTADAPTER_NUNIT_LANGUAGE -RICAUN_REVITTEST_TESTADAPTER_NUNIT_OPEN -RICAUN_REVITTEST_TESTADAPTER_NUNIT_CLOSE -RICAUN_REVITTEST_TESTADAPTER_NUNIT_TIMEOUT -RICAUN_REVITTEST_TESTADAPTER_NUNIT_VERBOSITY -RICAUN_REVITTEST_TESTADAPTER_NUNIT_APPLICATION -RICAUN_REVITTEST_TESTADAPTER_NUNIT_METADATA -``` - -### `.runsettings` -.csproj -```xml - - - $(MSBuildProjectDirectory)\.runsettings - - - - PreserveNewest - - -``` -.runsettings -```xml - - - - 2021 - pt - true - true - 1 - - false - - -``` - -### AssemblyMetadata -.cs -```c# -[assembly: AssemblyMetadata("NUnit.Version", "2021")] -[assembly: AssemblyMetadata("NUnit.Language", "ENU")] -[assembly: AssemblyMetadata("NUnit.Open", "true")] -[assembly: AssemblyMetadata("NUnit.Close", "true")] -[assembly: AssemblyMetadata("NUnit.Verbosity", "1")] -``` -.csproj -```xml - - - - <_Parameter1>NUnit.Open - <_Parameter2>true - - - <_Parameter1>NUnit.Close - <_Parameter2>true - - -``` - - - - -## License - -This project is [licensed](LICENSE) under the [MIT Licence](https://en.wikipedia.org/wiki/MIT_License). - ---- - -Do you like this project? Please [star this project on GitHub](https://github.com/ricaun-io/ricaun.RevitTest/stargazers)! \ No newline at end of file diff --git a/ricaun.RevitTest.Application/ricaun.RevitTest.Application.csproj b/ricaun.RevitTest.Application/ricaun.RevitTest.Application.csproj index 579b94f..9f15913 100644 --- a/ricaun.RevitTest.Application/ricaun.RevitTest.Application.csproj +++ b/ricaun.RevitTest.Application/ricaun.RevitTest.Application.csproj @@ -22,14 +22,9 @@ - net46;net47;net48;net8.0-windows + net47;net48;net8.0-windows - - - 2017 - - 2019 diff --git a/ricaun.RevitTest.Command/Command/RunCommand.cs b/ricaun.RevitTest.Command/Command/RunCommand.cs index bd817da..9adef1e 100644 --- a/ricaun.RevitTest.Command/Command/RunCommand.cs +++ b/ricaun.RevitTest.Command/Command/RunCommand.cs @@ -26,6 +26,21 @@ private void ValidadeOptions() if (!File.Exists(options.File)) throw new FileNotFoundException(); + // Check if first argument is a file to read the test filters (Fix: #65) + if (options.Test.Count() == 1) + { + var tempFileTestFilters = options.Test.First(); + if (File.Exists(tempFileTestFilters)) + { + options.Test = File.ReadAllLines(tempFileTestFilters); + try + { + File.Delete(tempFileTestFilters); + } + catch { } + } + } + Log.Enabled = options.Log; } diff --git a/ricaun.RevitTest.Command/Process/ProcessStart.cs b/ricaun.RevitTest.Command/Process/ProcessStart.cs index 9f52729..7d0948a 100644 --- a/ricaun.RevitTest.Command/Process/ProcessStart.cs +++ b/ricaun.RevitTest.Command/Process/ProcessStart.cs @@ -94,8 +94,8 @@ private ProcessStartInfo NewProcessStartInfo(string arguments) public async Task Run(Action consoleAction, Action errorAction = null) { var arguments = CreateArguments(); - WriteLine($"ProcessStart: {processPath}"); - WriteLine($"ProcessStart.Run: {arguments}"); + WriteLine($"ProcessStart[{processPath.Length}]: {processPath}"); + WriteLine($"ProcessStart.Run[{arguments.Length}]: {arguments}"); await Run(arguments, consoleAction, errorAction); } private async Task Run(string arguments, diff --git a/ricaun.RevitTest.Command/Process/RevitTestProcessStart.cs b/ricaun.RevitTest.Command/Process/RevitTestProcessStart.cs index 318027d..084653a 100644 --- a/ricaun.RevitTest.Command/Process/RevitTestProcessStart.cs +++ b/ricaun.RevitTest.Command/Process/RevitTestProcessStart.cs @@ -1,6 +1,7 @@ using ricaun.NUnit.Models; using ricaun.RevitTest.Command.Extensions; using System; +using System.IO; using System.Linq; using System.Threading.Tasks; @@ -53,6 +54,15 @@ public RevitTestProcessStart SetTestFilter(string[] testFilters) { if (testFilters.Length == 0) return this; + + // Convert filter to file to fix the limit size of arguments (Fix: #65) + if (testFilters.Length > 32) + { + var tempFileTestFilters = Path.GetTempFileName(); + File.WriteAllLines(tempFileTestFilters, testFilters); + return SetRevitArgument("test", tempFileTestFilters); + } + return SetRevitArgument("test", testFilters); } public RevitTestProcessStart SetTestFilter(string testFilter) diff --git a/ricaun.RevitTest.Command/Utils/AppUtils.cs b/ricaun.RevitTest.Command/Utils/AppUtils.cs index e4ef9ea..8486ffb 100644 --- a/ricaun.RevitTest.Command/Utils/AppUtils.cs +++ b/ricaun.RevitTest.Command/Utils/AppUtils.cs @@ -5,16 +5,31 @@ namespace ricaun.RevitTest.Command.Utils public static class AppUtils { /// - /// Get Info (Assembly Name, Version and Target Framework) + /// Get Info (Product Name, Version and Target Framework) /// /// public static string GetInfo() { - var assemblyName = typeof(AppUtils).Assembly.GetName(); - var info = $"{assemblyName.Name} {GetSemanticVersion()} [{GetTargetFrameworkName()}]"; + var info = $"{GetProduct()} {GetSemanticVersion()} [{GetTargetFrameworkName()}]"; return info; } + /// + /// Get Product Name + /// + /// + public static string GetProduct() + { + var assembly = typeof(AppUtils).Assembly; + string product = assembly.GetName().Name; + try + { + product = assembly.GetCustomAttribute().Product; + } + catch { } + return product; + } + /// /// Get Semantic Version /// diff --git a/ricaun.RevitTest.Console/Resources/ricaun.RevitTest.Application.bundle.zip b/ricaun.RevitTest.Console/Resources/ricaun.RevitTest.Application.bundle.zip index d6fe362..bebcfad 100644 Binary files a/ricaun.RevitTest.Console/Resources/ricaun.RevitTest.Application.bundle.zip and b/ricaun.RevitTest.Console/Resources/ricaun.RevitTest.Application.bundle.zip differ diff --git a/ricaun.RevitTest.Console/Revit/Services/RevitAddinDisable.cs b/ricaun.RevitTest.Console/Revit/Services/RevitAddinDisable.cs deleted file mode 100644 index c03c741..0000000 --- a/ricaun.RevitTest.Console/Revit/Services/RevitAddinDisable.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.IO; -using System.Linq; - -namespace ricaun.RevitTest.Console.Revit.Services -{ - public class RevitAddinDisable : IDisposable - { - public static string FormatAddin = ".addin"; - public static string FormatDisable = ".disable"; - public static string AddinPath = "Addins"; - private readonly string revitFolder; - - private string[] DisableAddins() => GetAddins(FormatAddin).Select(e => RenameExtension(e, FormatDisable)).ToArray(); - private string[] EnableAddins() => GetAddins(FormatDisable).Select(e => RenameExtension(e, FormatAddin)).ToArray(); - - public RevitAddinDisable(string revitFolder) - { - this.revitFolder = revitFolder; - DisableAddins(); - } - - private string RenameExtension(string filePath, string changeExtension) - { - var newFilePath = Path.ChangeExtension(filePath, changeExtension); - if (File.Exists(filePath)) - { - try - { - System.Console.WriteLine(Path.GetFileName(newFilePath)); - File.Move(filePath, newFilePath); - } - catch (Exception ex) { System.Console.WriteLine(ex); } - } - return newFilePath; - } - - private string[] GetAddins(string extension) - { - var folder = Path.Combine(revitFolder, AddinPath); - var addinFilePaths = Directory.GetFiles(folder, $"*{extension}", SearchOption.AllDirectories); - return addinFilePaths; - } - - public void Dispose() - { - EnableAddins(); - } - } - -} diff --git a/ricaun.RevitTest.Console/Revit/Utils/EnvironmentVariable.cs b/ricaun.RevitTest.Console/Revit/Utils/EnvironmentVariable.cs new file mode 100644 index 0000000..dcf1e70 --- /dev/null +++ b/ricaun.RevitTest.Console/Revit/Utils/EnvironmentVariable.cs @@ -0,0 +1,32 @@ +using System; + +namespace ricaun.RevitTest.Console.Revit.Utils +{ + /// + /// EnvironmentVariable is used for testing purpose. + /// + internal static class EnvironmentVariable + { + /// + /// Extra arguments to be passed to the Revit process start. + /// + public static string ProcessArguments => Environment.GetEnvironmentVariable("RICAUN_REVITTEST_CONSOLE_PROCESS_ARGUMENTS"); + + /// + /// Timeout in seconds if application-console connection is not busy. + /// + public static int TimeoutNotBusyMaxSeconds => GetEnvironmentVariableInteger("RICAUN_REVITTEST_CONSOLE_TIMEOUT_NOT_BUSY_MAX_SECONDS", 10); + + private static int GetEnvironmentVariableInteger(string variable, int value = default) + { + try + { + var environmentVariable = Environment.GetEnvironmentVariable(variable); + if (int.TryParse(environmentVariable, out int result)) + return result; + } + catch { } + return value; + } + } +} \ No newline at end of file diff --git a/ricaun.RevitTest.Console/Revit/Utils/RevitTestUtils.cs b/ricaun.RevitTest.Console/Revit/Utils/RevitTestUtils.cs index d478074..9be5e7c 100644 --- a/ricaun.RevitTest.Console/Revit/Utils/RevitTestUtils.cs +++ b/ricaun.RevitTest.Console/Revit/Utils/RevitTestUtils.cs @@ -14,6 +14,7 @@ namespace ricaun.RevitTest.Console.Revit.Utils { + /// /// RevitTestUtils /// @@ -23,9 +24,10 @@ public static class RevitTestUtils private const int SleepMillisecondsDebuggerAttached = 1000; private const int TimeoutMinutesDefault = 10; + private const int MinimalRevitVersion = 2019; // Application is not compatible with Revit 2018 or lower /// - /// Get Test Full Names using RevitInstallation if needed (Revit +2021) + /// Get Test Full Names using RevitInstallation /// /// /// @@ -101,7 +103,7 @@ public static void CreateRevitServer( double timeoutMinutes = 0, params string[] testFilters) { - int timeoutNotBusyCountMax = 10; + int timeoutNotBusyCountMax = EnvironmentVariable.TimeoutNotBusyMaxSeconds; if (timeoutMinutes <= 0) timeoutMinutes = TimeoutMinutesDefault; @@ -111,7 +113,7 @@ public static void CreateRevitServer( RevitUtils.TryGetRevitVersion(fileToTest, out revitVersionNumber); } - if (!RevitInstallationUtils.InstalledRevit.TryGetRevitInstallationGreater(revitVersionNumber, out RevitInstallation revitInstallationNotExist)) + if (!RevitInstallationUtils.InstalledRevit.TryGetRevitInstallationGreater(revitVersionNumber, out RevitInstallation revitInstallationExist)) { var exceptionRevitNotExist = new Exception($"Installed Revit with version {revitVersionNumber} or greater not found."); @@ -122,6 +124,17 @@ public static void CreateRevitServer( return; } + if (revitInstallationExist.Version < MinimalRevitVersion) + { + var exceptionRevitVersion = new Exception($"Revit version {revitInstallationExist.Version} is not compatible with the application, minimal Revit version {MinimalRevitVersion}."); + + var failTests = TestEngine.Fail(fileToTest, exceptionRevitVersion, testFilters); + actionOutput.Invoke(failTests.ToJson()); + + Thread.Sleep(SleepMillisecondsBeforeFinish); + return; + } + int timeoutNotBusyCount = 0; bool sendFileWhenCreatedOrUpdated = true; bool testsFinishedForceToEnd = false; @@ -154,7 +167,7 @@ public static void CreateRevitServer( if (revitInstallation.TryGetProcess(out Process process) == false || forceToOpenNewRevit) { var startRevitLanguageArgument = RevitLanguageUtils.GetArgument(forceLanguageToRevit); - startRevitLanguageArgument = string.Join(" ", startRevitLanguageArgument, Environment.GetEnvironmentVariable("RICAUN_REVITTEST_CONSOLE_PROCESS_ARGUMENTS")); + startRevitLanguageArgument = string.Join(" ", startRevitLanguageArgument, EnvironmentVariable.ProcessArguments); Log.WriteLine($"{revitInstallation}: Start {startRevitLanguageArgument}"); process = revitInstallation.Start(startRevitLanguageArgument); } @@ -198,7 +211,7 @@ public static void CreateRevitServer( } }; - int timeoutSeconds = (int) timeoutMinutes * 60; + int timeoutSeconds = (int)timeoutMinutes * 60; for (int i = 0; i <= timeoutSeconds; i++) { Thread.Sleep(1000); diff --git a/ricaun.RevitTest.Console/ricaun.RevitTest.Console.csproj b/ricaun.RevitTest.Console/ricaun.RevitTest.Console.csproj index 54b73cc..b5c2c29 100644 --- a/ricaun.RevitTest.Console/ricaun.RevitTest.Console.csproj +++ b/ricaun.RevitTest.Console/ricaun.RevitTest.Console.csproj @@ -48,7 +48,7 @@ - + diff --git a/ricaun.RevitTest.TestAdapter/Resources/net48/ricaun.RevitTest.Console.zip b/ricaun.RevitTest.TestAdapter/Resources/net48/ricaun.RevitTest.Console.zip index 20d9364..33e5826 100644 Binary files a/ricaun.RevitTest.TestAdapter/Resources/net48/ricaun.RevitTest.Console.zip and b/ricaun.RevitTest.TestAdapter/Resources/net48/ricaun.RevitTest.Console.zip differ diff --git a/ricaun.RevitTest.TestAdapter/Resources/net8.0-windows/ricaun.RevitTest.Console.zip b/ricaun.RevitTest.TestAdapter/Resources/net8.0-windows/ricaun.RevitTest.Console.zip index 504f500..3ab4f18 100644 Binary files a/ricaun.RevitTest.TestAdapter/Resources/net8.0-windows/ricaun.RevitTest.Console.zip and b/ricaun.RevitTest.TestAdapter/Resources/net8.0-windows/ricaun.RevitTest.Console.zip differ diff --git a/ricaun.RevitTest.TestAdapter/Services/ApplicationUtils.cs b/ricaun.RevitTest.TestAdapter/Services/ApplicationUtils.cs index af1cb93..2fa11d9 100644 --- a/ricaun.RevitTest.TestAdapter/Services/ApplicationUtils.cs +++ b/ricaun.RevitTest.TestAdapter/Services/ApplicationUtils.cs @@ -166,42 +166,6 @@ private static bool LocalFileExists(string filePath, out string localFilePath) return false; } - /// - /// Download and unzip Application Async - /// - /// Folder of the Application - /// - /// - /// - private static async Task DownloadAsyncWeb(string applicationFolder, string address, Action downloadFileException = null) - { - var fileName = Path.GetFileName(address); - var zipPath = Path.Combine(applicationFolder, fileName); - var result = false; - -#pragma warning disable SYSLIB0014 // Type or member is obsolete - using (var client = new WebClient()) - { - System.Net.ServicePointManager.SecurityProtocol |= System.Net.SecurityProtocolType.Tls12; - client.Headers[HttpRequestHeader.UserAgent] = nameof(ApplicationUtils); - try - { - await client.DownloadFileTaskAsync(new Uri(address), zipPath); - ExtractZipToDirectory(zipPath, applicationFolder); - result = true; - } - catch (Exception ex) - { - downloadFileException?.Invoke(ex); - } - if (Path.GetExtension(zipPath) == ZIP_FILE_EXTENSION) - if (File.Exists(zipPath)) File.Delete(zipPath); - } -#pragma warning restore SYSLIB0014 // Type or member is obsolete - - return result; - } - /// /// ExtractToDirectory with overwrite enable /// diff --git a/ricaun.RevitTest.TestAdapter/TestCaseUtils.cs b/ricaun.RevitTest.TestAdapter/TestCaseUtils.cs index 316615f..8214c63 100644 --- a/ricaun.RevitTest.TestAdapter/TestCaseUtils.cs +++ b/ricaun.RevitTest.TestAdapter/TestCaseUtils.cs @@ -61,7 +61,7 @@ private static void SplitTestName(string testName, out string fullyQualifiedName fullyQualifiedName = string.Join(".", splitDots.Take(index)); displayName = string.Join(".", splitDots.Skip(index)); - AdapterLogger.Logger.DebugOnlyLocal($"SplitTestName[{index}]: {testName} -\t {fullyQualifiedName}\t {displayName}"); + // AdapterLogger.Logger.DebugOnlyLocal($"SplitTestName[{index}]: {testName} -\t {fullyQualifiedName}\t {displayName}"); } private static int LastIndexSplitOfDisplayName(string[] splitDots) diff --git a/ricaun.RevitTest.Tests/TestsDebugger.cs b/ricaun.RevitTest.Tests/TestsDebugger.cs index e8706a1..57d96c8 100644 --- a/ricaun.RevitTest.Tests/TestsDebugger.cs +++ b/ricaun.RevitTest.Tests/TestsDebugger.cs @@ -14,11 +14,11 @@ //[assembly: AssemblyMetadata("NUnit.Application", "RICAUN_REVIT_TEST_APPLICATION_DA4R_LOCAL")] //[assembly: AssemblyMetadata("NUnit.Application", "NUNIT_APPLICATION_TEST")] //[assembly: AssemblyMetadata("NUnit.Application", "RICAUN_REVIT_TEST_APPLICATION_DA4R_ONLINE_TEST")] -//#if NET -//[assembly: AssemblyMetadata("NUnit.Application", "..\\..\\..\\..\\ricaun.RevitTest.Console\\bin\\Debug\\net8.0-windows\\ricaun.RevitTest.Console.exe")] -//#else -//[assembly: AssemblyMetadata("NUnit.Application", "..\\..\\..\\..\\ricaun.RevitTest.Console\\bin\\Debug\\net48\\ricaun.RevitTest.Console.exe")] -//#endif +#if NET +[assembly: AssemblyMetadata("NUnit.Application", "..\\..\\..\\..\\ricaun.RevitTest.Console\\bin\\Debug\\net8.0-windows\\ricaun.RevitTest.Console.exe")] +#else +[assembly: AssemblyMetadata("NUnit.Application", "..\\..\\..\\..\\ricaun.RevitTest.Console\\bin\\Debug\\net48\\ricaun.RevitTest.Console.exe")] +#endif //[assembly: AssemblyMetadata("NUnit.Application", "..\\..\\..\\..\\ricaun.RevitTest.Console\\bin\\Debug\\ricaun.DA4R.NUnit.Console.zip")] diff --git a/ricaun.RevitTest.Tests/TestsRevitTask.cs b/ricaun.RevitTest.Tests/TestsRevitTask.cs index 1ac5433..17a9d8c 100644 --- a/ricaun.RevitTest.Tests/TestsRevitTask.cs +++ b/ricaun.RevitTest.Tests/TestsRevitTask.cs @@ -7,7 +7,7 @@ using System.Threading.Tasks; [assembly: System.Reflection.AssemblyMetadata("ricaun.RevitTest.Application.Tasks.Name", "RevitTask")] -[assembly: System.Reflection.AssemblyMetadata("ricaun.RevitTest.Application.Tasks.Timeout", "0.05")] +[assembly: System.Reflection.AssemblyMetadata("ricaun.RevitTest.Application.Tasks.Timeout", "0.10")] namespace ricaun.RevitTest.Tests { @@ -96,6 +96,22 @@ public async Task RunAddInName(UIControlledApplication application) Console.WriteLine($"AddInName: {addInName2}"); } +#if NET47 + [Test] + public async Task TestPostableCommand_MacroManager() + { + await RevitTask.Run((uiapp) => + { + uiapp.DialogBoxShowing += DialogBoxShowingForceClose; + uiapp.PostCommand(RevitCommandId.LookupPostableCommandId(PostableCommand.MacroManager)); + }); + + await RevitTask.Run((uiapp) => + { + uiapp.DialogBoxShowing -= DialogBoxShowingForceClose; + }); + } +#else [Test] public async Task TestPostableCommand_NewProject() { @@ -110,6 +126,7 @@ await RevitTask.Run((uiapp) => uiapp.DialogBoxShowing -= DialogBoxShowingForceClose; }); } +#endif private void DialogBoxShowingForceClose(object sender, Autodesk.Revit.UI.Events.DialogBoxShowingEventArgs e) { var uiapp = sender as UIApplication; @@ -117,7 +134,6 @@ private void DialogBoxShowingForceClose(object sender, Autodesk.Revit.UI.Events. Console.WriteLine($"DialogBoxShowing {e.DialogId}"); e.OverrideResult((int)TaskDialogResult.Close); } - [Test] public async Task TestAsync_Idling() { diff --git a/ricaun.RevitTest.Tests/ricaun.RevitTest.Tests.csproj b/ricaun.RevitTest.Tests/ricaun.RevitTest.Tests.csproj index 7ad0995..11f6db0 100644 --- a/ricaun.RevitTest.Tests/ricaun.RevitTest.Tests.csproj +++ b/ricaun.RevitTest.Tests/ricaun.RevitTest.Tests.csproj @@ -8,10 +8,15 @@ - net48;net8.0-windows + net47;net48;net8.0-windows - + + + 2019 + + + 2024