public void MakeCommandsTest() { var o = new NMRSpectrumQuery(); var cmds = o.MakeCommand("1.45 (s, 1H), 1.55 (d, J = 1.3 Hz, 3H), 1.95 (dd, J = 7.3, 2.3 Hz, 1.4H, CH3), 2.2-3.2 (m, 15H)"); Assert.AreNotEqual(0, cmds.Count()); }
public void ButtonNMRSpec_Click(object sender, Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs e) { var app = Globals.ThisAddIn.Application; var text = app.Selection.Text; text = Utility.Normalize(text); var query = new NMRSpectrumQuery() { Format = CurrentNMRFormat }; var commands = query.MakeCommand(text); WordApplyer.Apply(commands); }
static void TestLine(Func <string, Match> f, string text, string shift, string integration, string pattern, string couplings, int commentLength) { var m = f(text); Assert.IsTrue(m.Success); var info = NMRSpectrumQuery.CreatePeakInfo(m, 0); Assert.AreEqual(shift, info.ChemicalShift); Assert.AreEqual(integration, info.Integration); Assert.AreEqual(pattern, info.Pattern); if (couplings == null) { Assert.IsNull(info.JValues); } else { Assert.AreEqual(couplings, string.Join(", ", info.JValues)); } Assert.AreEqual(commentLength, info.CommentRange == null ? 0 : info.CommentRange.Length); }