35 lines
No EOL
1 KiB
C#
35 lines
No EOL
1 KiB
C#
using NUnit.Framework;
|
|
|
|
namespace JD.Serialization
|
|
{
|
|
[TestFixture]
|
|
public class ObjectPathTests
|
|
{
|
|
[Test]
|
|
public void Test_path_is_parsed_on_construction()
|
|
{
|
|
var path = new ObjectPath("..|Scene|Actor");
|
|
|
|
Assert.AreEqual(2, path.Levels.Count);
|
|
Assert.AreEqual(1, path.Levels[0].Parent);
|
|
Assert.AreEqual("", path.Levels[0].Name);
|
|
Assert.AreEqual(0, path.Levels[1].Parent);
|
|
Assert.AreEqual("Scene", path.Levels[1].Name);
|
|
|
|
Assert.AreEqual("Actor", path.Id);
|
|
Assert.AreEqual("..|Scene|Actor", path.ToString());
|
|
}
|
|
|
|
[Test]
|
|
public void Test_path_is_parsed_on_path_assignation()
|
|
{
|
|
var path = new ObjectPath();
|
|
path.Path = "Scene|ActorA";
|
|
path.Path = "Scene|ActorB";
|
|
|
|
Assert.AreEqual("ActorB", path.Id);
|
|
Assert.AreEqual(1, path.Levels.Count);
|
|
Assert.AreEqual("Scene", path.Levels[0].Name);
|
|
}
|
|
}
|
|
} |