I´m using Moq to mock some objects of my application, and for now, I need to mock this call:
accessor.HttpContext.Session.GetInt32("offset");
I have tried to do this way, but not works:
var mock = new Mock<HttpContextAccessor>();
mock.Setup(x => x.HttpContext.Session.GetInt32("offset"))
.Returns(0);
It fires this error:
System.NotSupportedException : Expression references a method that does not belong to the mocked object: x => x.HttpContext.Session.GetInt32("offset")