diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml
index f1b21de..47fac2e 100644
--- a/.github/workflows/blank.yml
+++ b/.github/workflows/blank.yml
@@ -4,13 +4,13 @@ on: [push, pull_request]
jobs:
build:
- runs-on: windows-2019
+ runs-on: windows-2025
steps:
- uses: actions/checkout@v1
- name: Setup .NetCore
uses: actions/setup-dotnet@v1
with:
- dotnet-version: 8.0.100
+ dotnet-version: 10.0.100
- name: Build with dotnet
run: |
dotnet build -c Release
diff --git a/README.md b/README.md
index 7ffe208..4d13578 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@ operating XTMF2.
### Requirements
-1. DotNet Core 6.0+ SDK
+1. DotNet Core 10.0+ SDK
### Clone the XTMF2 repository
diff --git a/src/XTMF2.Client/XTMF2.RunServer.csproj b/src/XTMF2.Client/XTMF2.RunServer.csproj
index 3225764..fe96c57 100644
--- a/src/XTMF2.Client/XTMF2.RunServer.csproj
+++ b/src/XTMF2.Client/XTMF2.RunServer.csproj
@@ -2,7 +2,7 @@
Exe
- net8.0
+ net10.0
XTMF2.RunServer
exe
@@ -11,7 +11,6 @@
-
PreserveNewest
diff --git a/src/XTMF2.Interfaces/XTMF2.Interfaces.csproj b/src/XTMF2.Interfaces/XTMF2.Interfaces.csproj
index 3a032f7..6bd0260 100644
--- a/src/XTMF2.Interfaces/XTMF2.Interfaces.csproj
+++ b/src/XTMF2.Interfaces/XTMF2.Interfaces.csproj
@@ -1,7 +1,7 @@
- net8.0
+ net10.0
XTMF2
enable
diff --git a/src/XTMF2.Run/XTMF2.Run.csproj b/src/XTMF2.Run/XTMF2.Run.csproj
index 946a5b4..ca3d18a 100644
--- a/src/XTMF2.Run/XTMF2.Run.csproj
+++ b/src/XTMF2.Run/XTMF2.Run.csproj
@@ -2,7 +2,7 @@
Exe
- net8.0
+ net10.0
enable
diff --git a/src/XTMF2/XTMF2.csproj b/src/XTMF2/XTMF2.csproj
index f1e088f..7dca667 100644
--- a/src/XTMF2/XTMF2.csproj
+++ b/src/XTMF2/XTMF2.csproj
@@ -1,7 +1,7 @@
- net8.0
+ net10.0
true
https://github.com/TravelModellingGroup/XTMF2.git
@@ -12,12 +12,6 @@
enable
-
-
-
-
-
-
diff --git a/tests/XTMF2.UnitTests/Editing/TestBoundaries.cs b/tests/XTMF2.UnitTests/Editing/TestBoundaries.cs
index 150b99a..028fce0 100644
--- a/tests/XTMF2.UnitTests/Editing/TestBoundaries.cs
+++ b/tests/XTMF2.UnitTests/Editing/TestBoundaries.cs
@@ -33,14 +33,14 @@ public void AddBoundary()
{
var ms = mSession.ModelSystem;
CommandError error = null;
- Assert.AreEqual(0, ms.GlobalBoundary.Boundaries.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Boundaries);
Assert.IsTrue(mSession.AddBoundary(user, ms.GlobalBoundary, "UniqueName", out Boundary subB, out error), error?.Message);
Assert.IsFalse(mSession.AddBoundary(user, ms.GlobalBoundary, "UniqueName", out Boundary fail1, out error), "Created a second boundary with the same name!");
- Assert.AreEqual(1, ms.GlobalBoundary.Boundaries.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Boundaries);
Assert.IsTrue(mSession.Undo(user, out error), error?.Message);
- Assert.AreEqual(0, ms.GlobalBoundary.Boundaries.Count);
+ Assert.HasCount(0, ms.GlobalBoundary.Boundaries);
Assert.IsTrue(mSession.Redo(user, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Boundaries.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Boundaries);
Assert.AreSame(subB, ms.GlobalBoundary.Boundaries[0]);
Assert.IsFalse(mSession.AddBoundary(user, ms.GlobalBoundary, "UniqueName", out Boundary fail2, out error), "Created a second boundary with the same name after redo!");
});
@@ -52,7 +52,7 @@ public void AddBoundaryWithBadUser()
TestHelper.RunInModelSystemContext("AddBoundaryWithBadUser", (user, unauthorizedUser, pSession, mSession) =>
{
var ms = mSession.ModelSystem;
- Assert.AreEqual(0, ms.GlobalBoundary.Boundaries.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Boundaries);
Assert.IsFalse(mSession.AddBoundary(unauthorizedUser, ms.GlobalBoundary, "UniqueName", out Boundary subB, out var error), error?.Message);
});
}
@@ -63,8 +63,8 @@ public void AddBoundaryNullParent()
TestHelper.RunInModelSystemContext("AddBoundaryNullParent", (user, pSession, mSession) =>
{
var ms = mSession.ModelSystem;
- Assert.AreEqual(0, ms.GlobalBoundary.Boundaries.Count);
- Assert.ThrowsException(() =>
+ Assert.IsEmpty(ms.GlobalBoundary.Boundaries);
+ Assert.Throws(() =>
{
mSession.AddBoundary(user, null, "UniqueName", out Boundary subB, out var error);
});
@@ -77,8 +77,8 @@ public void AddBoundaryNulUser()
TestHelper.RunInModelSystemContext("AddBoundaryNullUser", (user, pSession, mSession) =>
{
var ms = mSession.ModelSystem;
- Assert.AreEqual(0, ms.GlobalBoundary.Boundaries.Count);
- Assert.ThrowsException(() =>
+ Assert.IsEmpty(ms.GlobalBoundary.Boundaries);
+ Assert.Throws(() =>
{
mSession.AddBoundary(null, ms.GlobalBoundary, "UniqueName", out Boundary subB, out var error);
});
@@ -91,25 +91,25 @@ public void RemoveBoundary()
TestHelper.RunInModelSystemContext("RemoveBoundary", (user, pSession, mSession) =>
{
var ms = mSession.ModelSystem;
- Assert.AreEqual(0, ms.GlobalBoundary.Boundaries.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Boundaries);
Assert.IsTrue(mSession.AddBoundary(user, ms.GlobalBoundary, "UniqueName", out Boundary subB, out var error), error?.Message);
Assert.IsFalse(mSession.AddBoundary(user, ms.GlobalBoundary, "UniqueName", out Boundary fail1, out error), "Created a second boundary with the same name!");
- Assert.AreEqual(1, ms.GlobalBoundary.Boundaries.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Boundaries);
Assert.IsTrue(mSession.Undo(user, out error), error?.Message);
- Assert.AreEqual(0, ms.GlobalBoundary.Boundaries.Count);
+ Assert.HasCount(0, ms.GlobalBoundary.Boundaries);
Assert.IsTrue(mSession.Redo(user, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Boundaries.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Boundaries);
Assert.AreSame(subB, ms.GlobalBoundary.Boundaries[0]);
Assert.IsFalse(mSession.AddBoundary(user, ms.GlobalBoundary, "UniqueName", out Boundary fail2, out error), "Created a second boundary with the same name after redo!");
// Now test removing the boundary explicitly
Assert.IsTrue(mSession.RemoveBoundary(user, ms.GlobalBoundary, subB, out error), error?.Message);
- Assert.AreEqual(0, ms.GlobalBoundary.Boundaries.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Boundaries);
Assert.IsTrue(mSession.Undo(user, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Boundaries.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Boundaries);
Assert.AreSame(subB, ms.GlobalBoundary.Boundaries[0]);
Assert.IsTrue(mSession.Redo(user, out error), error?.Message);
- Assert.AreEqual(0, ms.GlobalBoundary.Boundaries.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Boundaries);
});
}
@@ -120,21 +120,21 @@ public void RemoveBoundaryWithBadUser()
{
var ms = mSession.ModelSystem;
CommandError error = null;
- Assert.AreEqual(0, ms.GlobalBoundary.Boundaries.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Boundaries);
Assert.IsTrue(mSession.AddBoundary(user, ms.GlobalBoundary, "UniqueName", out Boundary subB, out error), error?.Message);
Assert.IsFalse(mSession.AddBoundary(user, ms.GlobalBoundary, "UniqueName", out Boundary fail1, out error), "Created a second boundary with the same name!");
- Assert.AreEqual(1, ms.GlobalBoundary.Boundaries.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Boundaries);
Assert.IsTrue(mSession.Undo(user, out error), error?.Message);
- Assert.AreEqual(0, ms.GlobalBoundary.Boundaries.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Boundaries);
Assert.IsTrue(mSession.Redo(user, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Boundaries.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Boundaries);
Assert.AreSame(subB, ms.GlobalBoundary.Boundaries[0]);
Assert.IsFalse(mSession.AddBoundary(user, ms.GlobalBoundary, "UniqueName", out Boundary fail2, out error), "Created a second boundary with the same name after redo!");
// Now test removing the boundary explicitly
- Assert.AreEqual(1, ms.GlobalBoundary.Boundaries.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Boundaries);
Assert.IsFalse(mSession.RemoveBoundary(unauthorizedUser, ms.GlobalBoundary, subB, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Boundaries.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Boundaries);
});
}
@@ -144,12 +144,12 @@ public void RemoveBoundaryNullBoundary()
TestHelper.RunInModelSystemContext("RemoveBoundary", (user, pSession, mSession) =>
{
var ms = mSession.ModelSystem;
- Assert.AreEqual(0, ms.GlobalBoundary.Boundaries.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Boundaries);
Assert.IsTrue(mSession.AddBoundary(user, ms.GlobalBoundary, "UniqueName", out Boundary subB, out var error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Boundaries.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Boundaries);
// Now test removing the boundary explicitly
- Assert.ThrowsException(() =>
+ Assert.Throws(() =>
{
mSession.RemoveBoundary(user, ms.GlobalBoundary, null, out error);
});
@@ -162,12 +162,12 @@ public void RemoveBoundaryNullParent()
TestHelper.RunInModelSystemContext("RemoveBoundary", (user, pSession, mSession) =>
{
var ms = mSession.ModelSystem;
- Assert.AreEqual(0, ms.GlobalBoundary.Boundaries.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Boundaries);
Assert.IsTrue(mSession.AddBoundary(user, ms.GlobalBoundary, "UniqueName", out Boundary subB, out var error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Boundaries.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Boundaries);
// Now test removing the boundary explicitly
- Assert.ThrowsException(() =>
+ Assert.Throws(() =>
{
mSession.RemoveBoundary(user, null, subB, out error);
});
@@ -181,12 +181,12 @@ public void RemoveBoundaryNullUser()
{
var ms = mSession.ModelSystem;
CommandError error = null;
- Assert.AreEqual(0, ms.GlobalBoundary.Boundaries.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Boundaries);
Assert.IsTrue(mSession.AddBoundary(user, ms.GlobalBoundary, "UniqueName", out Boundary subB, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Boundaries.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Boundaries);
// Now test removing the boundary explicitly
- Assert.ThrowsException(() =>
+ Assert.Throws(() =>
{
mSession.RemoveBoundary(null, ms.GlobalBoundary, subB, out error);
});
@@ -200,12 +200,12 @@ public void RemoveBoundaryNotInBoundary()
{
var ms = mSession.ModelSystem;
CommandError error = null;
- Assert.AreEqual(0, ms.GlobalBoundary.Boundaries.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Boundaries);
Assert.IsTrue(mSession.AddBoundary(user, ms.GlobalBoundary, "SubB", out Boundary subB, out error), error?.Message);
Assert.IsTrue(mSession.AddBoundary(user, ms.GlobalBoundary, "SubC", out Boundary subC, out error), error?.Message);
Assert.IsTrue(mSession.AddBoundary(user, subC, "SubCA", out Boundary subCA, out error), error?.Message);
- Assert.AreEqual(2, ms.GlobalBoundary.Boundaries.Count);
- Assert.AreEqual(1, subC.Boundaries.Count);
+ Assert.HasCount(2, ms.GlobalBoundary.Boundaries);
+ Assert.HasCount(1, subC.Boundaries);
Assert.IsFalse(mSession.RemoveBoundary(user, ms.GlobalBoundary, subCA, out error), "Successfully removed a boundary from a grandparent isntead of failing!");
});
diff --git a/tests/XTMF2.UnitTests/Editing/TestCommentBlock.cs b/tests/XTMF2.UnitTests/Editing/TestCommentBlock.cs
index 156738c..9bc8f75 100644
--- a/tests/XTMF2.UnitTests/Editing/TestCommentBlock.cs
+++ b/tests/XTMF2.UnitTests/Editing/TestCommentBlock.cs
@@ -36,9 +36,9 @@ public void TestCreatingCommentBlock()
var comment = "My Comment";
var location = new Rectangle(100, 100);
var comBlocks = ms.GlobalBoundary.CommentBlocks;
- Assert.AreEqual(0, comBlocks.Count);
+ Assert.IsEmpty(comBlocks);
Assert.IsTrue(mSession.AddCommentBlock(user, ms.GlobalBoundary, comment, location, out CommentBlock block, out error), error?.Message);
- Assert.AreEqual(1, comBlocks.Count);
+ Assert.HasCount(1, comBlocks);
Assert.AreEqual(comment, comBlocks[0].Comment);
Assert.AreEqual(location, comBlocks[0].Location);
});
@@ -54,9 +54,9 @@ public void TestCreatingCommentBlockWithBadUser()
var comment = "My Comment";
var location = new Rectangle(100, 100);
var comBlocks = ms.GlobalBoundary.CommentBlocks;
- Assert.AreEqual(0, comBlocks.Count);
+ Assert.IsEmpty(comBlocks);
Assert.IsFalse(mSession.AddCommentBlock(unauthorizedUser, ms.GlobalBoundary, comment, location, out CommentBlock block, out error), error?.Message);
- Assert.AreEqual(0, comBlocks.Count);
+ Assert.IsEmpty(comBlocks);
});
}
@@ -70,9 +70,9 @@ public void TestCommentBlockPersistence()
CommandError error = null;
var ms = msSession.ModelSystem;
var comBlocks = ms.GlobalBoundary.CommentBlocks;
- Assert.AreEqual(0, comBlocks.Count);
+ Assert.IsEmpty(comBlocks);
Assert.IsTrue(msSession.AddCommentBlock(user, ms.GlobalBoundary, comment, location, out CommentBlock block, out error), error?.Message);
- Assert.AreEqual(1, comBlocks.Count);
+ Assert.HasCount(1, comBlocks);
Assert.AreEqual(comment, comBlocks[0].Comment);
Assert.AreEqual(location, comBlocks[0].Location);
Assert.IsTrue(msSession.Save(out error), error?.Message);
@@ -80,7 +80,7 @@ public void TestCommentBlockPersistence()
{
var ms = msSession.ModelSystem;
var comBlocks = ms.GlobalBoundary.CommentBlocks;
- Assert.AreEqual(1, comBlocks.Count);
+ Assert.HasCount(1, comBlocks);
Assert.AreEqual(comment, comBlocks[0].Comment);
Assert.AreEqual(location, comBlocks[0].Location);
});
@@ -96,13 +96,13 @@ public void TestRemovingCommentBlock()
var comment = "My Comment";
var location = new Rectangle(100, 100);
var comBlocks = ms.GlobalBoundary.CommentBlocks;
- Assert.AreEqual(0, comBlocks.Count);
+ Assert.IsEmpty(comBlocks);
Assert.IsTrue(msSession.AddCommentBlock(user, ms.GlobalBoundary, comment, location, out CommentBlock block, out error), error?.Message);
- Assert.AreEqual(1, comBlocks.Count);
+ Assert.HasCount(1, comBlocks);
Assert.AreEqual(comment, comBlocks[0].Comment);
Assert.AreEqual(location, comBlocks[0].Location);
Assert.IsTrue(msSession.RemoveCommentBlock(user, ms.GlobalBoundary, block, out error), error?.Message);
- Assert.AreEqual(0, comBlocks.Count);
+ Assert.IsEmpty(comBlocks);
});
}
@@ -116,13 +116,13 @@ public void TestRemovingCommentBlockWithBadUser()
var comment = "My Comment";
var location = new Rectangle(100, 100);
var comBlocks = ms.GlobalBoundary.CommentBlocks;
- Assert.AreEqual(0, comBlocks.Count);
+ Assert.IsEmpty(comBlocks);
Assert.IsTrue(msSession.AddCommentBlock(user, ms.GlobalBoundary, comment, location, out CommentBlock block, out error), error?.Message);
- Assert.AreEqual(1, comBlocks.Count);
+ Assert.HasCount(1, comBlocks);
Assert.AreEqual(comment, comBlocks[0].Comment);
Assert.AreEqual(location, comBlocks[0].Location);
Assert.IsFalse(msSession.RemoveCommentBlock(unauthorizedUser, ms.GlobalBoundary, block, out error), error?.Message);
- Assert.AreEqual(1, comBlocks.Count);
+ Assert.HasCount(1, comBlocks);
});
}
@@ -136,15 +136,15 @@ public void TestCreatingCommentBlockUndoRedo()
var comment = "My Comment";
var location = new Rectangle(100, 100);
var comBlock = ms.GlobalBoundary.CommentBlocks;
- Assert.AreEqual(0, comBlock.Count);
+ Assert.IsEmpty(comBlock);
Assert.IsTrue(msSession.AddCommentBlock(user, ms.GlobalBoundary, comment, location, out CommentBlock block, out error), error?.Message);
- Assert.AreEqual(1, comBlock.Count);
+ Assert.HasCount(1, comBlock);
Assert.AreEqual(comment, comBlock[0].Comment);
Assert.AreEqual(location, comBlock[0].Location);
Assert.IsTrue(msSession.Undo(user, out error), error?.Message);
- Assert.AreEqual(0, comBlock.Count);
+ Assert.IsEmpty(comBlock);
Assert.IsTrue(msSession.Redo(user, out error), error?.Message);
- Assert.AreEqual(1, comBlock.Count);
+ Assert.HasCount(1, comBlock);
Assert.AreEqual(comment, comBlock[0].Comment);
});
}
@@ -159,19 +159,19 @@ public void TestRemovingCommentBlockUndoRedo()
var comment = "My Comment";
var location = new Rectangle(100, 100);
var comBlocks = ms.GlobalBoundary.CommentBlocks;
- Assert.AreEqual(0, comBlocks.Count);
+ Assert.IsEmpty(comBlocks);
Assert.IsTrue(msSession.AddCommentBlock(user, ms.GlobalBoundary, comment, location, out CommentBlock block, out error), error?.Message);
- Assert.AreEqual(1, comBlocks.Count);
+ Assert.HasCount(1, comBlocks);
Assert.AreEqual(comment, comBlocks[0].Comment);
Assert.AreEqual(location, comBlocks[0].Location);
Assert.IsTrue(msSession.RemoveCommentBlock(user, ms.GlobalBoundary, block, out error), error?.Message);
- Assert.AreEqual(0, comBlocks.Count);
+ Assert.IsEmpty(comBlocks);
Assert.IsTrue(msSession.Undo(user, out error), error?.Message);
- Assert.AreEqual(1, comBlocks.Count);
+ Assert.HasCount(1, comBlocks);
Assert.AreEqual(comment, comBlocks[0].Comment);
Assert.AreEqual(location, comBlocks[0].Location);
Assert.IsTrue(msSession.Redo(user, out error), error?.Message);
- Assert.AreEqual(0, comBlocks.Count);
+ Assert.IsEmpty(comBlocks);
});
}
@@ -186,9 +186,9 @@ public void TestChangingCommentBlockText()
var newComment = "New comment";
var location = new Rectangle(100, 100);
var comBlocks = ms.GlobalBoundary.CommentBlocks;
- Assert.AreEqual(0, comBlocks.Count);
+ Assert.IsEmpty(comBlocks);
Assert.IsTrue(msSession.AddCommentBlock(user, ms.GlobalBoundary, comment, location, out CommentBlock block, out error), error?.Message);
- Assert.AreEqual(1, comBlocks.Count);
+ Assert.HasCount(1, comBlocks);
Assert.AreEqual(comment, comBlocks[0].Comment);
Assert.IsTrue(msSession.SetCommentBlockText(user, block, newComment, out error), error?.Message);
Assert.AreEqual(newComment, block.Comment, "The comment block's text was not set!");
@@ -210,9 +210,9 @@ public void TestChangingCommentBlockPosition()
var location = new Rectangle(100, 100);
var newLocation = new Rectangle(100, 200);
var comBlocks = ms.GlobalBoundary.CommentBlocks;
- Assert.AreEqual(0, comBlocks.Count);
+ Assert.IsEmpty(comBlocks);
Assert.IsTrue(msSession.AddCommentBlock(user, ms.GlobalBoundary, comment, location, out CommentBlock block, out error), error?.Message);
- Assert.AreEqual(1, comBlocks.Count);
+ Assert.HasCount(1, comBlocks);
Assert.AreEqual(comment, comBlocks[0].Comment);
Assert.IsTrue(msSession.SetCommentBlockLocation(user, block, newLocation, out error), error?.Message);
Assert.AreEqual(newLocation, block.Location, "The comment block's location was not set!");
diff --git a/tests/XTMF2.UnitTests/Editing/TestEditingParameterExpressions.cs b/tests/XTMF2.UnitTests/Editing/TestEditingParameterExpressions.cs
index 2463918..6bf9719 100644
--- a/tests/XTMF2.UnitTests/Editing/TestEditingParameterExpressions.cs
+++ b/tests/XTMF2.UnitTests/Editing/TestEditingParameterExpressions.cs
@@ -46,7 +46,7 @@ public void ParameterExpression()
Assert.IsNotNull(childNode);
Assert.IsTrue(mSession.SetParameterExpression(user, childNode, "\"Hello World\" + (1 + 2)", out error));
Assert.IsNotNull(childNode.ParameterValue);
- Assert.AreEqual(childNode.ParameterValue.Type, typeof(string));
+ Assert.AreEqual(typeof(string), childNode.ParameterValue.Type);
Assert.IsInstanceOfType(childNode.ParameterValue, typeof(ParameterExpression));
Assert.AreEqual("Hello World3", childNode.ParameterValue.GetValue(null, typeof(string), ref errorStr));
});
@@ -69,7 +69,7 @@ public void ParameterExpressionUndo()
Assert.IsTrue(mSession.SetParameterValue(user, childNode, "OriginalValue", out error));
Assert.IsTrue(mSession.SetParameterExpression(user, childNode, "\"Hello World\" + (1 + 2)", out error));
Assert.IsNotNull(childNode.ParameterValue);
- Assert.AreEqual(childNode.ParameterValue.Type, typeof(string));
+ Assert.AreEqual(typeof(string), childNode.ParameterValue.Type);
Assert.IsInstanceOfType(childNode.ParameterValue, typeof(ParameterExpression));
Assert.AreEqual("Hello World3", childNode.ParameterValue.GetValue(null, typeof(string), ref errorStr));
Assert.IsTrue(mSession.Undo(user, out error), error?.Message);
@@ -94,7 +94,7 @@ public void ParameterExpressionRedo()
Assert.IsTrue(mSession.SetParameterValue(user, childNode, "OriginalValue", out error));
Assert.IsTrue(mSession.SetParameterExpression(user, childNode, "\"Hello World\" + (1 + 2)", out error));
Assert.IsNotNull(childNode.ParameterValue);
- Assert.AreEqual(childNode.ParameterValue.Type, typeof(string));
+ Assert.AreEqual(typeof(string), childNode.ParameterValue.Type);
Assert.IsInstanceOfType(childNode.ParameterValue, typeof(ParameterExpression));
Assert.AreEqual("Hello World3", childNode.ParameterValue.GetValue(null, typeof(string), ref errorStr));
Assert.IsTrue(mSession.Undo(user, out error), error?.Message);
@@ -120,7 +120,7 @@ public void ParameterExpressionSaved()
Assert.IsNotNull(childNode);
Assert.IsTrue(mSession.SetParameterExpression(user, childNode, "\"Hello World\" + (1 + 2)", out error));
Assert.IsNotNull(childNode.ParameterValue);
- Assert.AreEqual(childNode.ParameterValue.Type, typeof(string));
+ Assert.AreEqual(typeof(string), childNode.ParameterValue.Type);
Assert.IsInstanceOfType(childNode.ParameterValue, typeof(ParameterExpression));
Assert.AreEqual("Hello World3", childNode.ParameterValue.GetValue(null, typeof(string), ref errorStr));
},(user, pSession, mSession)=>
diff --git a/tests/XTMF2.UnitTests/Editing/TestFunctions.cs b/tests/XTMF2.UnitTests/Editing/TestFunctions.cs
index 7efff35..5835620 100644
--- a/tests/XTMF2.UnitTests/Editing/TestFunctions.cs
+++ b/tests/XTMF2.UnitTests/Editing/TestFunctions.cs
@@ -35,9 +35,9 @@ public void TestAddFunctionTemplate()
var ms = mSession.ModelSystem;
var name = "FunctionTemplateName";
var functionTemplates = ms.GlobalBoundary.FunctionTemplates;
- Assert.AreEqual(0, functionTemplates.Count);
+ Assert.IsEmpty(functionTemplates);
Assert.IsTrue(mSession.AddFunctionTemplate(user, ms.GlobalBoundary, name, out FunctionTemplate template, out error), error?.Message);
- Assert.AreEqual(1, functionTemplates.Count);
+ Assert.HasCount(1, functionTemplates);
});
}
@@ -50,13 +50,13 @@ public void TestAddFunctionTemplateUndo()
var ms = mSession.ModelSystem;
var name = "FunctionTemplateName";
var functionTemplates = ms.GlobalBoundary.FunctionTemplates;
- Assert.AreEqual(0, functionTemplates.Count);
+ Assert.IsEmpty(functionTemplates);
Assert.IsTrue(mSession.AddFunctionTemplate(user, ms.GlobalBoundary, name, out FunctionTemplate template, out error), error?.Message);
- Assert.AreEqual(1, functionTemplates.Count);
+ Assert.HasCount(1, functionTemplates);
Assert.IsTrue(mSession.Undo(user, out error));
- Assert.AreEqual(0, functionTemplates.Count);
+ Assert.IsEmpty(functionTemplates);
Assert.IsTrue(mSession.Redo(user, out error));
- Assert.AreEqual(1, functionTemplates.Count);
+ Assert.HasCount(1, functionTemplates);
});
}
@@ -69,11 +69,11 @@ public void TestRemoveFunctionTemplate()
var ms = mSession.ModelSystem;
var name = "FunctionTemplateName";
var functionTemplates = ms.GlobalBoundary.FunctionTemplates;
- Assert.AreEqual(0, functionTemplates.Count);
+ Assert.IsEmpty(functionTemplates);
Assert.IsTrue(mSession.AddFunctionTemplate(user, ms.GlobalBoundary, name, out FunctionTemplate template, out error), error?.Message);
- Assert.AreEqual(1, functionTemplates.Count);
+ Assert.HasCount(1, functionTemplates);
Assert.IsTrue(mSession.RemoveFunctionTemplate(user, ms.GlobalBoundary, template, out error), error?.Message);
- Assert.AreEqual(0, functionTemplates.Count);
+ Assert.IsEmpty(functionTemplates);
});
}
@@ -86,15 +86,15 @@ public void TestRemoveFunctionTemplateUndo()
var ms = mSession.ModelSystem;
var name = "FunctionTemplateName";
var functionTemplates = ms.GlobalBoundary.FunctionTemplates;
- Assert.AreEqual(0, functionTemplates.Count);
+ Assert.IsEmpty(functionTemplates);
Assert.IsTrue(mSession.AddFunctionTemplate(user, ms.GlobalBoundary, name, out FunctionTemplate template, out error), error?.Message);
- Assert.AreEqual(1, functionTemplates.Count);
+ Assert.HasCount(1, functionTemplates);
Assert.IsTrue(mSession.RemoveFunctionTemplate(user, ms.GlobalBoundary, template, out error), error?.Message);
- Assert.AreEqual(0, functionTemplates.Count);
+ Assert.IsEmpty(functionTemplates);
Assert.IsTrue(mSession.Undo(user, out error));
- Assert.AreEqual(1, functionTemplates.Count);
+ Assert.HasCount(1, functionTemplates);
Assert.IsTrue(mSession.Redo(user, out error));
- Assert.AreEqual(0, functionTemplates.Count);
+ Assert.IsEmpty(functionTemplates);
});
}
@@ -107,15 +107,15 @@ public void TestFunctionTemplateSave()
var ms = mSession.ModelSystem;
var name = "FunctionTemplateName";
var functionTemplates = ms.GlobalBoundary.FunctionTemplates;
- Assert.AreEqual(0, functionTemplates.Count);
+ Assert.IsEmpty(functionTemplates);
Assert.IsTrue(mSession.AddFunctionTemplate(user, ms.GlobalBoundary, name, out FunctionTemplate template, out error), error?.Message);
- Assert.AreEqual(1, functionTemplates.Count);
+ Assert.HasCount(1, functionTemplates);
Assert.IsTrue(mSession.Save(out error), error?.Message);
}, (user, pSession, mSession)=>
{
var ms = mSession.ModelSystem;
var functionTemplates = ms.GlobalBoundary.FunctionTemplates;
- Assert.AreEqual(1, functionTemplates.Count, "The function template was not saved!");
+ Assert.HasCount(1, functionTemplates, "The function template was not saved!");
});
}
}
diff --git a/tests/XTMF2.UnitTests/Editing/TestLinks.cs b/tests/XTMF2.UnitTests/Editing/TestLinks.cs
index 9a5ecd7..8b3f675 100644
--- a/tests/XTMF2.UnitTests/Editing/TestLinks.cs
+++ b/tests/XTMF2.UnitTests/Editing/TestLinks.cs
@@ -37,19 +37,19 @@ public void UndoAddLink()
{
var ms = mSession.ModelSystem;
CommandError error = null;
- Assert.AreEqual(0, ms.GlobalBoundary.Modules.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Modules);
Assert.IsTrue(mSession.AddNode(user, ms.GlobalBoundary, "Start", typeof(BasicParameter), Rectangle.Hidden,
out var parameter, out error), error?.Message);
Assert.IsTrue(mSession.AddNode(user, ms.GlobalBoundary, "Start", typeof(SimpleParameterModule), Rectangle.Hidden,
out var module, out error), error?.Message);
- Assert.AreEqual(2, ms.GlobalBoundary.Modules.Count);
- Assert.AreEqual(0, ms.GlobalBoundary.Links.Count);
+ Assert.HasCount(2, ms.GlobalBoundary.Modules);
+ Assert.IsEmpty(ms.GlobalBoundary.Links);
Assert.IsTrue(mSession.AddLink(user, module, module.Hooks[0], parameter, out var link, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Links.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Links);
Assert.IsTrue(mSession.Undo(user, out error), error?.Message);
- Assert.AreEqual(0, ms.GlobalBoundary.Links.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Links);
Assert.IsTrue(mSession.Redo(user, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Links.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Links);
Assert.AreSame(link, ms.GlobalBoundary.Links[0]);
});
}
@@ -61,24 +61,24 @@ public void RemoveLink()
{
var ms = mSession.ModelSystem;
CommandError error = null;
- Assert.AreEqual(0, ms.GlobalBoundary.Modules.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Modules);
Assert.IsTrue(mSession.AddNode(user, ms.GlobalBoundary, "Start", typeof(BasicParameter), Rectangle.Hidden,
out var parameter, out error), error?.Message);
Assert.IsTrue(mSession.AddNode(user, ms.GlobalBoundary, "Start", typeof(SimpleParameterModule), Rectangle.Hidden,
out var module, out error), error?.Message);
- Assert.AreEqual(2, ms.GlobalBoundary.Modules.Count);
- Assert.AreEqual(0, ms.GlobalBoundary.Links.Count);
+ Assert.HasCount(2, ms.GlobalBoundary.Modules);
+ Assert.IsEmpty(ms.GlobalBoundary.Links);
Assert.IsTrue(mSession.AddLink(user, module, module.Hooks[0], parameter, out var link, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Links.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Links);
Assert.IsTrue(mSession.Undo(user, out error), error?.Message);
- Assert.AreEqual(0, ms.GlobalBoundary.Links.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Links);
Assert.IsTrue(mSession.Redo(user, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Links.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Links);
Assert.AreSame(link, ms.GlobalBoundary.Links[0]);
// now remove the link explicitly
Assert.IsTrue(mSession.RemoveLink(user, link, out error), error?.Message);
- Assert.AreEqual(0, ms.GlobalBoundary.Links.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Links);
});
}
@@ -89,24 +89,24 @@ public void RemoveLinkWithBadUser()
{
var ms = mSession.ModelSystem;
CommandError error = null;
- Assert.AreEqual(0, ms.GlobalBoundary.Modules.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Modules);
Assert.IsTrue(mSession.AddNode(user, ms.GlobalBoundary, "Start", typeof(BasicParameter), Rectangle.Hidden,
out var parameter, out error), error?.Message);
Assert.IsTrue(mSession.AddNode(user, ms.GlobalBoundary, "Start", typeof(SimpleParameterModule), Rectangle.Hidden,
out var module, out error), error?.Message);
- Assert.AreEqual(2, ms.GlobalBoundary.Modules.Count);
- Assert.AreEqual(0, ms.GlobalBoundary.Links.Count);
+ Assert.HasCount(2, ms.GlobalBoundary.Modules);
+ Assert.IsEmpty(ms.GlobalBoundary.Links);
Assert.IsTrue(mSession.AddLink(user, module, module.Hooks[0], parameter, out var link, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Links.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Links);
Assert.IsTrue(mSession.Undo(user, out error), error?.Message);
- Assert.AreEqual(0, ms.GlobalBoundary.Links.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Links);
Assert.IsTrue(mSession.Redo(user, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Links.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Links);
Assert.AreSame(link, ms.GlobalBoundary.Links[0]);
// now remove the link explicitly
Assert.IsFalse(mSession.RemoveLink(unauthorizedUser, link, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Links.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Links);
});
}
@@ -117,29 +117,29 @@ public void UndoRemoveLink()
{
var ms = mSession.ModelSystem;
CommandError error = null;
- Assert.AreEqual(0, ms.GlobalBoundary.Modules.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Modules);
Assert.IsTrue(mSession.AddNode(user, ms.GlobalBoundary, "Start", typeof(BasicParameter), Rectangle.Hidden,
out var parameter, out error), error?.Message);
Assert.IsTrue(mSession.AddNode(user, ms.GlobalBoundary, "Start", typeof(SimpleParameterModule), Rectangle.Hidden,
out var module, out error), error?.Message);
- Assert.AreEqual(2, ms.GlobalBoundary.Modules.Count);
- Assert.AreEqual(0, ms.GlobalBoundary.Links.Count);
+ Assert.HasCount(2, ms.GlobalBoundary.Modules);
+ Assert.IsEmpty(ms.GlobalBoundary.Links);
Assert.IsTrue(mSession.AddLink(user, module, module.Hooks[0], parameter, out var link, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Links.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Links);
Assert.IsTrue(mSession.Undo(user, out error), error?.Message);
- Assert.AreEqual(0, ms.GlobalBoundary.Links.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Links);
Assert.IsTrue(mSession.Redo(user, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Links.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Links);
Assert.AreSame(link, ms.GlobalBoundary.Links[0]);
// now remove the link explicitly
Assert.IsTrue(mSession.RemoveLink(user, link, out error), error?.Message);
- Assert.AreEqual(0, ms.GlobalBoundary.Links.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Links);
Assert.IsTrue(mSession.Undo(user, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Links.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Links);
Assert.AreSame(link, ms.GlobalBoundary.Links[0]);
Assert.IsTrue(mSession.Redo(user, out error), error?.Message);
- Assert.AreEqual(0, ms.GlobalBoundary.Links.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Links);
});
}
@@ -159,10 +159,10 @@ public void AddSingleLinkToDifferentModule()
Assert.IsTrue(mSession.AddNode(user, ms.GlobalBoundary, "MyMSS", typeof(SimpleTestModule), Rectangle.Hidden, out var mss1, out error));
Assert.IsTrue(mSession.AddNode(user, ms.GlobalBoundary, "MyMSS", typeof(SimpleTestModule), Rectangle.Hidden, out var mss2, out error));
Assert.IsTrue(mSession.AddLink(user, start, start.Hooks[0], mss1, out var link1, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Links.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Links);
// This should not create a new link but move the previous one
Assert.IsTrue(mSession.AddLink(user, start, start.Hooks[0], mss2, out var link2, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Links.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Links);
});
}
@@ -180,17 +180,17 @@ public void RemoveLinkToBoundariesThatWereRemoved()
Assert.IsTrue(mSession.AddNode(user, toRemove, "Tricky", typeof(IgnoreResult), Rectangle.Hidden,
out var tricky, out error), error?.Message);
Assert.IsTrue(mSession.AddLink(user, start, start.Hooks[0], tricky, out var link, out error), error?.Message);
- Assert.AreEqual(1, global.Starts.Count);
- Assert.AreEqual(1, global.Links.Count);
- Assert.AreEqual(1, toRemove.Modules.Count);
+ Assert.HasCount(1, global.Starts);
+ Assert.HasCount(1, global.Links);
+ Assert.HasCount(1, toRemove.Modules);
// Now remove the boundary and check to make sure the number of links is cleaned up
Assert.IsTrue(mSession.RemoveBoundary(user, global, toRemove, out error), error?.Message);
- Assert.AreEqual(0, global.Links.Count, "We did not remove the link during the remove boundary!");
+ Assert.IsEmpty(global.Links, "We did not remove the link during the remove boundary!");
Assert.IsTrue(mSession.Undo(user, out error), error?.Message);
- Assert.AreEqual(1, global.Links.Count, "The link was not restored after the undo on the remove boundary!");
+ Assert.HasCount(1, global.Links, "The link was not restored after the undo on the remove boundary!");
Assert.IsTrue(mSession.Redo(user, out error), error?.Message);
- Assert.AreEqual(0, global.Links.Count, "We did not remove the link again doing the redo of the remove boundary!");
+ Assert.IsEmpty(global.Links, "We did not remove the link again doing the redo of the remove boundary!");
});
}
@@ -211,18 +211,18 @@ public void RemoveMultiLinkToBoundariesThatWereRemoved()
out var tricky, out error), error?.Message);
Assert.IsTrue(mSession.AddLink(user, start, start.Hooks[0], execute, out var link, out error), error?.Message);
Assert.IsTrue(mSession.AddLink(user, execute, TestHelper.GetHook(execute.Hooks, "To Execute"), tricky, out var link2, out error), error?.Message);
- Assert.AreEqual(1, global.Starts.Count);
- Assert.AreEqual(1, global.Modules.Count);
- Assert.AreEqual(2, global.Links.Count);
- Assert.AreEqual(1, toRemove.Modules.Count);
+ Assert.HasCount(1, global.Starts);
+ Assert.HasCount(1, global.Modules);
+ Assert.HasCount(2, global.Links);
+ Assert.HasCount(1, toRemove.Modules);
// Now remove the boundary and check to make sure the number of links is cleaned up
Assert.IsTrue(mSession.RemoveBoundary(user, global, toRemove, out error), error?.Message);
- Assert.AreEqual(0, ((MultiLink)global.Links.First(l => l.Origin == execute)).Destinations.Count);
+ Assert.IsEmpty(((MultiLink)global.Links.First(l => l.Origin == execute)).Destinations);
Assert.IsTrue(mSession.Undo(user, out error), error?.Message);
- Assert.AreEqual(1, ((MultiLink)global.Links.First(l => l.Origin == execute)).Destinations.Count);
+ Assert.HasCount(1, ((MultiLink)global.Links.First(l => l.Origin == execute)).Destinations);
Assert.IsTrue(mSession.Redo(user, out error), error?.Message);
- Assert.AreEqual(0, ((MultiLink)global.Links.First(l => l.Origin == execute)).Destinations.Count);
+ Assert.IsEmpty(((MultiLink)global.Links.First(l => l.Origin == execute)).Destinations);
});
}
@@ -247,13 +247,13 @@ public void RemoveSingleDestinationInMultiLink()
Assert.IsTrue(mSession.AddLink(user, execute, TestHelper.GetHook(execute.Hooks, "To Execute"),
execute, out var _, out error), error?.Message);
- Assert.AreEqual(2, ((MultiLink)linkI1).Destinations.Count);
+ Assert.HasCount(2, ((MultiLink)linkI1).Destinations);
Assert.IsTrue(mSession.RemoveLinkDestination(user, linkI1, 0, out error), error?.Message);
- Assert.AreEqual(1, ((MultiLink)linkI1).Destinations.Count);
+ Assert.HasCount(1, ((MultiLink)linkI1).Destinations);
Assert.IsTrue(mSession.Undo(user, out error), error?.Message);
- Assert.AreEqual(2, ((MultiLink)linkI1).Destinations.Count);
+ Assert.HasCount(2, ((MultiLink)linkI1).Destinations);
Assert.IsTrue(mSession.Redo(user, out error), error?.Message);
- Assert.AreEqual(1, ((MultiLink)linkI1).Destinations.Count);
+ Assert.HasCount(1, ((MultiLink)linkI1).Destinations);
});
}
@@ -278,9 +278,9 @@ public void RemoveSingleDestinationInMultiLinkWithBadUser()
Assert.IsTrue(mSession.AddLink(user, execute, TestHelper.GetHook(execute.Hooks, "To Execute"),
execute, out var _, out error), error?.Message);
- Assert.AreEqual(2, ((MultiLink)linkI1).Destinations.Count);
+ Assert.HasCount(2, ((MultiLink)linkI1).Destinations);
Assert.IsFalse(mSession.RemoveLinkDestination(unauthorizedUser, linkI1, 0, out error), error?.Message);
- Assert.AreEqual(2, ((MultiLink)linkI1).Destinations.Count, "An unauthorized user was able to change the number of destinations.");
+ Assert.HasCount(2, ((MultiLink)linkI1).Destinations, "An unauthorized user was able to change the number of destinations.");
});
}
@@ -311,8 +311,8 @@ public void DisableLink()
var ms = mSession.ModelSystem;
var modules = ms.GlobalBoundary.Modules;
var links = ms.GlobalBoundary.Links;
- Assert.AreEqual(3, modules.Count);
- Assert.AreEqual(1, links.Count);
+ Assert.HasCount(3, modules);
+ Assert.HasCount(1, links);
Assert.IsTrue(links[0].IsDisabled, "The link was not disabled on reload.");
});
}
diff --git a/tests/XTMF2.UnitTests/Editing/TestNode.cs b/tests/XTMF2.UnitTests/Editing/TestNode.cs
index cdf0d6e..5a41460 100644
--- a/tests/XTMF2.UnitTests/Editing/TestNode.cs
+++ b/tests/XTMF2.UnitTests/Editing/TestNode.cs
@@ -36,10 +36,10 @@ public void AddStart()
{
var ms = mSession.ModelSystem;
CommandError error = null;
- Assert.AreEqual(0, ms.GlobalBoundary.Starts.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Starts);
Assert.IsTrue(mSession.AddModelSystemStart(user, ms.GlobalBoundary, "Start", Rectangle.Hidden,
out var Start, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Starts.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Starts);
});
}
@@ -50,10 +50,10 @@ public void AddStartWithBadUser()
{
var ms = mSession.ModelSystem;
CommandError error = null;
- Assert.AreEqual(0, ms.GlobalBoundary.Starts.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Starts);
Assert.IsFalse(mSession.AddModelSystemStart(unauthorizedUser, ms.GlobalBoundary, "Start", Rectangle.Hidden,
out var Start, out error), error?.Message);
- Assert.AreEqual(0, ms.GlobalBoundary.Starts.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Starts);
});
}
@@ -64,14 +64,14 @@ public void UndoAddStart()
{
var ms = mSession.ModelSystem;
CommandError error = null;
- Assert.AreEqual(0, ms.GlobalBoundary.Starts.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Starts);
Assert.IsTrue(mSession.AddModelSystemStart(user, ms.GlobalBoundary, "Start", Rectangle.Hidden,
out var Start, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Starts.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Starts);
Assert.IsTrue(mSession.Undo(user, out error), error?.Message);
- Assert.AreEqual(0, ms.GlobalBoundary.Starts.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Starts);
Assert.IsTrue(mSession.Redo(user, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Starts.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Starts);
Assert.AreSame(Start, ms.GlobalBoundary.Starts[0]);
});
}
@@ -83,19 +83,19 @@ public void RemoveStart()
{
var ms = mSession.ModelSystem;
CommandError error = null;
- Assert.AreEqual(0, ms.GlobalBoundary.Starts.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Starts);
Assert.IsTrue(mSession.AddModelSystemStart(user, ms.GlobalBoundary, "Start", Rectangle.Hidden,
out var Start, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Starts.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Starts);
Assert.IsTrue(mSession.Undo(user, out error), error?.Message);
- Assert.AreEqual(0, ms.GlobalBoundary.Starts.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Starts);
Assert.IsTrue(mSession.Redo(user, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Starts.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Starts);
Assert.AreSame(Start, ms.GlobalBoundary.Starts[0]);
//now test explicitly removing the start
Assert.IsTrue(mSession.RemoveStart(user, Start, out error), error?.Message);
- Assert.AreEqual(0, ms.GlobalBoundary.Starts.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Starts);
});
}
@@ -106,19 +106,19 @@ public void RemoveStartWithBadUser()
{
var ms = mSession.ModelSystem;
CommandError error = null;
- Assert.AreEqual(0, ms.GlobalBoundary.Starts.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Starts);
Assert.IsTrue(mSession.AddModelSystemStart(user, ms.GlobalBoundary, "Start", Rectangle.Hidden,
out var Start, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Starts.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Starts);
Assert.IsTrue(mSession.Undo(user, out error), error?.Message);
- Assert.AreEqual(0, ms.GlobalBoundary.Starts.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Starts);
Assert.IsTrue(mSession.Redo(user, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Starts.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Starts);
Assert.AreSame(Start, ms.GlobalBoundary.Starts[0]);
//now test explicitly removing the start
Assert.IsFalse(mSession.RemoveStart(unauthorizedUser, Start, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Starts.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Starts);
});
}
@@ -129,22 +129,22 @@ public void UndoRemoveStart()
{
var ms = mSession.ModelSystem;
CommandError error = null;
- Assert.AreEqual(0, ms.GlobalBoundary.Starts.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Starts);
Assert.IsTrue(mSession.AddModelSystemStart(user, ms.GlobalBoundary, "Start", Rectangle.Hidden, out var Start, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Starts.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Starts);
Assert.IsTrue(mSession.Undo(user, out error), error?.Message);
- Assert.AreEqual(0, ms.GlobalBoundary.Starts.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Starts);
Assert.IsTrue(mSession.Redo(user, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Starts.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Starts);
Assert.AreSame(Start, ms.GlobalBoundary.Starts[0]);
//now test explicitly removing the start
Assert.IsTrue(mSession.RemoveStart(user, Start, out error), error?.Message);
- Assert.AreEqual(0, ms.GlobalBoundary.Starts.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Starts);
Assert.IsTrue(mSession.Undo(user, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Starts.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Starts);
Assert.IsTrue(mSession.Redo(user, out error), error?.Message);
- Assert.AreEqual(0, ms.GlobalBoundary.Starts.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Starts);
});
}
@@ -155,10 +155,10 @@ public void AddNode()
{
var ms = mSession.ModelSystem;
CommandError error = null;
- Assert.AreEqual(0, ms.GlobalBoundary.Modules.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Modules);
Assert.IsTrue(mSession.AddNode(user, ms.GlobalBoundary, "Start", typeof(BasicParameter), Rectangle.Hidden,
out var mss, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Modules.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Modules);
});
}
@@ -169,10 +169,10 @@ public void AddNodeWithBadUser()
{
var ms = mSession.ModelSystem;
CommandError error = null;
- Assert.AreEqual(0, ms.GlobalBoundary.Modules.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Modules);
Assert.IsFalse(mSession.AddNode(unauthorizedUser, ms.GlobalBoundary, "Start", typeof(BasicParameter), Rectangle.Hidden,
out var mss, out error), error?.Message);
- Assert.AreEqual(0, ms.GlobalBoundary.Modules.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Modules);
});
}
@@ -183,14 +183,14 @@ public void UndoAddNode()
{
var ms = mSession.ModelSystem;
CommandError error = null;
- Assert.AreEqual(0, ms.GlobalBoundary.Modules.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Modules);
Assert.IsTrue(mSession.AddNode(user, ms.GlobalBoundary, "Start", typeof(BasicParameter), Rectangle.Hidden,
out var mss, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Modules.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Modules);
Assert.IsTrue(mSession.Undo(user, out error), error?.Message);
- Assert.AreEqual(0, ms.GlobalBoundary.Modules.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Modules);
Assert.IsTrue(mSession.Redo(user, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Modules.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Modules);
Assert.AreSame(mss, ms.GlobalBoundary.Modules[0]);
});
}
@@ -202,19 +202,19 @@ public void RemoveNode()
{
var ms = mSession.ModelSystem;
CommandError error = null;
- Assert.AreEqual(0, ms.GlobalBoundary.Modules.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Modules);
Assert.IsTrue(mSession.AddNode(user, ms.GlobalBoundary, "Start", typeof(BasicParameter), Rectangle.Hidden,
out var mss, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Modules.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Modules);
Assert.IsTrue(mSession.Undo(user, out error), error?.Message);
- Assert.AreEqual(0, ms.GlobalBoundary.Modules.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Modules);
Assert.IsTrue(mSession.Redo(user, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Modules.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Modules);
Assert.AreSame(mss, ms.GlobalBoundary.Modules[0]);
// now remove node explicitly
Assert.IsTrue(mSession.RemoveNode(user, mss, out error), error?.Message);
- Assert.AreEqual(0, ms.GlobalBoundary.Modules.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Modules);
});
}
@@ -225,19 +225,19 @@ public void RemoveNodeWithBadUser()
{
var ms = mSession.ModelSystem;
CommandError error = null;
- Assert.AreEqual(0, ms.GlobalBoundary.Modules.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Modules);
Assert.IsTrue(mSession.AddNode(user, ms.GlobalBoundary, "Start", typeof(BasicParameter), Rectangle.Hidden,
out var mss, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Modules.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Modules);
Assert.IsTrue(mSession.Undo(user, out error), error?.Message);
- Assert.AreEqual(0, ms.GlobalBoundary.Modules.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Modules);
Assert.IsTrue(mSession.Redo(user, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Modules.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Modules);
Assert.AreSame(mss, ms.GlobalBoundary.Modules[0]);
// now remove node explicitly
Assert.IsFalse(mSession.RemoveNode(unauthorizedUser, mss, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Modules.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Modules);
});
}
@@ -248,21 +248,21 @@ public void UndoRemoveNode()
{
var ms = mSession.ModelSystem;
CommandError error = null;
- Assert.AreEqual(0, ms.GlobalBoundary.Modules.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Modules);
Assert.IsTrue(mSession.AddNode(user, ms.GlobalBoundary, "Start", typeof(BasicParameter), Rectangle.Hidden,
out var mss, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Modules.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Modules);
Assert.IsTrue(mSession.Undo(user, out error), error?.Message);
- Assert.AreEqual(0, ms.GlobalBoundary.Modules.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Modules);
Assert.IsTrue(mSession.Redo(user, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Modules.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Modules);
Assert.AreSame(mss, ms.GlobalBoundary.Modules[0]);
// now remove node explicitly
Assert.IsTrue(mSession.RemoveNode(user, mss, out error), error?.Message);
- Assert.AreEqual(0, ms.GlobalBoundary.Modules.Count);
+ Assert.IsEmpty(ms.GlobalBoundary.Modules);
Assert.IsTrue(mSession.Undo(user, out error), error?.Message);
- Assert.AreEqual(1, ms.GlobalBoundary.Modules.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Modules);
Assert.IsTrue(mSession.Undo(user, out error), error?.Message);
});
}
@@ -282,11 +282,11 @@ public void AddNodeWithParameterGeneration()
typeof(SimpleParameterModule), Rectangle.Hidden, out var node, out var children, out error), error?.Message);
// Test to make sure that there was a second module also added.
Assert.IsNotNull(children, "The child parameters of the node were returned as a null!");
- Assert.AreEqual(1, children.Count);
+ Assert.HasCount(1, children);
var modules = gBound.Modules;
var links = gBound.Links;
- Assert.AreEqual(2, modules.Count, "It seems that the child parameter was not contained in the global boundary.");
- Assert.AreEqual(1, links.Count, "We did not have a link!");
+ Assert.HasCount(2, modules, "It seems that the child parameter was not contained in the global boundary.");
+ Assert.HasCount(1, links, "We did not have a link!");
// Find the automatically added basic parameter and make sure that it has the correct default value
bool found = false;
for (int i = 0; i < modules.Count; i++)
@@ -320,8 +320,8 @@ public void AddNodeWithParameterGenerationWithBadUser()
Assert.IsNull(children, "The child parameters of the node were returned as a null!");
var modules = gBound.Modules;
var links = gBound.Links;
- Assert.AreEqual(0, modules.Count, "A module was created by an invalid user!");
- Assert.AreEqual(0, links.Count, "A link was created by an invalid user!");
+ Assert.IsEmpty(modules, "A module was created by an invalid user!");
+ Assert.IsEmpty(links, "A link was created by an invalid user!");
});
}
@@ -341,17 +341,17 @@ public void AddNodeWithParameterGenerationUndo()
typeof(SimpleParameterModule), Rectangle.Hidden, out var node, out var children, out error), error?.Message);
// Test to make sure that there was a second module also added.
Assert.IsNotNull(children, "The child parameters of the node were returned as a null!");
- Assert.AreEqual(1, children.Count);
+ Assert.HasCount(1, children);
var modules = gBound.Modules;
var links = gBound.Links;
- Assert.AreEqual(2, modules.Count, "It seems that the child parameter was not contained in the global boundary.");
- Assert.AreEqual(1, links.Count, "We did not have a link!");
+ Assert.HasCount(2, modules, "It seems that the child parameter was not contained in the global boundary.");
+ Assert.HasCount(1, links, "We did not have a link!");
Assert.IsTrue(msSession.Undo(user, out error), error?.Message);
- Assert.AreEqual(0, modules.Count, "After undoing it seems that a module has survived.");
- Assert.AreEqual(0, links.Count, "The link was not removed on undo.");
+ Assert.IsEmpty(modules, "After undoing it seems that a module has survived.");
+ Assert.IsEmpty(links, "The link was not removed on undo.");
Assert.IsTrue(msSession.Redo(user, out error), error?.Message);
- Assert.AreEqual(2, modules.Count, "After redoing it seems that a module was not restored.");
- Assert.AreEqual(1, links.Count, "The link was not re-added on redo.");
+ Assert.HasCount(2, modules, "After redoing it seems that a module was not restored.");
+ Assert.HasCount(1, links, "The link was not re-added on redo.");
});
}
@@ -370,11 +370,11 @@ public void RemoveNodeWithParameterGeneration()
typeof(SimpleParameterModule), Rectangle.Hidden, out var node, out var children, out error), error?.Message);
// Test to make sure that there was a second module also added.
Assert.IsNotNull(children, "The child parameters of the node were returned as a null!");
- Assert.AreEqual(1, children.Count);
+ Assert.HasCount(1, children);
var modules = gBound.Modules;
var links = gBound.Links;
- Assert.AreEqual(2, modules.Count, "It seems that the child parameter was not contained in the global boundary.");
- Assert.AreEqual(1, links.Count, "We did not have a link!");
+ Assert.HasCount(2, modules, "It seems that the child parameter was not contained in the global boundary.");
+ Assert.HasCount(1, links, "We did not have a link!");
// Find the automatically added basic parameter and make sure that it has the correct default value
bool found = false;
for (int i = 0; i < modules.Count; i++)
@@ -392,12 +392,12 @@ public void RemoveNodeWithParameterGeneration()
Assert.IsTrue(msSession.RemoveNodeGenerateParameters(user, node, out error), error?.Message);
// Make sure that both modules were deleted
- Assert.AreEqual(0, modules.Count, "Both modules were not removed.");
+ Assert.IsEmpty(modules, "Both modules were not removed.");
Assert.IsTrue(msSession.Undo(user, out error), error?.Message);
- Assert.AreEqual(2, modules.Count, "Both modules were not re-added.");
+ Assert.HasCount(2, modules, "Both modules were not re-added.");
Assert.IsTrue(msSession.Redo(user, out error), error?.Message);
- Assert.AreEqual(0, modules.Count, "Both modules were not removed again.");
+ Assert.IsEmpty(modules, "Both modules were not removed again.");
});
}
@@ -416,11 +416,11 @@ public void RemoveNodeWithParameterGenerationWithBadUser()
typeof(SimpleParameterModule), Rectangle.Hidden, out var node, out var children, out error), error?.Message);
// Test to make sure that there was a second module also added.
Assert.IsNotNull(children, "The child parameters of the node were returned as a null!");
- Assert.AreEqual(1, children.Count);
+ Assert.HasCount(1, children);
var modules = gBound.Modules;
var links = gBound.Links;
- Assert.AreEqual(2, modules.Count, "It seems that the child parameter was not contained in the global boundary.");
- Assert.AreEqual(1, links.Count, "We did not have a link!");
+ Assert.HasCount(2, modules, "It seems that the child parameter was not contained in the global boundary.");
+ Assert.HasCount(1, links, "We did not have a link!");
// Find the automatically added basic parameter and make sure that it has the correct default value
bool found = false;
for (int i = 0; i < modules.Count; i++)
@@ -435,8 +435,8 @@ public void RemoveNodeWithParameterGenerationWithBadUser()
}
Assert.IsTrue(found, "We did not find the automatically created parameter module!");
Assert.IsFalse(msSession.RemoveNodeGenerateParameters(unauthorizedUser, node, out error), error?.Message);
- Assert.AreEqual(2, modules.Count, "The number of modules changed after an invalid user invoked RemoveNodeGenerateParameters.");
- Assert.AreEqual(1, links.Count, "The number of links changed after an invalid user invoked RemoveNodeGenerateParameters!");
+ Assert.HasCount(2, modules, "The number of modules changed after an invalid user invoked RemoveNodeGenerateParameters.");
+ Assert.HasCount(1, links, "The number of links changed after an invalid user invoked RemoveNodeGenerateParameters!");
});
}
@@ -459,22 +459,22 @@ public void RemoveNodeWithParameterGenerationNotRemovingIfMultiple()
typeof(SimpleParameterModule), Rectangle.Hidden, out var node2, out error), error?.Message);
// Test to make sure that there was a second module also added.
Assert.IsNotNull(children, "The child parameters of the node were returned as a null!");
- Assert.AreEqual(1, children.Count);
+ Assert.HasCount(1, children);
var modules = gBound.Modules;
var links = gBound.Links;
- Assert.AreEqual(1, links.Count);
- Assert.AreEqual(3, modules.Count);
+ Assert.HasCount(1, links);
+ Assert.HasCount(3, modules);
Assert.IsTrue(msSession.AddLink(user, node2, node2.Hooks[0], children[0], out var node2Link, out error), error?.Message);
- Assert.AreEqual(2, links.Count, "The second link was not added");
+ Assert.HasCount(2, links, "The second link was not added");
Assert.IsTrue(msSession.RemoveNodeGenerateParameters(user, node, out error), error?.Message);
- Assert.AreEqual(1, links.Count);
- Assert.AreEqual(2, modules.Count);
+ Assert.HasCount(1, links);
+ Assert.HasCount(2, modules);
Assert.IsTrue(msSession.Undo(user, out error), error?.Message);
- Assert.AreEqual(2, links.Count);
- Assert.AreEqual(3, modules.Count);
+ Assert.HasCount(2, links);
+ Assert.HasCount(3, modules);
Assert.IsTrue(msSession.Redo(user, out error), error?.Message);
- Assert.AreEqual(1, links.Count);
- Assert.AreEqual(2, modules.Count);
+ Assert.HasCount(1, links);
+ Assert.HasCount(2, modules);
});
}
@@ -546,7 +546,7 @@ public void DisablingNode()
// after shutdown
var ms = mSession.ModelSystem;
var modules = ms.GlobalBoundary.Modules;
- Assert.AreEqual(1, modules.Count);
+ Assert.HasCount(1, modules);
Assert.IsTrue(modules[0].IsDisabled, "The module was not disabled after reloading the model system!");
});
}
diff --git a/tests/XTMF2.UnitTests/ModelSystemConstruct/Parameters/Compiler/TestVariables.cs b/tests/XTMF2.UnitTests/ModelSystemConstruct/Parameters/Compiler/TestVariables.cs
index 573867e..59c850b 100644
--- a/tests/XTMF2.UnitTests/ModelSystemConstruct/Parameters/Compiler/TestVariables.cs
+++ b/tests/XTMF2.UnitTests/ModelSystemConstruct/Parameters/Compiler/TestVariables.cs
@@ -44,7 +44,7 @@ public void TestBooleanVariable()
Assert.IsTrue(ParameterCompiler.Evaluate(null, expression, out var result, ref error), error);
if (result is bool boolResult)
{
- Assert.AreEqual(true, boolResult);
+ Assert.IsTrue(boolResult);
}
else
{
diff --git a/tests/XTMF2.UnitTests/TestModelSystem.cs b/tests/XTMF2.UnitTests/TestModelSystem.cs
index ab70fc5..293aee7 100644
--- a/tests/XTMF2.UnitTests/TestModelSystem.cs
+++ b/tests/XTMF2.UnitTests/TestModelSystem.cs
@@ -60,7 +60,7 @@ public void ModelSystemPersistance()
Assert.IsTrue(projectController.GetProjectSession(user, user.AvailableProjects[0], out session, out error).UsingIf(session, () =>
{
var modelSystems = session.ModelSystems;
- Assert.AreEqual(1, modelSystems.Count);
+ Assert.HasCount(1, modelSystems);
Assert.AreEqual(modelSystemName, modelSystems[0].Name);
}), error?.Message);
//cleanup
@@ -193,7 +193,7 @@ public void ModelSystemSavedWithStartOnly()
// after shutdown
var ms = mSession.ModelSystem;
CommandError error = null;
- Assert.AreEqual(1, ms.GlobalBoundary.Starts.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Starts);
// we shouldn't be able to add another start with the same name in the same boundary
Assert.IsFalse(mSession.AddModelSystemStart(user, ms.GlobalBoundary, "FirstStart", Rectangle.Hidden, out var start, out error), error?.Message);
});
@@ -213,7 +213,7 @@ public void ModelSystemSavedWithNodeOnly()
{
// after shutdown
var ms = mSession.ModelSystem;
- Assert.AreEqual(1, ms.GlobalBoundary.Modules.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Modules);
});
}
@@ -233,8 +233,8 @@ public void ModelSystemSavedWithStartAndNode()
// after shutdown
CommandError error = null;
var ms = mSession.ModelSystem;
- Assert.AreEqual(1, ms.GlobalBoundary.Starts.Count);
- Assert.AreEqual(1, ms.GlobalBoundary.Modules.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Starts);
+ Assert.HasCount(1, ms.GlobalBoundary.Modules);
Assert.IsFalse(mSession.AddModelSystemStart(user, ms.GlobalBoundary, "FirstStart", Rectangle.Hidden, out var start, out error), error?.Message);
});
}
@@ -256,9 +256,9 @@ public void ModelSystemWithLink()
// after shutdown
CommandError error = null;
var ms = mSession.ModelSystem;
- Assert.AreEqual(1, ms.GlobalBoundary.Starts.Count);
- Assert.AreEqual(1, ms.GlobalBoundary.Modules.Count);
- Assert.AreEqual(1, ms.GlobalBoundary.Links.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Starts);
+ Assert.HasCount(1, ms.GlobalBoundary.Modules);
+ Assert.HasCount(1, ms.GlobalBoundary.Links);
Assert.IsFalse(mSession.AddModelSystemStart(user, ms.GlobalBoundary, "FirstStart", Rectangle.Hidden,
out var start, out error), error?.Message);
});
@@ -304,9 +304,9 @@ public void ModelSystemWithMultiLink()
// after shutdown
CommandError error = null;
var ms = mSession.ModelSystem;
- Assert.AreEqual(1, ms.GlobalBoundary.Starts.Count);
- Assert.AreEqual(5, ms.GlobalBoundary.Modules.Count);
- Assert.AreEqual(5, ms.GlobalBoundary.Links.Count);
+ Assert.HasCount(1, ms.GlobalBoundary.Starts);
+ Assert.HasCount(5, ms.GlobalBoundary.Modules);
+ Assert.HasCount(5, ms.GlobalBoundary.Links);
Assert.IsFalse(mSession.AddModelSystemStart(user, ms.GlobalBoundary, "FirstStart", Rectangle.Hidden,
out var start, out error), error?.Message);
});
@@ -401,11 +401,11 @@ public void ExportModelSystemMetaData()
using (var entryStream = entry.Open())
{
buffer = new byte[entry.Length];
- entryStream.Read(buffer, 0, buffer.Length);
+ entryStream.ReadExactly(buffer, 0, buffer.Length);
}
var reader = new Utf8JsonReader(buffer);
Assert.IsTrue(reader.Read(), "Unable to read the initial object.");
- Assert.IsTrue(reader.TokenType == JsonTokenType.StartObject, "The first element was not a start object");
+ Assert.AreEqual(JsonTokenType.StartObject, reader.TokenType, "The first element was not a start object");
bool readName = false, readDescription = false, readExportedOn = false, readExportedBy = false,
readVersionMajor = false, readVersionMinor = false;
while (reader.Read())
diff --git a/tests/XTMF2.UnitTests/TestProjects.cs b/tests/XTMF2.UnitTests/TestProjects.cs
index 4d1563a..c7aa38b 100644
--- a/tests/XTMF2.UnitTests/TestProjects.cs
+++ b/tests/XTMF2.UnitTests/TestProjects.cs
@@ -117,7 +117,7 @@ public void ProjectPersistance()
runtime = XTMFRuntime.CreateRuntime();
controller = runtime.ProjectController;
localUser = TestHelper.GetTestUser(runtime);
- Assert.AreEqual(numberOfProjects, localUser.AvailableProjects.Count);
+ Assert.HasCount(numberOfProjects, localUser.AvailableProjects);
var regainedProject = localUser.AvailableProjects[0];
Assert.AreEqual(projectName, regainedProject.Name);
}
@@ -320,7 +320,7 @@ public void ImportProjectFileNoModelSystem()
using (importedSession)
{
var modelSystems = importedSession.ModelSystems;
- Assert.AreEqual(0, modelSystems.Count);
+ Assert.IsEmpty(modelSystems);
}
}
finally
@@ -358,7 +358,7 @@ public void ImportProjectFileSingleModelSystem()
using (importedSession)
{
var modelSystems = importedSession.ModelSystems;
- Assert.AreEqual(1, modelSystems.Count);
+ Assert.HasCount(1, modelSystems);
}
}
finally
@@ -400,7 +400,7 @@ public void ImportProjectFileMultipleModelSystem()
using (importedSession)
{
var modelSystems = importedSession.ModelSystems;
- Assert.AreEqual(numberOfModelSystems, modelSystems.Count);
+ Assert.HasCount(numberOfModelSystems, modelSystems);
}
}
finally
@@ -440,7 +440,7 @@ public void ImportProjectFileAddedToController()
using (importedSession)
{
var modelSystems = importedSession.ModelSystems;
- Assert.AreEqual(0, modelSystems.Count);
+ Assert.IsEmpty(modelSystems);
}
Assert.IsTrue(user.AvailableProjects.Any(p => p.Name == ImportedModelSystemName), "The imported project was not available to use user.");
}
@@ -542,9 +542,9 @@ public void AddAdditionalPastRunDirectory()
string path = Path.GetTempPath();
CommandError error = null;
var previousRunDirectories = project.AdditionalPreviousRunDirectories;
- Assert.AreEqual(0, previousRunDirectories.Count, "There were already previous run directories!");
+ Assert.IsEmpty(previousRunDirectories, "There were already previous run directories!");
Assert.IsTrue(project.AddAdditionalPastRunDirectory(user, path, out error), error?.Message ?? "Failed to have an error message!");
- Assert.AreEqual(1, previousRunDirectories.Count, "The previous runs did not include the new path!");
+ Assert.HasCount(1, previousRunDirectories, "The previous runs did not include the new path!");
Assert.AreEqual(path, previousRunDirectories[0], "The path is not the same!");
});
}
@@ -555,10 +555,10 @@ public void AddAdditionalPastRunDirectory_Null()
TestHelper.RunInProjectContext("AddAdditionalPastRunDirectory_Null", (User user, ProjectSession project) =>
{
var previousRunDirectories = project.AdditionalPreviousRunDirectories;
- Assert.AreEqual(0, previousRunDirectories.Count, "There were already previous run directories!");
+ Assert.IsEmpty(previousRunDirectories, "There were already previous run directories!");
Assert.IsFalse(project.AddAdditionalPastRunDirectory(user, null, out CommandError error),
"The add operation succeeded even though it should have failed!");
- Assert.AreEqual(0, previousRunDirectories.Count, "The invalid previous run directory was added!");
+ Assert.IsEmpty(previousRunDirectories, "The invalid previous run directory was added!");
});
}
@@ -568,10 +568,10 @@ public void AddAdditionalPastRunDirectory_EmptyString()
TestHelper.RunInProjectContext("AddAdditionalPastRunDirectory_EmptyString", (User user, ProjectSession project) =>
{
var previousRunDirectories = project.AdditionalPreviousRunDirectories;
- Assert.AreEqual(0, previousRunDirectories.Count, "There were already previous run directories!");
+ Assert.IsEmpty(previousRunDirectories, "There were already previous run directories!");
Assert.IsFalse(project.AddAdditionalPastRunDirectory(user, String.Empty, out CommandError error),
"The add operation succeeded even though it should have failed!");
- Assert.AreEqual(0, previousRunDirectories.Count, "The invalid previous run directory was added!");
+ Assert.IsEmpty(previousRunDirectories, "The invalid previous run directory was added!");
});
}
@@ -583,12 +583,12 @@ public void RemoveAdditionalPastRunDirectory()
string path = Path.GetTempPath();
CommandError error = null;
var previousRunDirectories = project.AdditionalPreviousRunDirectories;
- Assert.AreEqual(0, previousRunDirectories.Count, "There were already previous run directories!");
+ Assert.IsEmpty(previousRunDirectories, "There were already previous run directories!");
Assert.IsTrue(project.AddAdditionalPastRunDirectory(user, path, out error), error?.Message ?? "Failed to have an error message!");
- Assert.AreEqual(1, previousRunDirectories.Count, "The previous runs did not include the new path!");
+ Assert.HasCount(1, previousRunDirectories, "The previous runs did not include the new path!");
Assert.AreEqual(path, previousRunDirectories[0], "The path is not the same!");
Assert.IsTrue(project.RemoveAdditionalPastRunDirectory(user, path, out error), error?.Message ?? "Failed to have an error message!");
- Assert.AreEqual(0, previousRunDirectories.Count, "The previous run directory was not removed!");
+ Assert.IsEmpty(previousRunDirectories, "The previous run directory was not removed!");
});
}
@@ -600,11 +600,11 @@ public void RemoveAdditionalPastRunDirectory_Null()
string path = Path.GetTempPath();
CommandError error = null;
var previousRunDirectories = project.AdditionalPreviousRunDirectories;
- Assert.AreEqual(0, previousRunDirectories.Count, "There were already previous run directories!");
+ Assert.IsEmpty(previousRunDirectories, "There were already previous run directories!");
Assert.IsTrue(project.AddAdditionalPastRunDirectory(user, path, out error), error?.Message ?? "Failed to have an error message!");
Assert.IsFalse(project.RemoveAdditionalPastRunDirectory(user, null, out error),
"The remove operation succeeded even though it should have failed!");
- Assert.AreEqual(1, previousRunDirectories.Count, "The previous run directory was removed!");
+ Assert.HasCount(1, previousRunDirectories, "The previous run directory was removed!");
});
}
@@ -616,11 +616,11 @@ public void RemoveAdditionalPastRunDirectory_EmptyString()
string path = Path.GetTempPath();
CommandError error = null;
var previousRunDirectories = project.AdditionalPreviousRunDirectories;
- Assert.AreEqual(0, previousRunDirectories.Count, "There were already previous run directories!");
+ Assert.IsEmpty(previousRunDirectories, "There were already previous run directories!");
Assert.IsTrue(project.AddAdditionalPastRunDirectory(user, path, out error), error?.Message ?? "Failed to have an error message!");
Assert.IsFalse(project.RemoveAdditionalPastRunDirectory(user, String.Empty, out error),
"The remove operation succeeded even though it should have failed!");
- Assert.AreEqual(1, previousRunDirectories.Count, "The previous run directory was removed!");
+ Assert.HasCount(1, previousRunDirectories, "The previous run directory was removed!");
});
}
@@ -632,11 +632,11 @@ public void RemoveAdditionalPastRunDirectory_NonExistent()
string path = Path.GetTempPath();
CommandError error = null;
var previousRunDirectories = project.AdditionalPreviousRunDirectories;
- Assert.AreEqual(0, previousRunDirectories.Count, "There were already previous run directories!");
+ Assert.IsEmpty(previousRunDirectories, "There were already previous run directories!");
Assert.IsTrue(project.AddAdditionalPastRunDirectory(user, path, out error), error?.Message ?? "Failed to have an error message!");
Assert.IsFalse(project.RemoveAdditionalPastRunDirectory(user, path + "a", out error),
"The remove operation succeeded even though it should have failed!");
- Assert.AreEqual(1, previousRunDirectories.Count, "The previous run directory was removed!");
+ Assert.HasCount(1, previousRunDirectories, "The previous run directory was removed!");
});
}
@@ -649,14 +649,14 @@ public void AdditionalRunDirectoryPersistance()
{
CommandError error = null;
var previousRunDirectories = project.AdditionalPreviousRunDirectories;
- Assert.AreEqual(0, previousRunDirectories.Count, "There were already previous run directories!");
+ Assert.IsEmpty(previousRunDirectories, "There were already previous run directories!");
Assert.IsTrue(project.AddAdditionalPastRunDirectory(user, path, out error), error?.Message ?? "Failed to have an error message!");
- Assert.AreEqual(1, previousRunDirectories.Count, "The previous runs did not include the new path!");
+ Assert.HasCount(1, previousRunDirectories, "The previous runs did not include the new path!");
Assert.AreEqual(path, previousRunDirectories[0], "The path is not the same!");
}, (user, project) =>
{
var previousRunDirectories = project.AdditionalPreviousRunDirectories;
- Assert.AreEqual(1, previousRunDirectories.Count, "The number of past run directories is wrong after reloading!");
+ Assert.HasCount(1, previousRunDirectories, "The number of past run directories is wrong after reloading!");
Assert.AreEqual(path, previousRunDirectories[0], "The path is not the same after reloading!");
});
}
diff --git a/tests/XTMF2.UnitTests/TestUsers.cs b/tests/XTMF2.UnitTests/TestUsers.cs
index ebfc7a3..e0b4b62 100644
--- a/tests/XTMF2.UnitTests/TestUsers.cs
+++ b/tests/XTMF2.UnitTests/TestUsers.cs
@@ -105,20 +105,20 @@ public void AddUserToProject()
Assert.IsTrue(projectController.CreateNewProject(user2, projectName2, out var session2, out error), error?.Message);
// make sure we only have 1 project
- Assert.AreEqual(1, user1.AvailableProjects.Count);
- Assert.AreEqual(1, user2.AvailableProjects.Count);
+ Assert.HasCount(1, user1.AvailableProjects);
+ Assert.HasCount(1, user2.AvailableProjects);
// Share project1 with user1
Assert.IsTrue(session1.ShareWith(user1, user2, out error), error?.Message);
- Assert.AreEqual(1, user1.AvailableProjects.Count);
- Assert.AreEqual(2, user2.AvailableProjects.Count);
+ Assert.HasCount(1, user1.AvailableProjects);
+ Assert.HasCount(2, user2.AvailableProjects);
Assert.IsFalse(session1.ShareWith(user1, user2, out error), error?.Message);
Assert.IsFalse(session1.ShareWith(user2, user2, out error), error?.Message);
// Delete user1 and make sure that user2 loses reference to project1
Assert.IsTrue(userController.Delete(user1));
- Assert.AreEqual(1, user2.AvailableProjects.Count);
+ Assert.HasCount(1, user2.AvailableProjects);
// finish cleaning up
Assert.IsTrue(userController.Delete(user2));
@@ -144,19 +144,19 @@ public void AddUserToProjectTwice()
Assert.IsTrue(projectController.CreateNewProject(user1, projectName1, out var session1, out error), error?.Message);
// make sure we only have 1 project
- Assert.AreEqual(1, user1.AvailableProjects.Count);
- Assert.AreEqual(0, user2.AvailableProjects.Count);
+ Assert.HasCount(1, user1.AvailableProjects);
+ Assert.IsEmpty(user2.AvailableProjects);
Assert.IsTrue(session1.ShareWith(user1, user2, out error));
- Assert.AreEqual(1, user2.AvailableProjects.Count);
+ Assert.HasCount(1, user2.AvailableProjects);
// Ensure that the command fails to be added the second time
Assert.IsFalse(session1.ShareWith(user1, user2, out error));
- Assert.AreEqual(1, user2.AvailableProjects.Count);
+ Assert.HasCount(1, user2.AvailableProjects);
// Delete user1 and make sure that user2 loses reference to project1
Assert.IsTrue(userController.Delete(user1));
- Assert.AreEqual(0, user2.AvailableProjects.Count);
+ Assert.IsEmpty(user2.AvailableProjects);
// finish cleaning up
Assert.IsTrue(userController.Delete(user2));
@@ -184,13 +184,13 @@ public void RemoveUserFromProject()
Assert.IsTrue(projectController.CreateNewProject(user2, projectName2, out var session2, out error), error?.Message);
// make sure we only have 1 project
- Assert.AreEqual(1, user1.AvailableProjects.Count);
- Assert.AreEqual(1, user2.AvailableProjects.Count);
+ Assert.HasCount(1, user1.AvailableProjects);
+ Assert.HasCount(1, user2.AvailableProjects);
// Share project1 with user1
Assert.IsTrue(session1.ShareWith(user1, user2, out error), error?.Message);
- Assert.AreEqual(1, user1.AvailableProjects.Count);
- Assert.AreEqual(2, user2.AvailableProjects.Count);
+ Assert.HasCount(1, user1.AvailableProjects);
+ Assert.HasCount(2, user2.AvailableProjects);
Assert.IsFalse(session1.ShareWith(user1, user2, out error), error?.Message);
Assert.IsFalse(session1.ShareWith(user2, user2, out error), error?.Message);
@@ -199,12 +199,12 @@ public void RemoveUserFromProject()
Assert.IsFalse(session1.RestrictAccess(user2, user1, out error));
Assert.IsTrue(session1.RestrictAccess(user1, user2, out error), error?.Message);
- Assert.AreEqual(1, user1.AvailableProjects.Count);
- Assert.AreEqual(1, user2.AvailableProjects.Count);
+ Assert.HasCount(1, user1.AvailableProjects);
+ Assert.HasCount(1, user2.AvailableProjects);
// Delete user1 and make sure that user2 loses reference to project1
Assert.IsTrue(userController.Delete(user1));
- Assert.AreEqual(1, user2.AvailableProjects.Count);
+ Assert.HasCount(1, user2.AvailableProjects);
// finish cleaning up
Assert.IsTrue(userController.Delete(user2));
@@ -232,13 +232,13 @@ public void RemoveUserFromProjectTwice()
Assert.IsTrue(projectController.CreateNewProject(user2, projectName2, out var session2, out error), error?.Message);
// make sure we only have 1 project
- Assert.AreEqual(1, user1.AvailableProjects.Count);
- Assert.AreEqual(1, user2.AvailableProjects.Count);
+ Assert.HasCount(1, user1.AvailableProjects);
+ Assert.HasCount(1, user2.AvailableProjects);
// Share project1 with user1
Assert.IsTrue(session1.ShareWith(user1, user2, out error), error?.Message);
- Assert.AreEqual(1, user1.AvailableProjects.Count);
- Assert.AreEqual(2, user2.AvailableProjects.Count);
+ Assert.HasCount(1, user1.AvailableProjects);
+ Assert.HasCount(2, user2.AvailableProjects);
Assert.IsFalse(session1.ShareWith(user1, user2, out error), error?.Message);
Assert.IsFalse(session1.ShareWith(user2, user2, out error), error?.Message);
@@ -249,12 +249,12 @@ public void RemoveUserFromProjectTwice()
// Ensure that we can't do it again
Assert.IsFalse(session1.RestrictAccess(user1, user2, out error), error?.Message);
- Assert.AreEqual(1, user1.AvailableProjects.Count);
- Assert.AreEqual(1, user2.AvailableProjects.Count);
+ Assert.HasCount(1, user1.AvailableProjects);
+ Assert.HasCount(1, user2.AvailableProjects);
// Delete user1 and make sure that user2 loses reference to project1
Assert.IsTrue(userController.Delete(user1));
- Assert.AreEqual(1, user2.AvailableProjects.Count);
+ Assert.HasCount(1, user2.AvailableProjects);
// finish cleaning up
Assert.IsTrue(userController.Delete(user2));
@@ -279,18 +279,18 @@ public void SwitchOwner()
Assert.IsTrue(projectController.CreateNewProject(user1, projectName1, out var session1, out error), error?.Message);
- Assert.AreEqual(1, user1.AvailableProjects.Count);
- Assert.AreEqual(0, user2.AvailableProjects.Count);
+ Assert.HasCount(1, user1.AvailableProjects);
+ Assert.IsEmpty(user2.AvailableProjects);
Assert.IsTrue(session1.SwitchOwner(user1, user2, out error), error?.Message);
Assert.IsFalse(session1.SwitchOwner(user1, user2, out error));
- Assert.AreEqual(0, user1.AvailableProjects.Count);
- Assert.AreEqual(1, user2.AvailableProjects.Count);
+ Assert.IsEmpty(user1.AvailableProjects);
+ Assert.HasCount(1, user2.AvailableProjects);
Assert.IsTrue(userController.Delete(user1));
- Assert.AreEqual(1, user2.AvailableProjects.Count);
+ Assert.HasCount(1, user2.AvailableProjects);
Assert.IsTrue(userController.Delete(user2));
}
diff --git a/tests/XTMF2.UnitTests/TestXTMFRuntime.cs b/tests/XTMF2.UnitTests/TestXTMFRuntime.cs
index 9b0bad0..be72d97 100644
--- a/tests/XTMF2.UnitTests/TestXTMFRuntime.cs
+++ b/tests/XTMF2.UnitTests/TestXTMFRuntime.cs
@@ -43,7 +43,7 @@ public void GetUserData()
{
XTMFRuntime runtime = XTMFRuntime.CreateRuntime();
var users = runtime.UserController.Users;
- Assert.IsTrue(users.Count > 0);
+ Assert.IsNotEmpty(users);
}
[TestMethod]
diff --git a/tests/XTMF2.UnitTests/XTMF2.UnitTests.csproj b/tests/XTMF2.UnitTests/XTMF2.UnitTests.csproj
index 9369da3..5b1e733 100644
--- a/tests/XTMF2.UnitTests/XTMF2.UnitTests.csproj
+++ b/tests/XTMF2.UnitTests/XTMF2.UnitTests.csproj
@@ -1,7 +1,7 @@
- net8.0
+ net10.0
XTMF2.UnitTests
@@ -21,9 +21,9 @@
-
-
-
+
+
+
diff --git a/tests/XTMF2.UnitTests/assembly.cs b/tests/XTMF2.UnitTests/assembly.cs
new file mode 100644
index 0000000..844265a
--- /dev/null
+++ b/tests/XTMF2.UnitTests/assembly.cs
@@ -0,0 +1,21 @@
+/*
+ Copyright 2025 University of Toronto
+
+ This file is part of XTMF2.
+
+ XTMF2 is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ XTMF2 is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with XTMF2. If not, see .
+*/
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+[assembly: DoNotParallelize]
\ No newline at end of file