public Braces(CsWriter wtr) { _wtr = wtr; _wtr.WriteLine("{"); _wtr.Indent++; _wtr._open.Add(this); }
void IDisposable.Dispose() { if (_wtr != null && _wtr._open.Remove(this)) { _wtr.Indent--; _wtr.WriteLine("}"); _wtr = null; } }
public void TestBasicWriter() { using (CsWriter w = new CsWriter()) { w.AddNamespaces("System"); using(w.WriteNamespace("CSharpTest")) using (w.WriteClass("class Net")) { } string msg = w.ToString(); Assert.IsTrue(msg.Contains("using System;")); Assert.IsTrue(msg.Contains("DebuggerNonUserCodeAttribute")); Assert.IsTrue(msg.Contains("CompilerGenerated")); Assert.IsTrue(msg.Contains("class Net")); } }