diff --git a/CHANGELOG.md b/CHANGELOG.md
index 56a24c8..f833d11 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,17 @@ 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.3.3] / 2024-05-22
+### Fixed
+- Fix `TestCase` with the same Guid using `GuidFromString`. (Fix: #43)
+- Fix `TestCase` with `.` in the name. (Fix: #44)
+### TestAdapter
+- Add `GuidFromString` in the `TestCaseUtils`.
+- Update `SplitTestName` to check `(` and `"`.
+- Update Application for `LocalFileExists`.
+### Tests
+- Add `TestDoubleCase` with double with `.` in the name.
+
## [1.3.2] / 2024-05-09
### Fixed
- Fix `ApplicationUtils` to clear temp folder after some minutes. (Fix: #41)
@@ -409,6 +420,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- [x] TestsFail
[vNext]: ../../compare/1.0.0...HEAD
+[1.3.3]: ../../compare/1.3.2...1.3.3
[1.3.2]: ../../compare/1.3.1...1.3.2
[1.3.1]: ../../compare/1.3.0...1.3.1
[1.3.0]: ../../compare/1.2.1...1.3.0
diff --git a/Directory.Build.props b/Directory.Build.props
index 0b29074..8cbf018 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -1,5 +1,5 @@
- 1.3.2
+ 1.3.3
\ No newline at end of file
diff --git a/ricaun.RevitTest.Console/Resources/ricaun.RevitTest.Application.bundle.zip b/ricaun.RevitTest.Console/Resources/ricaun.RevitTest.Application.bundle.zip
index 741d2b9..ea6d687 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.TestAdapter/Resources/net48/ricaun.RevitTest.Console.zip b/ricaun.RevitTest.TestAdapter/Resources/net48/ricaun.RevitTest.Console.zip
index a32f0c8..607c4c8 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 a36c56b..9c62f2e 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 5cfc6ef..2bb7e0e 100644
--- a/ricaun.RevitTest.TestAdapter/Services/ApplicationUtils.cs
+++ b/ricaun.RevitTest.TestAdapter/Services/ApplicationUtils.cs
@@ -104,10 +104,11 @@ public static async Task DownloadAsync(string applicationFolder, string ad
System.Net.ServicePointManager.SecurityProtocol |= System.Net.SecurityProtocolType.Tls12;
try
{
- if (File.Exists(address))
+ if (LocalFileExists(address, out string localFilePath))
{
- File.Copy(address, zipPath, true);
- AdapterLogger.Logger.DebugOnlyLocal($"Download File Exists: {address}");
+ File.Copy(localFilePath, zipPath, true);
+ AdapterLogger.Logger.DebugOnlyLocal($"Download File CurrentDirectory: {Directory.GetCurrentDirectory()}");
+ AdapterLogger.Logger.DebugOnlyLocal($"Download File Exists: {localFilePath}");
}
else
{
@@ -135,6 +136,24 @@ public static async Task DownloadAsync(string applicationFolder, string ad
return result;
}
+ private static bool LocalFileExists(string filePath, out string localFilePath)
+ {
+ localFilePath = filePath;
+ if (File.Exists(localFilePath)) return true;
+ try
+ {
+ var assemblyDirectory = Path.GetDirectoryName(typeof(ApplicationUtils).Assembly.Location);
+ localFilePath = Path.Combine(assemblyDirectory, filePath);
+ if (File.Exists(localFilePath))
+ {
+ AdapterLogger.Logger.DebugOnlyLocal($"Download File AssemblyDirectory: {assemblyDirectory}");
+ return true;
+ }
+ }
+ catch { }
+ return false;
+ }
+
///
/// Download and unzip Application Async
///
diff --git a/ricaun.RevitTest.TestAdapter/TestCaseUtils.cs b/ricaun.RevitTest.TestAdapter/TestCaseUtils.cs
index 00020a7..607d9ce 100644
--- a/ricaun.RevitTest.TestAdapter/TestCaseUtils.cs
+++ b/ricaun.RevitTest.TestAdapter/TestCaseUtils.cs
@@ -1,4 +1,5 @@
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
+using System.Linq;
namespace ricaun.RevitTest.TestAdapter
{
@@ -26,32 +27,53 @@ public static TestCase Create(string source, string testName)
var testCase = new TestCase(fullyQualifiedName, TestAdapter.ExecutorUri, source)
{
DisplayName = displayName,
+ Id = GuidFromString(testName),
};
return testCase;
}
+ ///
+ /// GuidFromString using EqtHash
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// Reference:
+ /// https://github.com/microsoft/vstest/blob/main/src/Microsoft.TestPlatform.ObjectModel/TestCase.cs#L173
+ /// https://github.com/microsoft/vstest/blob/main/src/Microsoft.TestPlatform.ObjectModel/Utilities/EqtHash.cs#L20
+ ///
+ ///
+ private static System.Guid GuidFromString(string testName)
+ {
+ return Microsoft.VisualStudio.TestPlatform.ObjectModel.Utilities.EqtHash.GuidFromString(testName);
+ }
+
#region private
private static void SplitTestName(string testName, out string fullyQualifiedName, out string displayName)
{
- var indexOf = LastIndexOfDisplayName(testName);
- fullyQualifiedName = testName.Substring(0, indexOf);
- displayName = testName.Substring(indexOf + 1);
+ var splitDots = testName.Split('.');
+
+ var index = LastIndexSplitOfDisplayName(splitDots);
+
+ fullyQualifiedName = string.Join(".", splitDots.Take(index));
+ displayName = string.Join(".", splitDots.Skip(index));
+
+ AdapterLogger.Logger.DebugOnlyLocal($"SplitTestName: {testName} - {index} {fullyQualifiedName} {displayName}");
}
- private static int LastIndexOfDisplayName(string testName)
+ private static int LastIndexSplitOfDisplayName(string[] splitDots)
{
- var lastIndexOfDot = testName.LastIndexOf('.');
- var indexOf = testName.IndexOf('"');
- if (indexOf != -1)
+ for (int i = 0; i < splitDots.Length; i++)
{
- lastIndexOfDot = testName.LastIndexOf('.', indexOf);
+ var name = splitDots[i];
+ if (name.Contains('(') | name.Contains('"'))
+ return i;
}
-
- return lastIndexOfDot;
+ return splitDots.Length - 1;
}
-
#endregion
}
}
\ No newline at end of file
diff --git a/ricaun.RevitTest.Tests/TestsCase.cs b/ricaun.RevitTest.Tests/TestsCase.cs
index 9615736..fca7360 100644
--- a/ricaun.RevitTest.Tests/TestsCase.cs
+++ b/ricaun.RevitTest.Tests/TestsCase.cs
@@ -36,5 +36,16 @@ public void TestStringCase_IsNot(string value)
Console.WriteLine(value);
Assert.IsFalse(string.IsNullOrWhiteSpace(value));
}
+
+ [TestCase(1.0)]
+ [TestCase(2.0)]
+ [TestCase(3.0)]
+ [TestCase(4.2)]
+ [TestCase(5.3)]
+ [TestCase(6.4)]
+ public void TestDoubleCase(double scale)
+ {
+ Assert.NotZero(scale);
+ }
}
}
diff --git a/ricaun.RevitTest.Tests/TestsDebugger.cs b/ricaun.RevitTest.Tests/TestsDebugger.cs
index 3ee5ec5..43c6d38 100644
--- a/ricaun.RevitTest.Tests/TestsDebugger.cs
+++ b/ricaun.RevitTest.Tests/TestsDebugger.cs
@@ -14,11 +14,13 @@
[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")]
-[assembly: AssemblyMetadata("NUnit.Application", "D:\\Users\\ricau\\source\\repos\\ricaun.RevitTest\\ricaun.RevitTest.Console\\bin\\Debug\\ricaun.RevitTest.Console.exe")]
-//[assembly: AssemblyMetadata("NUnit.Language", "ENU /hosted")]
+#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", "C:\\Users\\ricau\\Downloads\\SampleTest\\ricaun.DA4R.NUnit.Console.zip")]
-//[assembly: AssemblyMetadata("NUnit.Application", "..\\..\\..\\ricaun.RevitTest.Console\\bin\\Debug\\ricaun.RevitTest.Console.exe")]
+//[assembly: AssemblyMetadata("NUnit.Language", "ENU /hosted")]
#endif
namespace ricaun.RevitTest.Tests