From e071fdb09ce0b45a61a59cc8796cdc1283413890 Mon Sep 17 00:00:00 2001 From: Tyrel Souza Date: Tue, 26 Jul 2022 00:27:58 -0400 Subject: [PATCH] cleanup ProgramConfig Load --- BenchtopParser/I28.cs | 10 ++++++---- BenchtopParserTests/I28_Program_Config_Tests.cs | 4 ++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/BenchtopParser/I28.cs b/BenchtopParser/I28.cs index c26cc2f..90fb1c5 100644 --- a/BenchtopParser/I28.cs +++ b/BenchtopParser/I28.cs @@ -47,11 +47,13 @@ namespace BenchtopParser { if (data.StartsWith("=")) { continue; /* comment line */ } var lineConfig = new Configuration(); - lineConfig.unit = configLine[1]; - lineConfig.type = configLine[2]; //a, c, f, i var nameValue = data.Split("="); - lineConfig.name = nameValue[0]; - lineConfig.value = nameValue[1]; + + lineConfig.unit = configLine[1].Trim(); + lineConfig.type = configLine[2].Trim(); //a, c, f, i + + lineConfig.name = nameValue[0].Trim(); + lineConfig.value = nameValue[1].Trim(); // Deal with this group logic var group = programnumber_group_data[1]; diff --git a/BenchtopParserTests/I28_Program_Config_Tests.cs b/BenchtopParserTests/I28_Program_Config_Tests.cs index 81e7439..62de029 100644 --- a/BenchtopParserTests/I28_Program_Config_Tests.cs +++ b/BenchtopParserTests/I28_Program_Config_Tests.cs @@ -15,6 +15,10 @@ namespace BenchtopParserTests { // 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]