Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

[ControllerUnitTest] Make the controller class not to throw an exception for simple unit tests  #1771

@ianhong

Description

@ianhong

This is related to #1504. To make this scenario work, we should update the controller class as follows:

        // Do not override ViewData.Model unless passed a non-null value.
        if (ViewData != null && model != null )
        {
            ViewData.Model = model;
        }

        return new ViewResult()
        {
            ViewName = viewName,
            ViewData = ViewData,
            ViewEngine = _viewEngine,
        };

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions