public void SimpleStatementCallbackAndTransformAfterRendering() { var st = new StatementSimpleStatement(() => "int j"); var lines = st.CodeItUp().ToArray(); st.RenameVariable("j", "k"); lines = st.CodeItUp().ToArray(); Assert.AreEqual(1, lines.Length); Assert.AreEqual("int k;", lines[0]); }
public void SimpleStatementNoCallBackTillCodeUp2() { int count = 0; var st = new StatementSimpleStatement(() => { count++; return("int j"); }); var lines = st.CodeItUp().ToArray(); Assert.AreEqual(1, count); var lines2 = st.CodeItUp().ToArray(); Assert.AreEqual(1, count); }
public void SimpleStatementCallbackLineWithNoSemicolon() { var st = new StatementSimpleStatement(() => "}", addSemicolon: false); var lines = st.CodeItUp().ToArray(); Assert.AreEqual(1, lines.Length); Assert.AreEqual("}", lines[0]); }
/// <summary>Test stub for CodeItUp()</summary> public IEnumerable<string> CodeItUp(StatementSimpleStatement target) { IEnumerable<string> result = target.CodeItUp(); var lines = result.ToArray(); Assert.AreEqual(1, lines.Length, "bad # of lines"); return result; // TODO: add assertions to method StatementSimpleStatementTest.CodeItUp(StatementSimpleStatement) }
/// <summary>Test stub for CodeItUp()</summary> public IEnumerable <string> CodeItUp(StatementSimpleStatement target) { IEnumerable <string> result = target.CodeItUp(); var lines = result.ToArray(); Assert.AreEqual(1, lines.Length, "bad # of lines"); return(result); // TODO: add assertions to method StatementSimpleStatementTest.CodeItUp(StatementSimpleStatement) }
public void SimpleStatementNoCallBackTillCodeUp() { bool called = false; var st = new StatementSimpleStatement(() => { called = true; return("int j"); }); Assert.IsFalse(called, "Call back called too early"); var lines = st.CodeItUp().ToArray(); Assert.IsTrue(called); }
public void SimpleStatementNoCallBackTillCodeUp2() { int count = 0; var st = new StatementSimpleStatement(() => { count++; return "int j"; }); var lines = st.CodeItUp().ToArray(); Assert.AreEqual(1, count); var lines2 = st.CodeItUp().ToArray(); Assert.AreEqual(1, count); }
public void SimpleStatementNoCallBackTillCodeUp() { bool called = false; var st = new StatementSimpleStatement(() => { called = true; return "int j"; }); Assert.IsFalse(called, "Call back called too early"); var lines = st.CodeItUp().ToArray(); Assert.IsTrue(called); }