public void ReadWithIdOf0() { int id = 0; Exception ex = Assert.ThrowsException <ArgumentException>(() => motdService.GetMOTDById(id)); Assert.AreEqual("ID requires to be greater than 0.", ex.Message); }
public ActionResult <MOTD> Get(int id) { try { return(Ok(_MOTDServices.GetMOTDById(id))); } catch (Exception e) { return(BadRequest(e.Message)); } }