I am trying to Asp.NET MVC Admin area route unite test with telerik just mock lite.But I cant test.
Here is My Trying Code:
[TestMethod]
public void AdminRouteUrlIsRoutedToHomeAndIndex()
{
var routes = new RouteCollection();
var areaRegistration = new AdminAreaRegistration();
Assert.AreEqual("Admin",areaRegistration.AreaName);
var areaRegistrationContext = new AreaRegistrationContext(areaRegistration.AreaName, routes);
areaRegistration.RegisterArea(areaRegistrationContext);
var context = Mock.Create<HttpContext>();
context.Arrange(c=>c.Request.AppRelativeCurrentExecutionFilePath).Returns("~/Admin");
var routeData = routes.GetRouteData(context.Request.RequestContext.HttpContext);
Assert.IsNotNull(routeData,"route config");
}
When
var context = Mock.Create<HttpContext>();
just mock tells this error
Telerik.JustMock.Core.ElevatedMockingException: Cannot mock 'System.Web.HttpContext'. JustMock Lite can only mock interface members, virtual/abstract members in non-sealed classes, delegates and all members on classes derived from MarshalByRefObject on instances created with Mock.Create or Mock.CreateLike. For any other scenario you need to use the full version of JustMock.
So How can I do area registration route unit test with telerik just mock lite? How can I Solve this issue?
Thanks a lot.
What I have tried:
var routes = new RouteCollection();
var areaRegistration = new AdminAreaRegistration();
Assert.AreEqual("Admin",areaRegistration.AreaName);
var areaRegistrationContext = new AreaRegistrationContext(areaRegistration.AreaName, routes);
areaRegistration.RegisterArea(areaRegistrationContext);
var context = Mock.Create<httpcontext>();
context.Arrange(c=>c.Request.AppRelativeCurrentExecutionFilePath).Returns("~/Admin");
var routeData = routes.GetRouteData(context.Request.RequestContext.HttpContext);
Assert.IsNotNull(routeData,"route config");</httpcontext>