-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
test/TwinGet.AutomationInterface.Test/Utils/TwincatUtilsTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// This file is licensed to you under MIT license. | ||
|
||
using TwinGet.AutomationInterface.Test.TestUtils; | ||
using TwinGet.AutomationInterface.Utils; | ||
|
||
namespace TwinGet.AutomationInterface.Test.Utils | ||
{ | ||
public class TwincatUtilsTests | ||
{ | ||
[Fact] | ||
public void GetParentTwincatProject_ShouldSucceed() | ||
{ | ||
using TestProject testProject = new TestProject(); | ||
TestTwincatProject? testTcProject = null; | ||
TestPlcProject? testPlcProject = null; | ||
|
||
// Find a test TwinCAT project that has at least one PLC project. | ||
foreach (TestTwincatProject tcProj in testProject.TwincatProjects) | ||
{ | ||
if (tcProj.PlcProjects.Count > 0) | ||
{ | ||
testTcProject = tcProj; | ||
testPlcProject = tcProj.PlcProjects.First(); | ||
} | ||
} | ||
|
||
testTcProject.Should().NotBeNull(); | ||
|
||
string actual = TwincatUtils.GetParentTwincatProject(testPlcProject.AbsolutePath); | ||
string expected = testTcProject.AbsolutePath; | ||
|
||
expected.Should().NotBeNullOrEmpty(); | ||
expected.Should().Be(actual); | ||
} | ||
} | ||
} |