48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
using NavisworksTransport.Utils.CoordinateSystem;
|
|
|
|
namespace NavisworksTransport.UnitTests.CoordinateSystem
|
|
{
|
|
[TestClass]
|
|
public class FragmentDefaultUpContextTests
|
|
{
|
|
[TestInitialize]
|
|
public void SetUp()
|
|
{
|
|
FragmentDefaultUpContext.ResetForTests();
|
|
}
|
|
|
|
[TestMethod]
|
|
public void GetOrCreateDocumentKey_ReusesFirstStableKey_WhenDocumentMetadataTemporarilyChanges()
|
|
{
|
|
const int runtimeDocumentId = 42;
|
|
|
|
string initialKey = FragmentDefaultUpContext.GetOrCreateDocumentKey(
|
|
runtimeDocumentId,
|
|
@"C:\models\floor2.nwd",
|
|
"Floor2");
|
|
|
|
string transientKey = FragmentDefaultUpContext.GetOrCreateDocumentKey(
|
|
runtimeDocumentId,
|
|
string.Empty,
|
|
"无标题");
|
|
|
|
Assert.AreEqual(initialKey, transientKey);
|
|
Assert.AreEqual("file:C:\\models\\floor2.nwd", transientKey);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void GetOrCreateDocumentKey_UsesRuntimeScopedFallback_WhenFileNameIsUnavailable()
|
|
{
|
|
const int runtimeDocumentId = 7;
|
|
|
|
string key = FragmentDefaultUpContext.GetOrCreateDocumentKey(
|
|
runtimeDocumentId,
|
|
string.Empty,
|
|
"无标题");
|
|
|
|
Assert.AreEqual("runtime:7|title:无标题", key);
|
|
}
|
|
}
|
|
}
|