public void Get_ReturnExceptionIfNoDocumentToResolve() { ResolveController controller = new ResolveController(); string title = ""; string authors = ""; string year = ""; SetupControllerForTests(controller, "http://localhost:56736/resolve/", "resolver", "{controller}"); bool wasCorrectExceptionThrown = false; string exceptionMessage = string.Empty; try { controller.Get(title, authors, year); } catch (Exception ex) { do { if (ex.Message == "Please supply a document to resolve.") { wasCorrectExceptionThrown = true; exceptionMessage = ex.Message; break; } ex = ex.InnerException; } while (ex != null); } Assert.IsTrue(wasCorrectExceptionThrown, "Actual exception: " + exceptionMessage); }
public void Get_ReturnOKForValidResolution() { ResolveController controller = new ResolveController(); string title = "A new Zodariid spider from Panama"; string authors = "Chickering, A M"; string year = "1957"; HttpStatusCode expected = HttpStatusCode.OK; HttpResponseMessage actual; SetupControllerForTests(controller, "http://localhost:56736/resolve/", "resolver", "{controller}"); actual = controller.Get(title, authors, year); Assert.AreEqual(expected, actual.StatusCode); }