public AuthLessonServiceWrapper( ILessonService lessonService, ClaimsPrincipal principal, EntityValidator entityValidator, IUserStore<IUserDto, int> userStore, ClaimsAuthorizationManager authorizationManager) { if (lessonService == null) { throw new ArgumentNullException("lessonService"); } if (principal == null) { throw new ArgumentNullException("principal"); } if (principal.Identity == null) { throw new ArgumentException("Principal doesn't contian identity"); } if (!principal.Identity.IsAuthenticated) { throw new ArgumentException("Identity is not authenticated"); } if (entityValidator == null) { throw new ArgumentNullException("entityValidator"); } if (userStore == null) { throw new ArgumentNullException("userStore"); } if (authorizationManager == null) { throw new ArgumentNullException("authorizationManager"); } _lessonService = lessonService; _principal = principal; _entityValidator = entityValidator; _userStore = userStore; _authorizationManager = authorizationManager; }
public AuthLessonServiceWrapperTest() { _lessonService = A.Fake<ILessonService>(); _principal = A.Fake<ClaimsPrincipal>(); _identity = A.Fake<IIdentity>(); A.CallTo(() => _principal.Identity).Returns(_identity); A.CallTo(() => _identity.IsAuthenticated).Returns(true); _entityValidator = A.Fake<EntityValidator>(); _userStore = A.Fake<IUserStore<IUserDto, int>>(); _authorizationManager = new ClaimsAuthorizationManager(); _authLessonServiceWrapper = new AuthLessonServiceWrapper( _lessonService, _principal, _entityValidator, _userStore, _authorizationManager); }