public void MaxLengthStreamTests() { string[] lines = new string[] { "G1 X0 Y0 Z0 E0 F500", "M105", "G1 X18 Y0 Z0 F2500", "G28", "G1 X0 Y0 Z0 E0 F500", null, }; // We should go back to the above code when possible. It requires making pause part and move while paused part of the stream. // All communication should go through stream to minimize the difference between printing and controlling while not printing (all printing in essence). string[] expected = new string[] { "G1 X0 Y0 Z0 E0 F500", "M105", "G1 X6 F2500", "G1 X12", "G1 X18", "G28", "G1 X12 F500", "G1 X6", "G1 X0", null, }; StaticData.Instance = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData")); MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4)); MaxLengthStream maxLengthStream = new MaxLengthStream(new TestGCodeStream(lines), 6); int expectedIndex = 0; string actualLine = maxLengthStream.ReadLine(); string expectedLine = expected[expectedIndex++]; Assert.AreEqual(expectedLine, actualLine, "Unexpected response from MaxLengthStream"); while (actualLine != null) { actualLine = maxLengthStream.ReadLine(); expectedLine = expected[expectedIndex++]; Assert.AreEqual(expectedLine, actualLine, "Unexpected response from MaxLengthStream"); } }
public void MaxLengthStreamTests() { string[] lines = new string[] { "G1 X0 Y0 Z0 E0 F500", "M105", "G1 X18 Y0 Z0 F2500", "G28", "G1 X0 Y0 Z0 E0 F500", null, }; // We should go back to the above code when possible. It requires making pause part and move while paused part of the stream. // All communication should go through stream to minimize the difference between printing and controlling while not printing (all printing in essence). string[] expected = new string[] { "G1 X0 Y0 Z0 E0 F500", "M105", "G1 X6 Y0 Z0 F2500", "G1 X12 Y0 Z0", "G1 X18 Y0 Z0", "G28", "G1 X12 Y0 Z0 F500", "G1 X6 Y0 Z0", "G1 X0 Y0 Z0", null, }; MaxLengthStream maxLengthStream = new MaxLengthStream(new TestGCodeStream(lines), 6); int expectedIndex = 0; string correctedLine = maxLengthStream.ReadLine(); Assert.IsTrue(correctedLine == expected[expectedIndex++]); while (correctedLine != null) { correctedLine = maxLengthStream.ReadLine(); Assert.IsTrue(correctedLine == expected[expectedIndex++]); } }