diff --git a/src/DynamoCoreWpf/Controls/ShortcutToolbar.xaml.cs b/src/DynamoCoreWpf/Controls/ShortcutToolbar.xaml.cs index db6760f212d..a22bfb7e3d7 100644 --- a/src/DynamoCoreWpf/Controls/ShortcutToolbar.xaml.cs +++ b/src/DynamoCoreWpf/Controls/ShortcutToolbar.xaml.cs @@ -6,11 +6,7 @@ using Dynamo.UI.Commands; using Dynamo.ViewModels; using Dynamo.Wpf.ViewModels.Core; -#if NETFRAMEWORK -using NotificationObject = Microsoft.Practices.Prism.ViewModel.NotificationObject; -#else using NotificationObject = Dynamo.Core.NotificationObject; -#endif using Greg.AuthProviders; using System.Linq; using System.Windows; diff --git a/src/DynamoCoreWpf/Controls/StartPage.xaml.cs b/src/DynamoCoreWpf/Controls/StartPage.xaml.cs index 133ff831a31..ecdd683d23a 100644 --- a/src/DynamoCoreWpf/Controls/StartPage.xaml.cs +++ b/src/DynamoCoreWpf/Controls/StartPage.xaml.cs @@ -14,11 +14,7 @@ using Dynamo.Utilities; using Dynamo.ViewModels; using Dynamo.Wpf.Properties; -#if NETFRAMEWORK -using NotificationObject = Microsoft.Practices.Prism.ViewModel.NotificationObject; -#else using NotificationObject = Dynamo.Core.NotificationObject; -#endif namespace Dynamo.UI.Controls { diff --git a/src/DynamoCoreWpf/ViewModels/Core/DynamoViewModelDelegateCommands.cs b/src/DynamoCoreWpf/ViewModels/Core/DynamoViewModelDelegateCommands.cs index 9c2bd531e17..a206e7ea804 100644 --- a/src/DynamoCoreWpf/ViewModels/Core/DynamoViewModelDelegateCommands.cs +++ b/src/DynamoCoreWpf/ViewModels/Core/DynamoViewModelDelegateCommands.cs @@ -1,11 +1,7 @@ using System; using Dynamo.Graph.Nodes.CustomNodes; using Dynamo.Wpf.ViewModels; -#if NETFRAMEWORK -using Microsoft.Practices.Prism.Commands; -#else using Prism.Commands; -#endif using DelegateCommand = Dynamo.UI.Commands.DelegateCommand; namespace Dynamo.ViewModels diff --git a/src/DynamoCoreWpf/ViewModels/PackageManager/InstalledPackagesViewModel.cs b/src/DynamoCoreWpf/ViewModels/PackageManager/InstalledPackagesViewModel.cs index 4f760213f3f..a5a3a222ba6 100644 --- a/src/DynamoCoreWpf/ViewModels/PackageManager/InstalledPackagesViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/PackageManager/InstalledPackagesViewModel.cs @@ -4,11 +4,7 @@ using Dynamo.PackageManager; using Dynamo.Utilities; using Dynamo.Wpf.Properties; -#if NETFRAMEWORK -using NotificationObject = Microsoft.Practices.Prism.ViewModel.NotificationObject; -#else using NotificationObject = Dynamo.Core.NotificationObject; -#endif namespace Dynamo.ViewModels { diff --git a/src/DynamoCoreWpf/ViewModels/PackageManager/PackageItemViewModel.cs b/src/DynamoCoreWpf/ViewModels/PackageManager/PackageItemViewModel.cs index 73e5f81158c..776d64ecfd2 100644 --- a/src/DynamoCoreWpf/ViewModels/PackageManager/PackageItemViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/PackageManager/PackageItemViewModel.cs @@ -4,11 +4,7 @@ using System.IO; using System.Windows; using System.Windows.Input; -#if NETFRAMEWORK -using NotificationObject = Microsoft.Practices.Prism.ViewModel.NotificationObject; -#else using NotificationObject = Dynamo.Core.NotificationObject; -#endif namespace Dynamo.PackageManager.UI { diff --git a/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerClientViewModel.cs b/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerClientViewModel.cs index efe3950cf68..aca34008833 100644 --- a/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerClientViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerClientViewModel.cs @@ -23,11 +23,7 @@ using Dynamo.Wpf.Utilities; using Greg.AuthProviders; using Greg.Responses; -#if NETFRAMEWORK -using Microsoft.Practices.Prism.Commands; -#else using Prism.Commands; -#endif namespace Dynamo.ViewModels { diff --git a/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerSearchElementViewModel.cs b/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerSearchElementViewModel.cs index 6903df84b3a..382b03e27cc 100644 --- a/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerSearchElementViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerSearchElementViewModel.cs @@ -6,11 +6,7 @@ using Dynamo.ViewModels; using Dynamo.Wpf.ViewModels; using Greg.Responses; -#if NETFRAMEWORK -using Microsoft.Practices.Prism.Commands; -#else using Prism.Commands; -#endif namespace Dynamo.PackageManager.ViewModels { diff --git a/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerSearchViewModel.cs b/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerSearchViewModel.cs index 957232cb769..7947803ccca 100644 --- a/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerSearchViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerSearchViewModel.cs @@ -23,13 +23,8 @@ using Lucene.Net.Index; using Lucene.Net.QueryParsers.Classic; using Lucene.Net.Search; -#if NETFRAMEWORK -using Microsoft.Practices.Prism.Commands; -using NotificationObject = Microsoft.Practices.Prism.ViewModel.NotificationObject; -#else using Prism.Commands; using NotificationObject = Dynamo.Core.NotificationObject; -#endif namespace Dynamo.PackageManager { diff --git a/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerViewModel.cs b/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerViewModel.cs index d579f1a22a6..6844339f966 100644 --- a/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/PackageManager/PackageManagerViewModel.cs @@ -1,10 +1,6 @@ using Dynamo.Controls; using Dynamo.ViewModels; -#if NETFRAMEWORK -using NotificationObject = Microsoft.Practices.Prism.ViewModel.NotificationObject; -#else using NotificationObject = Dynamo.Core.NotificationObject; -#endif using System.Collections.ObjectModel; namespace Dynamo.PackageManager diff --git a/src/DynamoCoreWpf/ViewModels/PackageManager/PackageViewModel.cs b/src/DynamoCoreWpf/ViewModels/PackageManager/PackageViewModel.cs index 655f8586c60..f6bdc2c2e5f 100644 --- a/src/DynamoCoreWpf/ViewModels/PackageManager/PackageViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/PackageManager/PackageViewModel.cs @@ -12,13 +12,8 @@ using Dynamo.PackageManager; using Dynamo.Wpf.Properties; using Dynamo.Wpf.Utilities; -#if NETFRAMEWORK -using NotificationObject = Microsoft.Practices.Prism.ViewModel.NotificationObject; -using Microsoft.Practices.Prism.Commands; -#else using NotificationObject = Dynamo.Core.NotificationObject; using Prism.Commands; -#endif namespace Dynamo.ViewModels { diff --git a/src/DynamoCoreWpf/ViewModels/PackageManager/PublishPackageViewModel.cs b/src/DynamoCoreWpf/ViewModels/PackageManager/PublishPackageViewModel.cs index 86dbfd7214a..b45a5779253 100644 --- a/src/DynamoCoreWpf/ViewModels/PackageManager/PublishPackageViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/PackageManager/PublishPackageViewModel.cs @@ -23,13 +23,8 @@ using PythonNodeModels; using Double = System.Double; using String = System.String; -#if NETFRAMEWORK -using NotificationObject = Microsoft.Practices.Prism.ViewModel.NotificationObject; -using Microsoft.Practices.Prism.Commands; -#else using NotificationObject = Dynamo.Core.NotificationObject; using Prism.Commands; -#endif namespace Dynamo.PackageManager { diff --git a/src/DynamoCoreWpf/ViewModels/Preview/WatchViewModel.cs b/src/DynamoCoreWpf/ViewModels/Preview/WatchViewModel.cs index c3aa107ae35..a345fb9728c 100644 --- a/src/DynamoCoreWpf/ViewModels/Preview/WatchViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/Preview/WatchViewModel.cs @@ -7,11 +7,7 @@ using Dynamo.Wpf.Properties; using Dynamo.UI.Commands; using Dynamo.Utilities; -#if NETFRAMEWORK -using NotificationObject = Microsoft.Practices.Prism.ViewModel.NotificationObject; -#else using NotificationObject = Dynamo.Core.NotificationObject; -#endif using Dynamo.Configuration; using CoreNodeModels; diff --git a/src/DynamoCoreWpf/ViewModels/Search/BrowserItemViewModel.cs b/src/DynamoCoreWpf/ViewModels/Search/BrowserItemViewModel.cs index 8c47bcb8a1e..4c8e4a8a326 100644 --- a/src/DynamoCoreWpf/ViewModels/Search/BrowserItemViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/Search/BrowserItemViewModel.cs @@ -11,13 +11,8 @@ using Dynamo.Search.SearchElements; using Dynamo.ViewModels; using Dynamo.Wpf.Extensions; -#if NETFRAMEWORK -using NotificationObject = Microsoft.Practices.Prism.ViewModel.NotificationObject; -using Microsoft.Practices.Prism.Commands; -#else using NotificationObject = Dynamo.Core.NotificationObject; using Prism.Commands; -#endif namespace Dynamo.Wpf.ViewModels { diff --git a/src/DynamoCoreWpf/ViewModels/Search/NodeSearchElementViewModel.cs b/src/DynamoCoreWpf/ViewModels/Search/NodeSearchElementViewModel.cs index 57998a25b4a..1222d2bbd9c 100644 --- a/src/DynamoCoreWpf/ViewModels/Search/NodeSearchElementViewModel.cs +++ b/src/DynamoCoreWpf/ViewModels/Search/NodeSearchElementViewModel.cs @@ -13,11 +13,7 @@ using Dynamo.Selection; using Dynamo.ViewModels; using FontAwesome5; -#if NETFRAMEWORK -using Microsoft.Practices.Prism.Commands; -#else using Prism.Commands; -#endif namespace Dynamo.Wpf.ViewModels { diff --git a/src/DynamoCoreWpf/ViewModels/Search/SearchCategory.cs b/src/DynamoCoreWpf/ViewModels/Search/SearchCategory.cs index 8dd288674b5..c905b128de9 100644 --- a/src/DynamoCoreWpf/ViewModels/Search/SearchCategory.cs +++ b/src/DynamoCoreWpf/ViewModels/Search/SearchCategory.cs @@ -1,10 +1,6 @@ using System.Windows.Input; using Dynamo.UI.Commands; -#if NETFRAMEWORK -using NotificationObject = Microsoft.Practices.Prism.ViewModel.NotificationObject; -#else using NotificationObject = Dynamo.Core.NotificationObject; -#endif namespace Dynamo.Wpf.ViewModels { diff --git a/src/DynamoCoreWpf/ViewModels/ViewModelBase.cs b/src/DynamoCoreWpf/ViewModels/ViewModelBase.cs index 4979755d862..527c6bb7e54 100644 --- a/src/DynamoCoreWpf/ViewModels/ViewModelBase.cs +++ b/src/DynamoCoreWpf/ViewModels/ViewModelBase.cs @@ -1,9 +1,5 @@ using System; -#if NETFRAMEWORK -using NotificationObject = Microsoft.Practices.Prism.ViewModel.NotificationObject; -#else using NotificationObject = Dynamo.Core.NotificationObject; -#endif using Newtonsoft.Json; namespace Dynamo.ViewModels diff --git a/src/DynamoCoreWpf/Views/CodeBlocks/CodeBlockMethodInsightWindow.cs b/src/DynamoCoreWpf/Views/CodeBlocks/CodeBlockMethodInsightWindow.cs index 88ce2fbddae..71ce329d6bc 100644 --- a/src/DynamoCoreWpf/Views/CodeBlocks/CodeBlockMethodInsightWindow.cs +++ b/src/DynamoCoreWpf/Views/CodeBlocks/CodeBlockMethodInsightWindow.cs @@ -6,11 +6,7 @@ using Dynamo.Engine.CodeCompletion; using ICSharpCode.AvalonEdit.CodeCompletion; using ICSharpCode.AvalonEdit.Editing; -#if NETFRAMEWORK -using NotificationObject = Microsoft.Practices.Prism.ViewModel.NotificationObject; -#else using NotificationObject = Dynamo.Core.NotificationObject; -#endif namespace Dynamo.UI { diff --git a/src/DynamoUtilities/ObservableHashSet.cs b/src/DynamoUtilities/ObservableHashSet.cs index d9620afaa72..1f38ad9fc4d 100644 --- a/src/DynamoUtilities/ObservableHashSet.cs +++ b/src/DynamoUtilities/ObservableHashSet.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Specialized; using System.Collections.Generic; using System.Linq; diff --git a/src/Libraries/CoreNodeModelsWpf/NodeViewCustomizations/SelectionBase.cs b/src/Libraries/CoreNodeModelsWpf/NodeViewCustomizations/SelectionBase.cs index c2f8f77a794..6cb7eb3c134 100644 --- a/src/Libraries/CoreNodeModelsWpf/NodeViewCustomizations/SelectionBase.cs +++ b/src/Libraries/CoreNodeModelsWpf/NodeViewCustomizations/SelectionBase.cs @@ -2,11 +2,7 @@ using CoreNodeModels; using Dynamo.Controls; using Dynamo.Wpf; -#if NETFRAMEWORK -using Microsoft.Practices.Prism.Commands; -#else using Prism.Commands; -#endif namespace CoreNodeModelsWpf.Nodes { diff --git a/src/Tools/DynamoShapeManager/Utilities.cs b/src/Tools/DynamoShapeManager/Utilities.cs index 47d3b6ac820..a39776284d5 100644 --- a/src/Tools/DynamoShapeManager/Utilities.cs +++ b/src/Tools/DynamoShapeManager/Utilities.cs @@ -593,7 +593,6 @@ public static Version GetVersionFromPath(string asmPath, string searchPattern = var ASMFilePath = Directory.GetFiles(asmPath, searchPattern, SearchOption.TopDirectoryOnly).FirstOrDefault(); if (ASMFilePath != null && File.Exists(ASMFilePath)) { -#if NET6_0_OR_GREATER if (!OperatingSystem.IsWindows()) { string fileName = Path.GetFileNameWithoutExtension(ASMFilePath); @@ -609,7 +608,6 @@ public static Version GetVersionFromPath(string asmPath, string searchPattern = } return new Version($"{version}.0.0"); } -#endif var asmVersion = FileVersionInfo.GetVersionInfo(ASMFilePath); var libGversion = new Version(asmVersion.FileMajorPart, asmVersion.FileMinorPart, asmVersion.FileBuildPart); return libGversion; diff --git a/test/DynamoCoreTests/Configuration/ExecutionSessionTests.cs b/test/DynamoCoreTests/Configuration/ExecutionSessionTests.cs index 474d64894d8..e968f919e73 100644 --- a/test/DynamoCoreTests/Configuration/ExecutionSessionTests.cs +++ b/test/DynamoCoreTests/Configuration/ExecutionSessionTests.cs @@ -21,11 +21,8 @@ protected override void GetLibrariesToPreload(List libraries) libraries.Add("FunctionObject.ds"); base.GetLibrariesToPreload(libraries); } -#if NET6_0_OR_GREATER + [OneTimeSetUp] -#elif NETFRAMEWORK - [TestFixtureSetUp] -#endif public void FixtureSetup() { ExecutionEvents.GraphPostExecution += ExecutionEvents_GraphPostExecution; @@ -55,11 +52,7 @@ private void ExecutionEvents_GraphPreExecution(Session.IExecutionSession session } -#if NET6_0_OR_GREATER [OneTimeTearDown] -#elif NETFRAMEWORK - [TestFixtureTearDown] -#endif public void TearDown() { ExecutionEvents.GraphPostExecution -= ExecutionEvents_GraphPostExecution; diff --git a/test/DynamoCoreTests/Crypto/DynamoCyptoTests.cs b/test/DynamoCoreTests/Crypto/DynamoCyptoTests.cs deleted file mode 100644 index 306fe6719f2..00000000000 --- a/test/DynamoCoreTests/Crypto/DynamoCyptoTests.cs +++ /dev/null @@ -1,84 +0,0 @@ -using System.IO; -using System.Reflection; -using System.Security.Cryptography.X509Certificates; -using NUnit.Framework; - -//TODO Get rid of these tests, DynamoSign and DynamoCrypto. -#if NETFRAMEWORK - -namespace DynamoCrypto -{ - [TestFixture] - class DynamoCyptoTests - { - [Test] - [Category("Failure")] - public void VerificationFailsForAlteredFile() - { - var asm = Assembly.GetExecutingAssembly().Location; - var asmDir = Path.GetDirectoryName(asm); - var testFile = - Path.GetFullPath( - Path.Combine(asmDir, @"..\..\..\test\DynamoCoreTests\Crypto\AnAlteredFile.txt")); - var sigFile = - Path.GetFullPath( - Path.Combine(asmDir, @"..\..\..\test\DynamoCoreTests\Crypto\AnImportantFile.sig")); - - var pubKey = AssertCertAndPublicKey(); - - var verify = Utils.VerifyFile(testFile, sigFile, pubKey); - Assert.False(verify, "The verification passed, but the file had been altered."); - } - - [Test] - [Category("Failure")] - public void VerificationFailsForAlteredSignature() - { - var asm = Assembly.GetExecutingAssembly().Location; - var asmDir = Path.GetDirectoryName(asm); - var testFile = - Path.GetFullPath( - Path.Combine(asmDir, @"..\..\..\test\DynamoCoreTests\Crypto\AnImportantFile.txt")); - var sigFile = - Path.GetFullPath( - Path.Combine(asmDir, @"..\..\..\test\DynamoCoreTests\Crypto\AnAlteredSignature.sig")); - - var pubKey = AssertCertAndPublicKey(); - - var verify = Utils.VerifyFile(testFile, sigFile, pubKey); - Assert.False(verify, "The verification passed, but the signature file had been altered."); - } - - [Test] - [Category("Failure")] - public void VertificationSucceedsIfAllIsGood() - { - var asm = Assembly.GetExecutingAssembly().Location; - var asmDir = Path.GetDirectoryName(asm); - var testFile = - Path.GetFullPath( - Path.Combine(asmDir, @"..\..\..\test\DynamoCoreTests\Crypto\AnImportantFile.txt")); - var sigFile = - Path.GetFullPath( - Path.Combine(asmDir, @"..\..\..\test\DynamoCoreTests\Crypto\AnImportantFile.sig")); - - var pubKey = AssertCertAndPublicKey(); - - var verify = Utils.VerifyFile(testFile, sigFile, pubKey); - Assert.True(verify, "The file could not be verified against the signature."); - } - - private static byte[] AssertCertAndPublicKey() - { - var cert = Utils.FindCertificateForCurrentUser("Dynamo", StoreLocation.CurrentUser); - Assert.NotNull(cert, "Dynamo certificate could not be found. Perhaps you need to install the certificate on the testing machine?"); - - var pubKey = Utils.GetPublicKeyFromCertificate(cert); - Assert.NotNull(pubKey, "A public key could not be returned from the certificate."); - - return pubKey; - } - } -} - -#endif diff --git a/test/DynamoCoreTests/DummyNodeTests.cs b/test/DynamoCoreTests/DummyNodeTests.cs index 99e0c0b55fc..64ca1628fa6 100644 --- a/test/DynamoCoreTests/DummyNodeTests.cs +++ b/test/DynamoCoreTests/DummyNodeTests.cs @@ -115,11 +115,7 @@ public void IfDeserializationThrowsDummyNodeStillCreated() Assert.AreEqual(1, CurrentDynamoModel.CurrentWorkspace.Nodes.OfType().Count()); var dummyNode = CurrentDynamoModel.CurrentWorkspace.Nodes.OfType().First(); //runtime behavior has changed for assembly resolve handlers that throw exceptions. -#if NET6_0_OR_GREATER Assert.AreEqual(2, exceptionCount); -#elif NETFRAMEWORK - Assert.AreEqual(1, exceptionCount); -#endif AppDomain.CurrentDomain.AssemblyResolve -= handler; } diff --git a/test/DynamoCoreTests/HomgeneousListTests.cs b/test/DynamoCoreTests/HomgeneousListTests.cs index 3337e7ce5a2..c2c8e4c7e36 100644 --- a/test/DynamoCoreTests/HomgeneousListTests.cs +++ b/test/DynamoCoreTests/HomgeneousListTests.cs @@ -26,11 +26,8 @@ protected override void GetLibrariesToPreload(List libraries) libraries.Add("FunctionObject.ds"); base.GetLibrariesToPreload(libraries); } -#if NET6_0_OR_GREATER + [OneTimeSetUp] -#elif NETFRAMEWORK - [TestFixtureSetUp] -#endif public void FixtureSetup() { ExecutionEvents.GraphPostExecution += ExecutionEvents_GraphPostExecution; @@ -66,11 +63,7 @@ public void TestMethodResolutionforHeterogeneousListInputs() }); } -#if NET6_0_OR_GREATER [OneTimeTearDown] -#elif NETFRAMEWORK - [TestFixtureTearDown] -#endif public void TearDown() { ExecutionEvents.GraphPostExecution -= ExecutionEvents_GraphPostExecution; diff --git a/test/DynamoCoreTests/MigrationTestFramework.cs b/test/DynamoCoreTests/MigrationTestFramework.cs index 71b0a9efc5c..28f77fb1eaf 100644 --- a/test/DynamoCoreTests/MigrationTestFramework.cs +++ b/test/DynamoCoreTests/MigrationTestFramework.cs @@ -62,12 +62,11 @@ static List SetupMigrationTests() { if (fileInfo.FullName.Contains("FAILURE")) continue; -#if NET6_0_OR_GREATER + var filenameLowerInvariant = fileInfo.FullName.ToLowerInvariant(); //TODO_NET6 excel nodes and legacy unitUI nodes not built for net6. if (filenameLowerInvariant.Contains("excel") || filenameLowerInvariant.Contains("testmigration_core_input.dyn") ) continue; -#endif testParameters.Add(fileInfo.FullName); } diff --git a/test/DynamoCoreTests/Properties/AssemblyInfo.cs b/test/DynamoCoreTests/Properties/AssemblyInfo.cs index 24f47be7129..48f71483558 100644 --- a/test/DynamoCoreTests/Properties/AssemblyInfo.cs +++ b/test/DynamoCoreTests/Properties/AssemblyInfo.cs @@ -9,11 +9,7 @@ // associated with an assembly. [assembly: AssemblyTitle("DynamoCoreTests")] [assembly: AssemblyCulture("")] -#if NET6_0_OR_GREATER [assembly: Apartment(ApartmentState.STA)] -#elif NETFRAMEWORK - [assembly: RequiresSTA] -#endif // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("1a12b389-dc06-4114-ac45-2e0903cab66d")] [assembly: InternalsVisibleTo("DynamoCoreTests")] diff --git a/test/DynamoCoreTests/SchedulerTests.cs b/test/DynamoCoreTests/SchedulerTests.cs index bf292716185..d59b174fae9 100644 --- a/test/DynamoCoreTests/SchedulerTests.cs +++ b/test/DynamoCoreTests/SchedulerTests.cs @@ -421,11 +421,7 @@ public void TimeStampGenerator00() /// from getting the same time-stamp value. /// /// -#if NETFRAMEWORK - [Test, RequiresMTA] -#elif NET6_0_OR_GREATER [Test, Apartment(ApartmentState.MTA)] -#endif [Category("UnitTests")] public void TimeStampGenerator01() { diff --git a/test/DynamoCoreTests/SerializationTests.cs b/test/DynamoCoreTests/SerializationTests.cs index 4b4a7f40b45..82e361a1af4 100644 --- a/test/DynamoCoreTests/SerializationTests.cs +++ b/test/DynamoCoreTests/SerializationTests.cs @@ -293,12 +293,7 @@ public static void CompareWorkspaceModels(serializationTestUtils.WorkspaceCompar // When values are geometry, sometimes the creation // of the string representation for forming this message // fails. -#if NET6_0_OR_GREATER Assert.That(valueA, Is.EqualTo(valueB).Using(DynamoDictionaryEquality), - -#elif NETFRAMEWORK - Assert.That(valueA, Is.EqualTo(valueB), -#endif string.Format("Node Type:{0} value, {1} is not equal to {2}", a.NodeTypeMap[kvp.Key], valueA, valueB)); } @@ -410,12 +405,8 @@ public static void CompareWorkspacesDifferentGuids(serializationTestUtils.Worksp // When values are geometry, sometimes the creation // of the string representation for forming this message // fails. -#if NET6_0_OR_GREATER Assert.That(valueA, Is.EqualTo(valueB).Using(DynamoDictionaryEquality), -#elif NETFRAMEWORK - Assert.That(valueA, Is.EqualTo(valueB), -#endif string.Format("Node Type:{0} value, {1} is not equal to {2}", a.NodeTypeMap[kvp.Key], valueA, valueB)); } @@ -608,11 +599,7 @@ protected override void GetLibrariesToPreload(List libraries) base.GetLibrariesToPreload(libraries); } -#if NETFRAMEWORK - [TestFixtureSetUp] -#elif NET6_0_OR_GREATER [OneTimeSetUp] -#endif public void FixtureSetup() { ExecutionEvents.GraphPostExecution += ExecutionEvents_GraphPostExecution; @@ -651,11 +638,7 @@ public void FixtureSetup() } } -#if NETFRAMEWORK - [TestFixtureTearDown] -#elif NET6_0_OR_GREATER [OneTimeTearDown] -#endif public void TearDown() { ExecutionEvents.GraphPostExecution -= ExecutionEvents_GraphPostExecution; diff --git a/test/DynamoCoreTests/Setup.cs b/test/DynamoCoreTests/Setup.cs index 60f6ebdf7f6..51a8589d12b 100644 --- a/test/DynamoCoreTests/Setup.cs +++ b/test/DynamoCoreTests/Setup.cs @@ -9,11 +9,7 @@ public class Setup { private AssemblyHelper assemblyHelper; -#if NETFRAMEWORK - [SetUp] -#elif NET6_0_OR_GREATER [OneTimeSetUp] -#endif public void RunBeforeAllTests() { var assemblyPath = Assembly.GetExecutingAssembly().Location; @@ -30,11 +26,7 @@ public void RunBeforeAllTests() AppDomain.CurrentDomain.AssemblyResolve += assemblyHelper.ResolveAssembly; } -#if NETFRAMEWORK - [TearDown] -#elif NET6_0_OR_GREATER [OneTimeTearDown] -#endif public void RunAfterAllTests() { AppDomain.CurrentDomain.AssemblyResolve -= assemblyHelper.ResolveAssembly; diff --git a/test/Engine/FFITarget/ClassFunctionality.cs b/test/Engine/FFITarget/ClassFunctionality.cs index 7d7515f642c..3eba8efaae5 100644 --- a/test/Engine/FFITarget/ClassFunctionality.cs +++ b/test/Engine/FFITarget/ClassFunctionality.cs @@ -8,20 +8,6 @@ namespace FFITarget /// public class ClassFunctionality : IDisposable { -#if NETFRAMEWORK - public static Microsoft.Office.Interop.Excel.XlPivotLineType GetExcelInteropType() - { - return Microsoft.Office.Interop.Excel.XlPivotLineType.xlPivotLineBlank; - } - - public static bool TestExcelInteropType(Microsoft.Office.Interop.Excel.XlPivotLineType arg1) - { - if (arg1 == Microsoft.Office.Interop.Excel.XlPivotLineType.xlPivotLineBlank) - return true; - - return false; - } -#endif private int intVal; public int IntVal { get { return intVal; } diff --git a/test/Engine/ProtoTest/FFITests/FFITest.cs b/test/Engine/ProtoTest/FFITests/FFITest.cs index 258aaf593db..c014bbedd41 100644 --- a/test/Engine/ProtoTest/FFITests/FFITest.cs +++ b/test/Engine/ProtoTest/FFITests/FFITest.cs @@ -211,22 +211,6 @@ public void TestReturnArbitraryDimensionAttribute() thisTest.Verify("x", new object[] { 1.3, new double[] { 4.5, 7.8 } }); } -#if NETFRAMEWORK - [Test] - public void Test_Embedded_Interop_Types() - { - string code = @" -import (ClassFunctionality from ""FFITarget.dll""); -import (EmbeddedInteropTestClass from ""..\\..\\..\\test\\test_dependencies\\EmbeddedInterop.dll""); - - val = EmbeddedInteropTestClass.GetExcelInteropType(); - o = ClassFunctionality.TestExcelInteropType(val); -"; - - thisTest.RunScriptSource(code); - thisTest.Verify("o", true); - } -#endif [Test] public void Test_OfficeImportedTypes() diff --git a/test/Libraries/CommandLineTests/CommandLineTests.cs b/test/Libraries/CommandLineTests/CommandLineTests.cs index fe952d9d853..7c3a153659c 100644 --- a/test/Libraries/CommandLineTests/CommandLineTests.cs +++ b/test/Libraries/CommandLineTests/CommandLineTests.cs @@ -223,12 +223,8 @@ public void CanOpenAndRunFileWithDictionaryCorrectlyToOutputFileFromDynamoCLIexe // DynamoWPFCLI Tests // -#if NET6_0_OR_GREATER [Test] [Apartment(ApartmentState.STA)] -#else - [Test, RequiresSTA] -#endif public void CanOpenAndRunDynamoModelWithWPFCommandLineRunner() { string openpath = Path.Combine(TestDirectory, @"core\math\Add.dyn"); @@ -251,12 +247,8 @@ public void CanOpenAndRunDynamoModelWithWPFCommandLineRunner() AssertPreviewValue("4c5889ac-7b91-4fb5-aaad-a2128b533279", 4.0); } -#if NET6_0_OR_GREATER [Test] [Apartment(ApartmentState.STA)] -#else - [Test, RequiresSTA] -#endif public void CanOpenAndRunFileWihtListsCorrectlyToOutputFileFromDynamoWPFCLIexe() { string openpath = Path.Combine(TestDirectory, @"core\commandline\simplelists.dyn"); @@ -273,12 +265,8 @@ public void CanOpenAndRunFileWihtListsCorrectlyToOutputFileFromDynamoWPFCLIexe() output); } -#if NET6_0_OR_GREATER [Test] [Apartment(ApartmentState.STA)] -#else - [Test, RequiresSTA] -#endif public void CanOpenAndRunFileWithDictionaryCorrectlyToOutputFileFromDynamoWPFCLIexe() { string openpath = Path.Combine(TestDirectory, @"core\commandline\simpleDict.dyn"); @@ -301,12 +289,8 @@ public void CanOpenAndRunFileWithDictionaryCorrectlyToOutputFileFromDynamoWPFCLI }, output); } -#if NET6_0_OR_GREATER [Test] [Apartment(ApartmentState.STA)] -#else - [Test, RequiresSTA] -#endif public void CanOpenAndRunFileWithCustomNodeAndOutputGeometryFromDynamoWPFCLIexe() { string openpath = Path.Combine(TestDirectory, @"core\commandline\GeometryTest.dyn"); diff --git a/test/Libraries/CoreNodesTests/Setup.cs b/test/Libraries/CoreNodesTests/Setup.cs index 7593c67a016..1c95ff7bed8 100644 --- a/test/Libraries/CoreNodesTests/Setup.cs +++ b/test/Libraries/CoreNodesTests/Setup.cs @@ -10,11 +10,7 @@ public class Setup { private AssemblyHelper assemblyHelper; -#if NETFRAMEWORK - [SetUp] -#elif NET6_0_OR_GREATER [OneTimeSetUp] -#endif public void SetUp() { var assemblyPath = Assembly.GetExecutingAssembly().Location; @@ -32,11 +28,7 @@ public void SetUp() AppDomain.CurrentDomain.AssemblyResolve += assemblyHelper.ResolveAssembly; } -#if NETFRAMEWORK - [TearDown] -#elif NET6_0_OR_GREATER [OneTimeTearDown] -#endif public void TearDown() { AppDomain.CurrentDomain.AssemblyResolve -= assemblyHelper.ResolveAssembly; diff --git a/test/Libraries/DynamoMSOfficeTests/DynamoMSOfficeTests.csproj b/test/Libraries/DynamoMSOfficeTests/DynamoMSOfficeTests.csproj index 290a684e9f5..4eeb7f5dd9d 100644 --- a/test/Libraries/DynamoMSOfficeTests/DynamoMSOfficeTests.csproj +++ b/test/Libraries/DynamoMSOfficeTests/DynamoMSOfficeTests.csproj @@ -21,7 +21,8 @@ - + + {7858FA8C-475F-4B8E-B468-1F8200778CF8} DynamoCore @@ -37,16 +38,14 @@ CoreNodeModels False - - {472084ED-1067-4B2C-8737-3839A6143EB2} - DynamoCoreTests - False - {B5F435CB-0D8A-40B1-A4F7-5ECB3CE792A9} DynamoUtilities False - + + + + diff --git a/test/Libraries/DynamoMSOfficeTests/ExcelTests.cs b/test/Libraries/DynamoMSOfficeTests/ExcelTests.cs index ff76d3a1132..6e60dbbebe5 100644 --- a/test/Libraries/DynamoMSOfficeTests/ExcelTests.cs +++ b/test/Libraries/DynamoMSOfficeTests/ExcelTests.cs @@ -1,6 +1,14 @@ +using CoreNodeModels.Input; using DSOffice; +using Dynamo.Configuration; +using Dynamo.Graph.Connectors; +using Dynamo.Graph.Nodes; using NUnit.Framework; +using ProtoCore.DSASM; +using ProtoCore.Mirror; +using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Linq; using System.Threading; @@ -8,18 +16,10 @@ namespace Dynamo.Tests { - -#if NET6_0_OR_GREATER - [TestFixture, Apartment(ApartmentState.MTA)] - public class ExcelTests - { - } -#elif NETFRAMEWORK - [TestFixture, RequiresSTA] + [TestFixture] public class ExcelTests : DynamoViewModelUnitTest { - protected override void GetLibrariesToPreload(List libraries) { libraries.Add("DesignScriptBuiltin.dll"); @@ -1025,7 +1025,8 @@ public void WritenodeWithWarning() } - [Test, Category("Failure")] + + [Test, Category("Failure")] public void WriteToReadOnlyFile() { @@ -1364,10 +1365,11 @@ public void TestFormula() } #endregion } -#endif + + [TestFixture] public class CSVTests : UnitTestBase - { + { [Test] [Category("UnitTests")] public static void ImportCSV_PathTest() diff --git a/test/Libraries/DynamoMSOfficeTests/OpenXmlTests.cs b/test/Libraries/DynamoMSOfficeTests/OpenXmlTests.cs index db58f0b2eff..49216332334 100644 --- a/test/Libraries/DynamoMSOfficeTests/OpenXmlTests.cs +++ b/test/Libraries/DynamoMSOfficeTests/OpenXmlTests.cs @@ -11,789 +11,9 @@ namespace DynamoMSOfficeTests { -#if NET6_0_OR_GREATER [TestFixture, Apartment(ApartmentState.MTA)] public class OpenXmlTests { } -#elif NETFRAMEWORK - [TestFixture, RequiresSTA] - public class OpenXmlTests : DynamoViewModelUnitTest - { - protected override void GetLibrariesToPreload(List libraries) - { - libraries.Add("DesignScriptBuiltin.dll"); - libraries.Add("DSCoreNodes.dll"); - libraries.Add("DSOffice.dll"); - libraries.Add("FunctionObject.ds"); - } - - #region Reading - - [Test] - public void CanGetLargeWorkbookWithinThresholdTime() - { - string openPath = Path.Combine(TestDirectory, @"core\excel\HammersmithOpenXmlFile_Open.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - Assert.AreEqual(3, ViewModel.CurrentSpace.Nodes.Count()); - - var timer = new Stopwatch(); - timer.Start(); - ViewModel.HomeSpace.Run(); - timer.Stop(); - Assert.Less(timer.Elapsed.Milliseconds, 1000); // open in less than 1s - } - - [Test] - public void FailsGracefullyWhenSheetIsNotFound() - { - string openPath = Path.Combine(TestDirectory, @"core\excel\InvalidSheet_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var node = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - - ViewModel.HomeSpace.Run(); - - Assert.AreEqual(ElementState.Warning, node.State); - Assert.True(node.Infos.Any(x => x.Message.Contains("A worksheet with the provided name 'NotAWorksheet' was not found in the workbook.") && - x.State == ElementState.Warning)); - } - - [Test] - public void CanReadWorksheetWithSingleColumnOfNumbers() - { - string openPath = Path.Combine(TestDirectory, @"core\excel\SingleColumnAscending_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var node = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - - ViewModel.HomeSpace.Run(); - - Assert.IsTrue(node.CachedValue.IsCollection); - var list = node.CachedValue.GetElements().ToList(); - - Assert.AreEqual(16, list.Count); - - // contents of first workbook is ascending array of numbers starting at 1 - for (var i = 0; i < 16; i++) - { - // get data returns 2d array - Assert.IsTrue(list[i].IsCollection); - var rowList = list[i].GetElements().ToList(); - Assert.AreEqual(1, rowList.Count()); - Assert.AreEqual(i + 1, rowList[0].Data); - } - } - - [Test] - public void CanReadMultiDimensionalWorksheet() - { - string openPath = Path.Combine(TestDirectory, @"core\excel\MultiColumn_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var node = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - - ViewModel.HomeSpace.Run(); - - Assert.IsTrue(node.CachedValue.IsCollection); - var list = node.CachedValue.GetElements().ToList(); - Assert.AreEqual(18, list.Count); - - // 18 x 3 array of numbers - for (var i = 0; i < 18; i++) - { - // get data returns 2d array - Assert.IsTrue(list[i].IsCollection); - var rowList = list[i].GetElements().ToList(); - Assert.AreEqual(3, rowList.Count); - - for (var j = 0; j < 3; j++) - { - Assert.AreEqual((i + 1) + j, rowList[j].Data); - } - } - } - - [Test] - public void CanReadWorksheetWithEmptyCellInUsedRange() - { - string openPath = Path.Combine(TestDirectory, @"core\excel\MissingCell_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var node = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - - ViewModel.HomeSpace.Run(); - - var data = new object[] { new object[] { "a" }, new object[] { null }, new object[] { "cell is" }, new object[] { "missing" } }; - AssertPreviewValue(node.GUID.ToString(), data); - } - - [Test] - public void CanReadWorksheetWithMixedNumbersAndStrings() - { - string openPath = Path.Combine(TestDirectory, @"core\excel\MixedNumbersAndStrings_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var node = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - - ViewModel.HomeSpace.Run(); - - Assert.IsTrue(node.CachedValue.IsCollection); - var data = new object[] { new object[] { 1 }, new object[] { "word" }, new object[] { 2 }, new object[] { 3 }, new object[] { "palabra" } }; - - AssertPreviewValue(node.GUID.ToString(), data); - } - - [Test] - public void ReadOnlyFile() - { - string openPath = Path.Combine(TestDirectory, @"core\excel\ReadOnlyFile_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var node = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - - ViewModel.HomeSpace.Run(); - - var data = new object[] { new object[] { 4 }, new object[] { 5 }, new object[] { 6 }, new object[] { 7 }, new object[] { 8 }, new object[] { 9 }, new object[] { 10 } }; - AssertPreviewValue(node.GUID.ToString(), data); - } - - [Test] - public void ReadNonExistingFile() - { - string openPath = Path.Combine(TestDirectory, @"core\excel\ReadNonExistingFile_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var node = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - ViewModel.HomeSpace.Run(); - - Assert.AreEqual(ElementState.Warning, node.State); - Assert.True(node.Infos.Any(x => x.Message.Contains("A workbook was not found in the provided path.") && x.State == ElementState.Warning)); - } - - [Test] - public void CanReadExcelAsStrings() - { - string openPath = Path.Combine(TestDirectory, @"core\excel\ReadAsStrings_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var node = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - ViewModel.HomeSpace.Run(); - - Assert.IsTrue(node.CachedValue.IsCollection); - - var data = new object[] { new object[] { "1" }, new object[] { "word" }, new object[] { "2" }, new object[] { "3" }, new object[] { "palabra" } }; - AssertPreviewValue(node.GUID.ToString(), data); - } - - [Test] - public void CanReadEmptyCellsAsStrings() - { - string openPath = Path.Combine(TestDirectory, @"core\excel\ReadEmptyCellsAsStrings_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var node = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - ViewModel.HomeSpace.Run(); - - Assert.IsTrue(node.CachedValue.IsCollection); - - var data = new object[] - { - new object[] { "5", null, null, null, null, null, null, null, null, null }, - new object[] { null, null, null, null, null, null, null, null, null, null }, - new object[] { null, null, null, null, null, null, null, null, null, null }, - new object[] { null, null, null, null, null, null, null, null, null, null }, - new object[] { null, null, null, "afsd", null, null, null, null, null, null }, - new object[] { null, null, null, null, null, null, null, null, null, null }, - new object[] { null, null, null, null, null, null, null, null, null, null }, - new object[] { null, null, null, null, null, null, null, null, null, null }, - new object[] { null, null, null, null, null, null, null, null, null, null }, - new object[] { null, null, null, null, null, null, null, null, null, null }, - new object[] { null, null, null, null, null, null, null, null, null, null }, - new object[] { null, null, null, null, null, "sfsd", null, null, null, null }, - new object[] { null, null, null, null, null, null, null, null, null, null }, - new object[] { null, null, null, null, null, null, null, null, null, null }, - new object[] { null, null, null, null, null, null, null, null, null, "3453425" } - }; - - AssertPreviewValue(node.GUID.ToString(), data); - } - - [Test] - public void Defect_MAGN_883() - { - string testDir = TestDirectory; - string openPath = Path.Combine(testDir, @"core\excel\Defect_MAGN_883_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - ViewModel.HomeSpace.Run(); - Assert.Pass("RunExpression should no longer crash (Defect_MAGN_883)"); - } - - [Test] - public void TestFormula() - { - string testDir = TestDirectory; - string openPath = Path.Combine(testDir, @"core\excel\formula_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var node = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - ViewModel.HomeSpace.Run(); - - Assert.IsTrue(node.CachedValue.IsCollection); - var data2 = new object[] { new object[] { 1 }, new object[] { 2 }, new object[] { 3 }, new object[] { null }, new object[] { 6 } }; - AssertPreviewValue(node.GUID.ToString(), data2); - } - - [Test] - public void TestScientificNotationAsADoubleValue() - { - string testDir = TestDirectory; - string openPath = Path.Combine(testDir, @"core\excel\scientificNotation_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var node = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - ViewModel.HomeSpace.Run(); - - Assert.IsTrue(node.CachedValue.IsCollection); - var data2 = new object[] { new object[] { 1, 0.5d }, new object[] { 2, 0.00000000005d }, new object[] { 3, 0.0005 }, new object[] { 4, 0.05d }, new object[] { 5, 0.00000003 }, new object[] { 6, 0.0000000000000000002 } }; - AssertPreviewValue(node.GUID.ToString(), data2); - } - - #endregion - - - #region Writing - - [Test] - public void CanWrite1DDataOfMixedTypesToExcelWorksheet() - { - string openPath = Path.Combine(TestDirectory, @"core\excel\WriteMixed1DData_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var filePath = Path.Combine(TempFolder, $"{nameof(CanWrite1DDataOfMixedTypesToExcelWorksheet)}_output.xlsx"); - var stringNode = ViewModel.Model.CurrentWorkspace.FirstNodeFromWorkspace(); - stringNode.Value = filePath; - - var node = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - - ViewModel.HomeSpace.Run(); - - Assert.IsTrue(node.CachedValue.IsCollection); - - var data = new object[] { new object[] { "text" }, new object[] { true }, new object[] { new DateTime(2021, 4, 1, 14, 51, 30, 0) }, new object[] { 1 }, new object[] { 1.23 } }; - AssertPreviewValue(node.GUID.ToString(), data); - } - - [Test] - public void WriteListsDifferentSizes_MAGN6872() - { - string openPath = Path.Combine(TestDirectory, @"core\excel\MAGN6872_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var filePath = Path.Combine(TempFolder, $"{nameof(WriteListsDifferentSizes_MAGN6872)}_output.xlsx"); - var stringNode = ViewModel.Model.CurrentWorkspace.FirstNodeFromWorkspace(); - stringNode.Value = filePath; - - var node = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - ViewModel.HomeSpace.Run(); - - Assert.IsTrue(node.CachedValue.IsCollection); - var list = node.CachedValue.GetElements().ToList(); - - Assert.AreEqual(4, list.Count()); - - Assert.IsTrue(list[0].IsCollection); - var rowList = list[0].GetElements(); - - List dataList0 = new List(); - foreach (MirrorData data in rowList) - { - dataList0.Add(data.Data); - } - Assert.AreEqual(new object[] { 1.00, 2.00, 3.00, null, null, null, null }, dataList0); - - rowList = list[1].GetElements(); - List dataList1 = new List(); - foreach (MirrorData data in rowList) - { - dataList1.Add(data.Data); - } - Assert.AreEqual(new object[] { 1.00, 2.00, 3.00, 4.00, 5.00, null, null }, dataList1); - - Assert.IsTrue(list[2].IsCollection); - rowList = list[2].GetElements(); - List dataList2 = new List(); - foreach (MirrorData data in rowList) - { - dataList2.Add(data.Data); - } - Assert.AreEqual(new object[] { 1.00, 2.00, 3.00, 4.00, 5.00, 6.00, 7.00 }, dataList2); - - Assert.IsTrue(list[3].IsCollection); - rowList = list[3].GetElements(); - List dataList3 = new List(); - foreach (MirrorData data in rowList) - { - dataList3.Add(data.Data); - } - Assert.AreEqual(new object[] { 1.00, 2.00, 3.00, 4.00, 5.00, null, null }, dataList3); - } - - /// - /// Overwrite the excel sheet with null values and it must work ok. - /// - [Test] - public void OverwriteWithNull_MAGN7213() - { - // Copy the file so we don't write over the original - string excelFilePath = Path.Combine(TestDirectory, @"core\excel\Excel_MAGN7213.xlsx"); - var filePath = Path.Combine(TempFolder, $"{nameof(OverwriteWithNull_MAGN7213)}_output.xlsx"); - File.Copy(excelFilePath, filePath); - - string openPath = Path.Combine(TestDirectory, @"core\excel\MAGN7213_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var stringNode = ViewModel.Model.CurrentWorkspace.FirstNodeFromWorkspace(); - stringNode.Value = filePath; - - var node = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - ViewModel.HomeSpace.Run(); - - Assert.IsTrue(node.CachedValue.IsCollection); - var data = new object[] { new object[] { 2 }, new object[] { null }, new object[] { 3 } }; - AssertPreviewValue(node.GUID.ToString(), data); - } - - /// - /// Overwrite an existing file with EmptyList- it must run ok. - /// - [Test] - public void OverwriteEmptyList_MAGN7213() - { - // Copy the file so we don't write over the original - string excelFilePath = Path.Combine(TestDirectory, @"core\excel\Excel_MAGN7213_2.xlsx"); - var filePath = Path.Combine(TempFolder, $"{nameof(OverwriteEmptyList_MAGN7213)}_output.xlsx"); - File.Copy(excelFilePath, filePath); - - string openPath = Path.Combine(TestDirectory, @"core\excel\MAGN7213_2_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var stringNode = ViewModel.Model.CurrentWorkspace.FirstNodeFromWorkspace(); - stringNode.Value = filePath; - - var node = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - ViewModel.HomeSpace.Run(); - - Assert.IsTrue(node.CachedValue.IsCollection); - var data = new object[] { new object[] { 2 }, new object[] { null }, new object[] { 3 } }; - AssertPreviewValue(node.GUID.ToString(), data); - } - - [Test] - public void CanCreateNewWorksheetInNewWorkbook() - { - string openPath = Path.Combine(TestDirectory, @"core\excel\NewWorkbook_AddWorksheet_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var filePath = Path.Combine(TempFolder, $"{nameof(CanCreateNewWorksheetInNewWorkbook)}_output.xlsx"); - var stringNode = ViewModel.Model.CurrentWorkspace.FirstNodeFromWorkspace(); - stringNode.Value = filePath; - - var node = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - ViewModel.HomeSpace.Run(); - - Assert.IsTrue(node.CachedValue.IsCollection); - var data = new object[] { new object[] { 1 }, new object[] { 2 }, new object[] { 3 } }; - AssertPreviewValue(node.GUID.ToString(), data); - } - - [Test] - public void CanAddSingleItemToExcelWorksheet() - { - string openPath = Path.Combine(TestDirectory, @"core\excel\NewWorkbook_AddSingleItemData_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var filePath = Path.Combine(TempFolder, $"{nameof(CanAddSingleItemToExcelWorksheet)}_output.xlsx"); - var stringNode = ViewModel.Model.CurrentWorkspace.FirstNodeFromWorkspace(); - stringNode.Value = filePath; - - var node = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - ViewModel.HomeSpace.Run(); - - Assert.IsTrue(node.CachedValue.IsCollection); - var list = node.CachedValue.GetElements().ToList(); - Assert.AreEqual(1, list.Count()); - - // get data returns 2d array - Assert.IsTrue(list[0].IsCollection); - var rowList = list[0].GetElements().ToList(); - Assert.AreEqual(1, rowList.Count()); - Assert.AreEqual(100.0, rowList[0].Data); - } - - [Test] - public void CanAddNullItemToExcelWorksheet() - { - string openPath = Path.Combine(TestDirectory, @"core\excel\NewWorkbook_AddNullItemData_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var filePath = Path.Combine(TempFolder, $"{nameof(CanAddNullItemToExcelWorksheet)}_output.xlsx"); - var stringNode = ViewModel.Model.CurrentWorkspace.FirstNodeFromWorkspace(); - stringNode.Value = filePath; - - var node = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - ViewModel.HomeSpace.Run(); - - Assert.IsNull(node.CachedValue.Data); - } - - [Test] - public void CanAdd1DListToExcelWorksheet() - { - string openPath = Path.Combine(TestDirectory, @"core\excel\NewWorkbook_Add1DListData_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var filePath = Path.Combine(TempFolder, $"{nameof(CanAdd1DListToExcelWorksheet)}_output.xlsx"); - var stringNode = ViewModel.Model.CurrentWorkspace.FirstNodeFromWorkspace(); - stringNode.Value = filePath; - - var node = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - ViewModel.HomeSpace.Run(); - - Assert.IsTrue(node.CachedValue.IsCollection); - var list = node.CachedValue.GetElements().ToList(); - - Assert.AreEqual(101, list.Count()); - - var counter = 0; - for (var i = 0; i < 101; i++) - { - // get data returns 2d array - Assert.IsTrue(list[i].IsCollection); - var rowList = list[i].GetElements().ToList(); - Assert.AreEqual(1, rowList.Count()); - Assert.AreEqual(counter++, rowList[0].Data); - } - } - - [Test] - public void CanAdd2DListToExcelWorksheet() - { - string openPath = Path.Combine(TestDirectory, @"core\excel\NewWorkbook_Add2DListData_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var filePath = Path.Combine(TempFolder, $"{nameof(CanAdd2DListToExcelWorksheet)}_output.xlsx"); - var stringNode = ViewModel.Model.CurrentWorkspace.FirstNodeFromWorkspace(); - stringNode.Value = filePath; - - var node = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - ViewModel.HomeSpace.Run(); - - Assert.IsTrue(node.CachedValue.IsCollection); - var list = node.CachedValue.GetElements().ToList(); - - // 5 X 101 - each row is 0..100 - Assert.AreEqual(5, list.Count()); - - var counter = 0; - for (var i = 0; i < 5; i++) - { - // get data returns 2d array - Assert.IsTrue(list[i].IsCollection); - var rowList = list[i].GetElements(); - Assert.AreEqual(101, rowList.Count()); - rowList.ToList().ForEach(x => Assert.AreEqual(counter++, x.Data)); - counter = 0; - } - } - - [Test] - public void CanWriteToExcelAndUpdateData() - { - string openPath = Path.Combine(TestDirectory, @"core\excel\WriteNodeAndUpdateData_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var filePath = Path.Combine(TempFolder, $"{nameof(CanWriteToExcelAndUpdateData)}_output.xlsx"); - var stringNodes = ViewModel.Model.CurrentWorkspace.Nodes.OfType(); - var filePathNode = stringNodes.Where(n => n.Name == "String").First(); - var dataValueNode = stringNodes.Where(n => n.Name == "Value").First(); - filePathNode.Value = filePath; - - var readNode = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - ViewModel.HomeSpace.Run(); - - Assert.IsTrue(readNode.CachedValue.IsCollection); - var list = readNode.CachedValue.GetElements().ToList(); - - Assert.AreEqual(1, list.Count()); - - // get data returns 2d array - Assert.IsTrue(list[0].IsCollection); - var rowList = list[0].GetElements().ToList(); - Assert.AreEqual(1, rowList.Count()); - Assert.AreEqual("BBB", rowList[0].Data); - - dataValueNode.Value = "AAA"; - ViewModel.HomeSpace.Run(); - - Assert.IsTrue(readNode.CachedValue.IsCollection); - list = readNode.CachedValue.GetElements().ToList(); - - Assert.AreEqual(1, list.Count()); - - // get data returns 2d array - Assert.IsTrue(list[0].IsCollection); - rowList = list[0].GetElements().ToList(); - Assert.AreEqual(1, rowList.Count()); - Assert.AreEqual("AAA", rowList[0].Data); - } - - [Test] - public void CanWriteJaggedArrayToExcel() - { - string openPath = Path.Combine(TestDirectory, @"core\excel\WriteJaggedArrayToExcel_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var filePath = Path.Combine(TempFolder, $"{nameof(CanWriteJaggedArrayToExcel)}_output.xlsx"); - var stringNode = ViewModel.Model.CurrentWorkspace.FirstNodeFromWorkspace(); - stringNode.Value = filePath; - - var readNode = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - ViewModel.HomeSpace.Run(); - - Assert.IsTrue(readNode.CachedValue.IsCollection); - var data = new object[] { new object[] { 1, 1, null }, new object[] { 2, 2, 2 }, new object[] { 3, 3, 3 }, new object[] { null, 4, null } }; - AssertPreviewValue(readNode.GUID.ToString(), data); - } - - [Test] - public void CanWriteEmptyArrayToExcel() - { - string openPath = Path.Combine(TestDirectory, @"core\excel\WriteEmptyArrayToExcel_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var filePath = Path.Combine(TempFolder, $"{nameof(CanWriteEmptyArrayToExcel)}_output.xlsx"); - var stringNode = ViewModel.Model.CurrentWorkspace.FirstNodeFromWorkspace(); - stringNode.Value = filePath; - - var readNode = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - ViewModel.HomeSpace.Run(); - - Assert.IsTrue(readNode.CachedValue.IsCollection); - var data = new object[] { new object[] { 2 }, new object[] { null }, new object[] { 3 } }; - AssertPreviewValue(readNode.GUID.ToString(), data); - } - - [Test] - public void CanWriteNestedEmptyListToExcel() - { - // Copy the file so we don't write over the original - string excelFilePath = Path.Combine(TestDirectory, @"core\excel\emptyCellInMiddle.xlsx"); - var filePath = Path.Combine(TempFolder, $"{nameof(CanWriteNestedEmptyListToExcel)}_output.xlsx"); - File.Copy(excelFilePath, filePath); - - string openPath = Path.Combine(TestDirectory, @"core\excel\WriteNestedEmptyListToExcel_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var stringInput = ViewModel.Model.CurrentWorkspace.FirstNodeFromWorkspace(); - stringInput.Value = filePath; - - var readNode = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - ViewModel.HomeSpace.Run(); - - Assert.IsTrue(readNode.CachedValue.IsCollection); - var data = new object[] { new object[] { 99, 99, 99 }, new object[] { 99, 99, 99 }, new object[] { 99, null, 99 } }; - AssertPreviewValue(readNode.GUID.ToString(), data); - } - - [Test] - public void CanWriteEmptyListToExcel() - { - string openPath = Path.Combine(TestDirectory, @"core\excel\WriteEmptyListToExcel_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var filePath = Path.Combine(TempFolder, $"{nameof(CanWriteEmptyListToExcel)}_output.xlsx"); - var stringNode = ViewModel.Model.CurrentWorkspace.FirstNodeFromWorkspace(); - stringNode.Value = filePath; - - var readNode = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - ViewModel.HomeSpace.Run(); - - Assert.IsTrue(readNode.CachedValue.IsCollection); - var list = readNode.CachedValue.GetElements().ToList(); - Assert.AreEqual(0, list.Count); - } - - [Test] - public void CanOverWriteToExcel() - { - // Copy the file so we don't write over the original - string excelFilePath = Path.Combine(TestDirectory, @"core\excel\overWriteFile.xlsx"); - var filePath = Path.Combine(TempFolder, $"{nameof(CanOverWriteToExcel)}_output.xlsx"); - File.Copy(excelFilePath, filePath); - - string openPath = Path.Combine(TestDirectory, @"core\excel\OverWriteExcelSheet_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var stringInput = ViewModel.Model.CurrentWorkspace.FirstNodeFromWorkspace(); - stringInput.Value = filePath; - - var readNode = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - ViewModel.HomeSpace.Run(); - - Assert.IsTrue(readNode.CachedValue.IsCollection); - var data = new object[] - { - new object[] {999, 999, 999}, - new object[] {999, 999, 999}, - new object[] {999, 999, 999} - }; - AssertPreviewValue(readNode.GUID.ToString(), data); - } - - [Test] - public void CanOverWritePartiallyToExcel() - { - // Copy the file so we don't write over the original - string excelFilePath = Path.Combine(TestDirectory, @"core\excel\overwriteFilePartial.xlsx"); - var filePath = Path.Combine(TempFolder, $"{nameof(CanOverWritePartiallyToExcel)}_output.xlsx"); - File.Copy(excelFilePath, filePath); - - string openPath = Path.Combine(TestDirectory, @"core\excel\OverWritePartialExcelSheet_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var stringInput = ViewModel.Model.CurrentWorkspace.FirstNodeFromWorkspace(); - stringInput.Value = filePath; - - var readNode = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - ViewModel.HomeSpace.Run(); - - Assert.IsTrue(readNode.CachedValue.IsCollection); - var data = new object[] - { - new object[] {1, 1, 1, 1, 1}, - new object[] {1, 999, 999, 999, 1}, - new object[] {1, 999, 999, 999, 1}, - new object[] {1, 999, 999, 999, 1}, - new object[] {1, 1, 1, 1, 1} - }; - AssertPreviewValue(readNode.GUID.ToString(), data); - } - - [Test] - public void CanWriteNullValueToExcel() - { - string openPath = Path.Combine(TestDirectory, @"core\excel\WriteNullValuesToExcel_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var filePath = Path.Combine(TempFolder, $"{nameof(CanWriteNullValueToExcel)}_output.xlsx"); - var stringNode = ViewModel.Model.CurrentWorkspace.FirstNodeFromWorkspace(); - stringNode.Value = filePath; - - var readNode = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - ViewModel.HomeSpace.Run(); - - Assert.IsTrue(readNode.CachedValue.IsCollection); - var list = readNode.CachedValue.GetElements(); - Assert.AreEqual(0, list.Count()); - } - - [Test] - public void CanWriteNullValueInListToExcel() - { - string openPath = Path.Combine(TestDirectory, @"core\excel\WriteNullValuesToExcel1_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var filePath = Path.Combine(TempFolder, $"{nameof(CanWriteNullValueInListToExcel)}_output.xlsx"); - var stringNode = ViewModel.Model.CurrentWorkspace.FirstNodeFromWorkspace(); - stringNode.Value = filePath; - - var readNode = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - ViewModel.HomeSpace.Run(); - - Assert.IsTrue(readNode.CachedValue.IsCollection); - var data = new object[] { new object[] { 2 }, new object[] { null }, new object[] { 3 } }; - AssertPreviewValue(readNode.GUID.ToString(), data); - } - - [Test] - public void TestWriteFunctionObjectToExcel() - { - string openPath = Path.Combine(TestDirectory, @"core\excel\WriteFunctionObject_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var filePath = Path.Combine(TempFolder, $"{nameof(TestWriteFunctionObjectToExcel)}_output.xlsx"); - var stringNode = ViewModel.Model.CurrentWorkspace.FirstNodeFromWorkspace(); - stringNode.Value = filePath; - - var readNode = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - ViewModel.HomeSpace.Run(); - - ProtoCore.RuntimeCore runtimeCore = ViewModel.Model.EngineController.LiveRunnerRuntimeCore; - Assert.AreEqual(1, runtimeCore.RuntimeStatus.WarningCount); - - ProtoCore.Runtime.WarningEntry warningEntry = runtimeCore.RuntimeStatus.Warnings.ElementAt(0); - Assert.AreEqual(ProtoCore.Runtime.WarningID.Default, warningEntry.ID); - - Assert.IsTrue(readNode.CachedValue.IsCollection); - var list = readNode.CachedValue.GetElements().ToList(); - Assert.AreEqual(0, list.Count); - } - - [Test] - public void WriteNonExistingSheet() - { - // Copy the file so we don't write over the original - string excelFilePath = Path.Combine(TestDirectory, @"core\excel\NonExistingsheet.xlsx"); - var filePath = Path.Combine(TempFolder, $"{nameof(WriteNonExistingSheet)}_output.xlsx"); - File.Copy(excelFilePath, filePath); - - string openPath = Path.Combine(TestDirectory, @"core\excel\WriteNonExistingSheet_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var stringNode = ViewModel.Model.CurrentWorkspace.FirstNodeFromWorkspace(); - stringNode.Value = filePath; - - var readNode = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - ViewModel.HomeSpace.Run(); - - Assert.IsTrue(readNode.CachedValue.IsCollection); - var data = new object[] { new object[] { 1 }, new object[] { 2 }, new object[] { 3 }, new object[] { 4 }, new object[] { 5 } }; - AssertPreviewValue(readNode.GUID.ToString(), data); - } - - [Test] - public void CanExportToExcelAsString() - { - string openPath = Path.Combine(TestDirectory, @"core\excel\ExportToExcelAsString_OpenXml.dyn"); - ViewModel.OpenCommand.Execute(openPath); - - var filePath = Path.Combine(TempFolder, $"{nameof(CanExportToExcelAsString)}_output.xlsx"); - var stringInput = ViewModel.Model.CurrentWorkspace.FirstNodeFromWorkspace(); - stringInput.Value = filePath; - - var readNode = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Data.OpenXMLImportExcel"); - var typeNode = ViewModel.Model.CurrentWorkspace.Nodes.First(n => n.Name == "Object.Type"); - ViewModel.HomeSpace.Run(); - - Assert.IsTrue(readNode.CachedValue.IsCollection); - var data = new object[] { new object[] { "1.23" }, new object[] { "True" }, new object[] { "04/08/2021 10:14:00" }, new object[] { "Hello" } }; - AssertPreviewValue(readNode.GUID.ToString(), data); - - Assert.IsTrue(typeNode.CachedValue.IsCollection); - var stringType = new object[] { "System.String" }; - var types = new object[] { stringType, stringType, stringType, stringType }; - AssertPreviewValue(typeNode.GUID.ToString(), types); - } - - #endregion - - - } -#endif } - - diff --git a/test/Libraries/DynamoMSOfficeTests/Properties/AssemblyInfo.cs b/test/Libraries/DynamoMSOfficeTests/Properties/AssemblyInfo.cs index d0aa8b8f50a..f75cb5af44d 100644 --- a/test/Libraries/DynamoMSOfficeTests/Properties/AssemblyInfo.cs +++ b/test/Libraries/DynamoMSOfficeTests/Properties/AssemblyInfo.cs @@ -1,5 +1,7 @@ -using System.Reflection; +using NUnit.Framework; +using System.Reflection; using System.Runtime.InteropServices; +using System.Threading; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information @@ -7,4 +9,5 @@ [assembly: AssemblyTitle("DynamoMSOfficeTests")] [assembly: AssemblyCulture("")] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("45c011cc-53f5-477e-b6b0-ff4e494f6674")] \ No newline at end of file +[assembly: Guid("45c011cc-53f5-477e-b6b0-ff4e494f6674")] +[assembly: Apartment(ApartmentState.STA)] diff --git a/test/Libraries/DynamoMSOfficeTests/Setup.cs b/test/Libraries/DynamoMSOfficeTests/Setup.cs index e2bd9610da4..2cb048a2dc5 100644 --- a/test/Libraries/DynamoMSOfficeTests/Setup.cs +++ b/test/Libraries/DynamoMSOfficeTests/Setup.cs @@ -11,11 +11,7 @@ public class Setup { private AssemblyHelper assemblyHelper; -#if NETFRAMEWORK - [SetUp] -#elif NET6_0_OR_GREATER [OneTimeSetUp] -#endif public void RunBeforeAllTests() { var assemblyPath = Assembly.GetExecutingAssembly().Location; @@ -33,11 +29,7 @@ public void RunBeforeAllTests() DSOffice.ExcelInterop.ShowOnStartup = false; } -#if NETFRAMEWORK - [TearDown] -#elif NET6_0_OR_GREATER [OneTimeTearDown] -#endif public void RunAfterAllTests() { AppDomain.CurrentDomain.AssemblyResolve -= assemblyHelper.ResolveAssembly; diff --git a/test/Libraries/DynamoUtilitiesTests/Setup.cs b/test/Libraries/DynamoUtilitiesTests/Setup.cs index 22276870cc1..1d56d671c3d 100644 --- a/test/Libraries/DynamoUtilitiesTests/Setup.cs +++ b/test/Libraries/DynamoUtilitiesTests/Setup.cs @@ -9,11 +9,7 @@ public class Setup { private AssemblyHelper assemblyHelper; -#if NETFRAMEWORK - [SetUp] -#elif NET6_0_OR_GREATER - [OneTimeSetUp] -#endif + [OneTimeSetUp] public void RunBeforeAllTests() { var assemblyPath = Assembly.GetExecutingAssembly().Location; @@ -30,11 +26,7 @@ public void RunBeforeAllTests() AppDomain.CurrentDomain.AssemblyResolve += assemblyHelper.ResolveAssembly; } -#if NETFRAMEWORK - [TearDown] -#elif NET6_0_OR_GREATER - [OneTimeTearDown] -#endif + [OneTimeTearDown] public void RunAfterAllTests() { AppDomain.CurrentDomain.AssemblyResolve -= assemblyHelper.ResolveAssembly; diff --git a/test/Libraries/NodeServicesTest/WorkspaceEventTests.cs b/test/Libraries/NodeServicesTest/WorkspaceEventTests.cs index 3997186f67e..dd474f5152d 100644 --- a/test/Libraries/NodeServicesTest/WorkspaceEventTests.cs +++ b/test/Libraries/NodeServicesTest/WorkspaceEventTests.cs @@ -8,11 +8,7 @@ namespace DynamoServicesTests { -#if NET6_0_OR_GREATER [TestFixture, Apartment(ApartmentState.MTA)] -#else - [TestFixture, RequiresSTA] -#endif class WorkspaceEventTests : SystemTestBase { protected override void SetupCore() diff --git a/test/Libraries/PackageManagerTests/Setup.cs b/test/Libraries/PackageManagerTests/Setup.cs index 30367acf666..ed8655491ad 100644 --- a/test/Libraries/PackageManagerTests/Setup.cs +++ b/test/Libraries/PackageManagerTests/Setup.cs @@ -9,11 +9,7 @@ public class Setup { private AssemblyHelper assemblyHelper; -#if NETFRAMEWORK - [SetUp] -#elif NET6_0_OR_GREATER [OneTimeSetUp] -#endif public void RunBeforeAllTests() { var assemblyPath = Assembly.GetExecutingAssembly().Location; @@ -30,11 +26,7 @@ public void RunBeforeAllTests() AppDomain.CurrentDomain.AssemblyResolve += assemblyHelper.ResolveAssembly; } -#if NETFRAMEWORK - [TearDown] -#elif NET6_0_OR_GREATER [OneTimeTearDown] -#endif public void RunAfterAllTests() { AppDomain.CurrentDomain.AssemblyResolve -= assemblyHelper.ResolveAssembly; diff --git a/test/Libraries/SystemTestServices/SystemTestBase.cs b/test/Libraries/SystemTestServices/SystemTestBase.cs index d2801217516..9d7a3be1dea 100644 --- a/test/Libraries/SystemTestServices/SystemTestBase.cs +++ b/test/Libraries/SystemTestServices/SystemTestBase.cs @@ -141,11 +141,7 @@ public virtual void TearDown() } } -#if NET6_0_OR_GREATER [OneTimeTearDown] -#elif NETFRAMEWORK - [TestFixtureTearDown] -#endif public virtual void FinalTearDown() { // Fix for COM exception on close diff --git a/test/Libraries/WorkflowTests/Setup.cs b/test/Libraries/WorkflowTests/Setup.cs index b37376ff841..bd54b2e670b 100644 --- a/test/Libraries/WorkflowTests/Setup.cs +++ b/test/Libraries/WorkflowTests/Setup.cs @@ -11,11 +11,7 @@ public class Setup { private AssemblyHelper assemblyHelper; -#if NETFRAMEWORK - [SetUp] -#elif NET6_0_OR_GREATER [OneTimeSetUp] -#endif public void RunBeforeAllTests() { var assemblyPath = Assembly.GetExecutingAssembly().Location; @@ -31,11 +27,7 @@ public void RunBeforeAllTests() AppDomain.CurrentDomain.AssemblyResolve += assemblyHelper.ResolveAssembly; } -#if NETFRAMEWORK - [TearDown] -#elif NET6_0_OR_GREATER [OneTimeTearDown] -#endif public void RunAfterAllTests() { AppDomain.CurrentDomain.AssemblyResolve -= assemblyHelper.ResolveAssembly; diff --git a/test/Tools/NodeDocumentationMarkdownGeneratorTests/MarkdownGeneratorCommandTests.cs b/test/Tools/NodeDocumentationMarkdownGeneratorTests/MarkdownGeneratorCommandTests.cs index 279330d34f4..224ccc97630 100644 --- a/test/Tools/NodeDocumentationMarkdownGeneratorTests/MarkdownGeneratorCommandTests.cs +++ b/test/Tools/NodeDocumentationMarkdownGeneratorTests/MarkdownGeneratorCommandTests.cs @@ -45,11 +45,7 @@ public class MarkdownGeneratorCommandTests private DirectoryInfo tempDirectory = null; -#if NET6_0_OR_GREATER [OneTimeSetUp] -#elif NETFRAMEWORK - [TestFixtureSetUp] -#endif public void FixtureSetup() { try @@ -64,11 +60,8 @@ public void FixtureSetup() Console.WriteLine(e.StackTrace); } } -#if NET6_0_OR_GREATER + [OneTimeTearDown] -#elif NETFRAMEWORK - [TestFixtureTearDown] -#endif public void FixtureTearDown() { AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve; diff --git a/test/VisualizationTests/Setups.cs b/test/VisualizationTests/Setups.cs index 22276870cc1..1d56d671c3d 100644 --- a/test/VisualizationTests/Setups.cs +++ b/test/VisualizationTests/Setups.cs @@ -9,11 +9,7 @@ public class Setup { private AssemblyHelper assemblyHelper; -#if NETFRAMEWORK - [SetUp] -#elif NET6_0_OR_GREATER - [OneTimeSetUp] -#endif + [OneTimeSetUp] public void RunBeforeAllTests() { var assemblyPath = Assembly.GetExecutingAssembly().Location; @@ -30,11 +26,7 @@ public void RunBeforeAllTests() AppDomain.CurrentDomain.AssemblyResolve += assemblyHelper.ResolveAssembly; } -#if NETFRAMEWORK - [TearDown] -#elif NET6_0_OR_GREATER - [OneTimeTearDown] -#endif + [OneTimeTearDown] public void RunAfterAllTests() { AppDomain.CurrentDomain.AssemblyResolve -= assemblyHelper.ResolveAssembly;