Skip to content

Commit

Permalink
update helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
Scretch9 committed Nov 30, 2023
1 parent 91b22ea commit 88ec3c4
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/FieldElementSubsystems.Test/Point/PointTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,17 @@ namespace FieldElementSubsystems.Test;

public class PointTest
{
private EulynxLive.Point.Point CreateDefaultPoint(IPointToInterlockingConnection? connection = null) =>
new EulynxLive.Point.Point(_logger, _configuration, connection ?? Mock.Of<IPointToInterlockingConnection>(), async () => {});
private EulynxLive.Point.Point CreateDefaultPoint(IPointToInterlockingConnection? connection = null, IDictionary<string, string>? overwriteConfig= null) {
var config = _configuration;
if (overwriteConfig != null)
{
foreach (var (key, value) in overwriteConfig)
{
config[key] = value;
}
}
return new EulynxLive.Point.Point(_logger, config, connection ?? Mock.Of<IPointToInterlockingConnection>(), async () => {});
}

private Mock<IPointToInterlockingConnection> CreateDefaultMockConnection() {
var mockConnection = new Mock<IPointToInterlockingConnection>();
Expand Down Expand Up @@ -39,7 +48,7 @@ private Mock<IPointToInterlockingConnection> CreateDefaultMockConnection() {
[Fact]
public void Test_Parse_Configuration()
{
var point = CreateDefaultPoint();
var point = CreateDefaultPoint(null, new Dictionary<string, string>() {{"PointSettings:AllPointMachinesCrucial", "true" }});

Assert.True(point.AllPointMachinesCrucial);
}
Expand Down

0 comments on commit 88ec3c4

Please sign in to comment.