testing SetIndent and SplitLine
This commit is contained in:
parent
b187502d92
commit
e20a064fa9
@ -8,7 +8,7 @@ namespace BenchtopParser {
|
||||
public class TransducerVerify {
|
||||
|
||||
public Dictionary<int, Transducer> transducers = new();
|
||||
public int indent = 26;
|
||||
public int indent = 26; // Default 26 from seeing files, overridden later in SetIndent for safety
|
||||
|
||||
|
||||
/// Split the string, and clean up whitespace, returns the Name and Value
|
||||
@ -26,6 +26,10 @@ namespace BenchtopParser {
|
||||
this.indent = endOfCurrentTransducerKey - 1 + additionalSpaces;
|
||||
}
|
||||
|
||||
public TransducerVerify() {
|
||||
return;
|
||||
}
|
||||
|
||||
public TransducerVerify(String transducer_verify_value) {
|
||||
string separator = "===============================================================";
|
||||
List<String> documentLines = transducer_verify_value.Split(new string[] { Environment.NewLine }, StringSplitOptions.TrimEntries).ToList();
|
||||
@ -84,6 +88,5 @@ namespace BenchtopParser {
|
||||
public Transducer(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -20,5 +20,27 @@ namespace BenchtopParserTests {
|
||||
Exception ex = Assert.Throws<Exception>(delegate { new BenchtopParser.TransducerVerify("broken"); });
|
||||
Assert.That(ex.Message, Is.EqualTo("Invalid Transducer Verify Report, please provide a Transducer Verify Report file data"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_TransducerVerify_SetIndent() {
|
||||
BenchtopParser.TransducerVerify tv = new();
|
||||
tv.SetIndent(1, "Transducer 1 CTS D34-442 115PSIA");
|
||||
Assert.That(tv.indent, Is.EqualTo(26));
|
||||
|
||||
tv.SetIndent(1, "Transducer 1 CTS D34-442 115PSIA");
|
||||
Assert.That(tv.indent, Is.EqualTo(20));
|
||||
|
||||
tv.SetIndent(1, "Transducer 10CTS D34-442 115PSIA");
|
||||
Assert.That(tv.indent, Is.EqualTo(11));
|
||||
}
|
||||
|
||||
[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"));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user