2022-07-26 04:22:31 +00:00
|
|
|
namespace BenchtopParserTests {
|
|
|
|
public class Transducer_Verify_Tests {
|
2022-07-27 02:33:45 +00:00
|
|
|
public String TransducerVerifyValue;
|
2022-07-26 04:22:31 +00:00
|
|
|
[SetUp]
|
|
|
|
public void Setup() {
|
2022-07-27 02:33:45 +00:00
|
|
|
TransducerVerifyValue = File.ReadAllText(
|
2022-07-26 05:23:41 +00:00
|
|
|
Path.Combine(TestContext.CurrentContext.TestDirectory, @"TestFiles\Transducer Verify.txt")
|
|
|
|
);
|
2022-07-26 04:22:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void Test_TransducerVerify() {
|
2022-07-27 02:33:45 +00:00
|
|
|
BenchtopParser.TransducerVerify tv = new(TransducerVerifyValue);
|
2022-07-27 00:13:20 +00:00
|
|
|
Assert.That(tv.Transducers[1].Id, Is.EqualTo(1));
|
|
|
|
Assert.That(tv.Transducers[1].Name, Is.EqualTo("CTS D34-442 115PSIA"));
|
2022-07-26 04:22:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void Test_TransducerVerify_Throw_InvalidProgram() {
|
2022-07-26 05:34:45 +00:00
|
|
|
Exception ex = Assert.Throws<Exception>(delegate { new BenchtopParser.TransducerVerify("broken"); });
|
2022-07-26 04:22:31 +00:00
|
|
|
Assert.That(ex.Message, Is.EqualTo("Invalid Transducer Verify Report, please provide a Transducer Verify Report file data"));
|
|
|
|
}
|
2022-07-26 06:04:19 +00:00
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void Test_TransducerVerify_SetIndent() {
|
|
|
|
BenchtopParser.TransducerVerify tv = new();
|
|
|
|
tv.SetIndent(1, "Transducer 1 CTS D34-442 115PSIA");
|
2022-07-27 00:13:20 +00:00
|
|
|
Assert.That(tv.Indent, Is.EqualTo(26));
|
2022-07-26 06:04:19 +00:00
|
|
|
|
|
|
|
tv.SetIndent(1, "Transducer 1 CTS D34-442 115PSIA");
|
2022-07-27 00:13:20 +00:00
|
|
|
Assert.That(tv.Indent, Is.EqualTo(20));
|
2022-07-26 06:04:19 +00:00
|
|
|
|
|
|
|
tv.SetIndent(1, "Transducer 10CTS D34-442 115PSIA");
|
2022-07-27 00:13:20 +00:00
|
|
|
Assert.That(tv.Indent, Is.EqualTo(11));
|
2022-07-26 06:04:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void Test_TransducerVerify_SplitLine() {
|
|
|
|
BenchtopParser.TransducerVerify tv = new();
|
|
|
|
string[] split;
|
|
|
|
split = tv.SplitLine("Instrument Pressure 1 0.000 psig");
|
|
|
|
Assert.That(split[0], Is.EqualTo("Instrument Pressure 1"));
|
|
|
|
Assert.That(split[1], Is.EqualTo("0.000 psig"));
|
|
|
|
}
|
2022-07-26 04:22:31 +00:00
|
|
|
}
|
|
|
|
}
|