Exemplo n.º 1
0
        public void ServerError()
        {
            var ctl    = new BlogController();
            var result = ctl.ServerError();

            Assert.IsInstanceOf(typeof(StatusCodeResult), result);
            if (result is StatusCodeResult rdResult)
            {
                Assert.That(rdResult.StatusCode, Is.EqualTo(500));
            }
        }
Exemplo n.º 2
0
        public void ServerError_HasMessage()
        {
            var ctl    = new BlogController();
            var result = ctl.ServerError("Work 996");

            Assert.IsInstanceOf(typeof(ObjectResult), result);
            if (result is ObjectResult rdResult)
            {
                Assert.That(rdResult.StatusCode, Is.EqualTo(500));
                Assert.IsInstanceOf <string>(rdResult.Value);
                Assert.That(rdResult.Value.ToString(), Is.EqualTo("Work 996"));
            }
        }