Relative Content

Tag Archive for c#asp.net-mvcunit-testing.net-coremoq

Unit Test ServiceClass1 has challenge in Mocking Session, SessionBag in .Net 8.0 class Library Project Target 4.7.1 and .Net 8.0

Unit Test ServiceClass1 that calls “GetCurrentUserIsImpersonating” method of the “HttpContextWrapper” class which calls the “IsImpersonating” extension method in the “UserIdentityExtensions” static class, which relies on the SessionBag.Current.Impersonator value. it call TrGetMember in SessionBag and exit when execute Current.Session != null. Added set here private static ISession Session
Removed interval in set if Public static dynamic Current.