Exemplo n.º 1
0
        public void CreateMOTDWithoutMessage()
        {
            var motd = new MOTD()
            {
            };

            Exception ex = Assert.ThrowsException <ArgumentException>(() =>
                                                                      motdService.AddMOTD(motd));

            Assert.AreEqual("You need to write a message", ex.Message);
        }
Exemplo n.º 2
0
        public ActionResult <MOTD> post([FromBody] MOTD motd)
        {
            try
            {
                return(Ok(_MOTDServices.AddMOTD(motd)));
            }

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