public void ExpandNullString() { var me = new MacroExpander(); Assert.AreEqual(null, me.Expand(null)); return; } // end of function - ExpandNullString
public void ExpandValidString() { var context = Substitute.For <IItemContext>(); var doc = Substitute.For <EnvDTE.Document>(); var name = "TestDocument.cs"; doc.Name.Returns(name); context.Document.Returns(doc); var me = new MacroExpander(context); string strToExpand = "{FILENAME}|{DATE}|{YEAR}"; var expandedStrs = me.Expand(strToExpand).Split('|'); Assert.AreEqual(3, expandedStrs.Length); Assert.AreEqual(expandedStrs[0], name); Assert.IsTrue(expandedStrs[1] != "{DATE}"); Assert.AreEqual(expandedStrs[2], DateTime.Now.Year.ToString()); return; } // end of function - ExpandValidString
private void ClearError(TextBox textBox) { errorProvider.SetError(textBox, null); toolTip.SetToolTip(textBox, _macroExpander.Expand(textBox.Text)); }
public object Compile() { object o = _macroExp.Expand(); return((o == null) ? o : Compile(o)); }