Ejemplo n.º 1
0
        public void Post_if_adds_message_fails_then_return_failed_json_msg()
        {
            #region Arrange
            ShoutBoxController.ControllerContext =
                TestHelper.MockControllerContext(ShoutBoxController).WithAuthenticatedUser("test");


            using (Mock.Record())
            {
                Expect.Call(CourseService.AddShoutBoxMessage(SampleMessage)).IgnoreArguments().Return(null);
            }
            #endregion

            #region Act

            JsonResult result;
            using (Mock.Playback())
            {
                result = (JsonResult)ShoutBoxController.Add(1, "test");
            }

            #endregion

            #region Assert
            Assert.That(result.Data, Is.Not.Null);
            Assert.That(((ResponseMessage)result.Data).IsSuccess, Is.False);
            #endregion
        }