예제 #1
0
        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);
        }
예제 #2
0
        public ActionResult <MOTD> Get(int id)
        {
            try
            {
                return(Ok(_MOTDServices.GetMOTDById(id)));
            }

            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }