namespace BenchtopParserTests { public class HardwareCalibrationReport_Tests { public String HardwareCalibrationReportValue; [SetUp] public void Setup() { HardwareCalibrationReportValue = File.ReadAllText( Path.Combine(TestContext.CurrentContext.TestDirectory, @"TestFiles\Hardware Calibration Report.txt") ); } [Test] public void Test_HardwareCalibrationReport() { BenchtopParser.HardwareCalibrationReport tv = new(HardwareCalibrationReportValue); Assert.That(tv.Transducers[1].Id, Is.EqualTo(1)); Assert.That(tv.Transducers[1].Name, Is.EqualTo("CTS D34-442 115PSIA")); } [Test] public void Test_HardwareCalibrationReport_Throw_InvalidProgram() { Exception ex = Assert.Throws(delegate { new BenchtopParser.HardwareCalibrationReport("broken"); }); Assert.That(ex.Message, Is.EqualTo("Invalid Transducer Verify Report, please provide a Transducer Verify Report file data")); } [Test] public void Test_HardwareCalibrationReport_SetIndent() { BenchtopParser.HardwareCalibrationReport tv = new(); tv.SetIndent(" Transducer Custom"); Assert.That(tv.Indent, Is.EqualTo(45)); tv.SetIndent(" Transducer Custom"); Assert.That(tv.Indent, Is.EqualTo(41)); tv.SetIndent(" TransducerCustom"); Assert.That(tv.Indent, Is.EqualTo(12)); } [Test] public void Test_HardwareCalibrationReport_SplitLine() { BenchtopParser.HardwareCalibrationReport tv = new(); string[] split; string context = " Transducer Custom"; tv.SetIndent(context); split = tv.SplitLine(context); Assert.That(tv.Indent, Is.EqualTo(45)); Assert.That(split[0], Is.EqualTo("Transducer")); Assert.That(split[1], Is.EqualTo("Custom")); context = " Transducer Custom"; tv.SetIndent(context); split = tv.SplitLine(context); Assert.That(tv.Indent, Is.EqualTo(41)); Assert.That(split[0], Is.EqualTo("Transducer")); Assert.That(split[1], Is.EqualTo("Custom")); context = " TransducerCustom"; tv.SetIndent(context); split = tv.SplitLine(context); Assert.That(tv.Indent, Is.EqualTo(12)); Assert.That(split[0], Is.EqualTo("Transducer")); Assert.That(split[1], Is.EqualTo("Custom")); } } }