Esempio n. 1
0
        public void Log_ValidModelState_MessageLogIsCalled()
        {
            var result = controller.Log(new Message());

            A.CallTo(() => messageLog.WriteEntry(A <Message> .Ignored))
            .MustHaveHappened(Repeated.Exactly.Once);
        }
        public IActionResult Log(Message message)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            messageLog.WriteEntry(message);

            return(Ok());
        }