Hello,
When i am running my Unit Test project,so its getting error from mvc application"
System.NullReferenceException: 'Object reference not set to an instance of an object.'
System.Web.HttpContext.Current.get returned null.
I have tried in MVC Application.
Please help me and tell me the whole process of UnitTesting in MVC. With maintenance of System.Web.HttpContext.Currect.Session.
Please help me and tell me the whole process of UnitTesting in MVC. With maintenance of System.Web.HttpContext.Currect.Session.
I have tried following code:-
//Arrange
GCopaDimensionsController gCopaDimensionsController = new GCopaDimensionsController();
//gCopaDimensionsController.ControllerContext = context.Object;
//Act
ViewResult result = gCopaDimensionsController.Index() as ViewResult;
//Assert
Assert.AreEqual("Manage Global Copa Dimension", gCopaDimensionsController.Session["Title"]);
//Assert.Fail();
Thanks in Advance.
Ankit Agarwal
Software Engineer

Bhawna TutejaPosted Feb 11, 2020, 10:52 PM
Khaja MoizuddinPosted Jul 6, 2018, 11:04 AM