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()
{
//spts.saglik.gov.tr/admin
//create route collection
var routes = new RouteCollection();
var areaRegistration = new AdminAreaRegistration();
Assert.AreEqual("Admin",areaRegistration.AreaName);
// Get an AreaRegistrationContext for my class. Give it an empty RouteCollection
var areaRegistrationContext = new AreaRegistrationContext(areaRegistration.AreaName, routes);
areaRegistration.RegisterArea(areaRegistrationContext);
// Mock up an HttpContext object with my test path (using Moq)
var context = Mock.Create<HttpContext>();
context.Arrange(c=>c.Request.AppRelativeCurrentExecutionFilePath).Returns("~/Admin");
// Get the RouteData based on the HttpContext
var routeData = routes.GetRouteData(context.Request.RequestContext.HttpContext);
//assert has route
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.