public void DocumentNotFoundException() { _alphaEngine = new AlphaEngine(_map); Assert.Throws <DocumentNotFoundException>(() => _alphaEngine.GetDocByID("Hello")); try { _alphaEngine.GetDocByID("Hello"); } catch (DocumentNotFoundException e) { Assert.Equal("You Haven't Added Document With Such Name Yet", e.Message); } }
public string ViewDoc(string[] strings) { var isComplete = (strings.Length == 2); var docId = InitAlphaEngine(strings)[0]; try { if (isComplete) { var docContext = _alphaEngine.GetDocByID(docId); return("Doc <" + docId + ">: " + "\n" + docContext); } return(_alphaEngine.GetDocByID(docId)); } catch (DocumentNotFoundException e) { return("!Document Not Found!\n"); } }