コード例 #1
0
        public void ValueEquals_ThrowsAssertActualExpectedException(object expected, object actual, string exceptionMessage)
        {
            // Arrange & Act & Assert
            var exception = Assert.Throws <AssertActualExpectedException>(() => ObjectAssert.DeepEquals(expected, actual));

            Assert.Equal(exceptionMessage, exception.Message);
        }
コード例 #2
0
        /// <summary>
        /// Check json result.
        /// </summary>
        /// <param name="actionResult">The action result.</param>
        /// <param name="value">The value.</param>
        /// <returns>JsonResult.</returns>
        public static JsonResult JsonResult(IActionResult actionResult, object value)
        {
            var jsonResult = Assert.IsType <JsonResult>(actionResult);

            ObjectAssert.DeepEquals(value, jsonResult.Value);

            return(jsonResult);
        }
コード例 #3
0
        /// <summary>
        /// Check view result.
        /// </summary>
        /// <param name="actionResult">The action result.</param>
        /// <param name="viewName">Name of the view.</param>
        /// <param name="model">The model.</param>
        /// <returns>ViewResult.</returns>
        public static ViewResult ViewResult(IActionResult actionResult, string viewName = null, object model = null)
        {
            var viewResult = Assert.IsType <ViewResult>(actionResult);

            Assert.Equal(viewName, viewResult.ViewName);

            ObjectAssert.DeepEquals(model, viewResult.Model);

            return(viewResult);
        }
コード例 #4
0
 public void ValueEquals_Success(object expected, object actual)
 {
     // Arrange & Act & Assert
     ObjectAssert.DeepEquals(expected, actual);
 }