public void BeginGLineAndAppend() { MockGCodeAccumulator mockGCA = new MockGCodeAccumulator(); GCodeBuilder gcb = new GCodeBuilder(mockGCA); gcb.BeginGLine(1, "comment"); Assert.IsTrue(mockGCA.Lines.Count == 0); gcb.AppendComment("addingComment"); gcb.AppendI("intTest", 3); gcb.AppendF("floatTest", 2.3); gcb.AppendS("stringTest", "stringTest"); gcb.AppendL("labelTest"); gcb.EndLine(); Assert.IsTrue(mockGCA.Lines.Count == 1); Assert.AreEqual("addingComment", mockGCA.Lines[0].Comment); Assert.AreEqual(LineType.GCode, mockGCA.Lines[0].Type); Assert.AreEqual(0, mockGCA.Lines[0].LineNumber); var par = mockGCA.Lines[0].Parameters; Assert.AreEqual(4, par.Length); Assert.AreEqual(GCodeParamTypes.IntegerValue, par[0].Type); Assert.AreEqual(3, par[0].IntegerValue); Assert.AreEqual("intTest", par[0].Identifier); Assert.AreEqual(GCodeParamTypes.DoubleValue, par[1].Type); Assert.AreEqual(2.3, par[1].DoubleValue); Assert.AreEqual("floatTest", par[1].Identifier); Assert.AreEqual(GCodeParamTypes.TextValue, par[2].Type); Assert.AreEqual("stringTest", par[2].TextValue); Assert.AreEqual("stringTest", par[2].Identifier); Assert.AreEqual(GCodeParamTypes.NoValue, par[3].Type); Assert.AreEqual("labelTest", par[3].Identifier); }
public void BeginAndEndMLine() { MockGCodeAccumulator mockGCA = new MockGCodeAccumulator(); GCodeBuilder gcb = new GCodeBuilder(mockGCA); gcb.BeginMLine(1, "comment"); Assert.IsTrue(mockGCA.Lines.Count == 0); gcb.EndLine(); Assert.IsTrue(mockGCA.Lines.Count == 1); Assert.AreEqual("comment", mockGCA.Lines[0].Comment); Assert.AreEqual(LineType.MCode, mockGCA.Lines[0].Type); Assert.AreEqual(0, mockGCA.Lines[0].LineNumber); }