36 lines
1.6 KiB
C#
36 lines
1.6 KiB
C#
namespace BenchtopParserTests {
|
|
public class I28_Program_Config_Tests {
|
|
[SetUp]
|
|
public void Setup() {
|
|
}
|
|
|
|
[Test]
|
|
public void Test_ProgramConfig() {
|
|
String program_config = File.ReadAllText(
|
|
Path.Combine(TestContext.CurrentContext.TestDirectory, @"TestFiles\Program Config.txt")
|
|
);
|
|
var configs = BenchtopParser.I28.Load_ProgramConfig(program_config);
|
|
Assert.IsNotNull(configs);
|
|
|
|
// Check that group collecting works -
|
|
Assert.That(configs["P1"].Group["I"]["3"].value, Is.EqualTo("Unassigned"));
|
|
Assert.That(configs["P1"].Group["O"]["3"].value, Is.EqualTo("Test Passed"));
|
|
|
|
Assert.That(configs["P1"].Group["P"]["Minimum Pressure"].value, Is.EqualTo("95.000"));
|
|
Assert.That(configs["P1"].Group["P"]["Minimum Pressure"].unit, Is.EqualTo("mbar"));
|
|
Assert.That(configs["P1"].Group["P"]["Minimum Pressure"].type, Is.EqualTo("f"));
|
|
}
|
|
|
|
[Test]
|
|
public void Test_ProgramConfig_Throw_ErrorOrder() {
|
|
Exception ex = Assert.Throws<Exception>(delegate { BenchtopParser.I28.Load_ProgramConfig("EBAE006 L 1,P1"); });
|
|
Assert.That(ex.Message, Is.EqualTo("Setting Program Number Before Start. Error In Config"));
|
|
}
|
|
|
|
[Test]
|
|
public void Test_ProgramConfig_Throw_InvalidProgram() {
|
|
Exception ex = Assert.Throws<Exception>(delegate { BenchtopParser.I28.Load_ProgramConfig("broken"); });
|
|
Assert.That(ex.Message, Is.EqualTo("Invalid Program Config, please provide an I28 Program Config file data"));
|
|
}
|
|
}
|
|
} |