Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MobiFlight/Execution/ConfigItemExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ private string ExecuteDisplay(string value, OutputConfigItem cfg)
// throw new MidiBoardNotConnectedException(i18n._tr($"{midiBoardName} not connected"));
}
}
else if (serial.IndexOf("SN") != 0 && cfg.DeviceType != "InputAction")
else if (SerialNumber.IsArcazeSerial(serial) && cfg.DeviceType != "InputAction")
{
#if ARCAZE
switch (cfg.DeviceType)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,5 +369,35 @@ public void Execute_ShouldNotThrowException_WhenExecuteDisplayFails()
Assert.AreEqual("ExecutionError", cfg.Status[ConfigItemStatusType.Device], "Error status should indicate execution error");
Assert.IsTrue(updatedValues.ContainsKey(cfg.GUID), "Config item should be added to updated values");
}

[TestMethod]
public void Execute_ShouldNotThrowException_WhenControllerIsNullAndInputAction()
{
// Arrange
var variable = new MobiFlightVariable() { Name = "TestVar", Number = 100, Expression = "@ * 2" };
// Mock the variable source to return a value
mockMobiFlightCache.Setup(m => m.GetMobiFlightVariable(It.IsAny<string>())).Returns(variable);

var cfg = new OutputConfigItem
{
GUID = Guid.NewGuid().ToString(),
Active = true,
Name = "Test Config without Controller",
Controller = null,
DeviceType = "InputAction",
Source = new VariableSource() { MobiFlightVariable = variable },
AnalogInputConfig = new AnalogInputConfig {
onChange = new VariableInputAction { Variable = variable }
}
};

var updatedValues = new ConcurrentDictionary<string, IConfigItem>();

// Act
executor.Execute(cfg, updatedValues);

// Assert
Assert.HasCount(0, cfg.Status.Keys, "Config should not have any errors");
}
}
}