Exemplo n.º 1
0
 public TeamService(ITeamRepository teamRepository, IApplicationDataPolicyRepository applicationDataPolicyRepository, ITermsOfServiceRepository termsOfServiceRepository, ISubRealmRepository subRealmRepository, IMapper mapper)
 {
     this.teamRepository = teamRepository;
     this.applicationDataPolicyRepository = applicationDataPolicyRepository;
     this.termsOfServiceRepository        = termsOfServiceRepository;
     this.subRealmRepository = subRealmRepository;
     this.mapper             = mapper;
 }
Exemplo n.º 2
0
 public TermsOfServiceController(
     CustomUserManager userManager,
     ITermsOfServiceRepository termsOfServiceRepository,
     IConfiguration configuration,
     IIdentityServerInteractionService interaction,
     IEventService events,
     IClientStore clientStore,
     SignInManager <UserModel> signInManager)
 {
     this.userManager = userManager;
     this.termsOfServiceRepository = termsOfServiceRepository;
     this.configuration            = configuration;
     this.interaction   = interaction;
     this.events        = events;
     this.clientStore   = clientStore;
     this.signInManager = signInManager;
 }
        public TermsOfServiceController_Tests()
        {
            var mockOptionsAccessor    = Substitute.For <IOptions <IdentityOptions> >();
            var mockPasswordHasher     = Substitute.For <IPasswordHasher <UserModel> >();
            var mockUserValidators     = Substitute.For <IEnumerable <IUserValidator <UserModel> > >();
            var mockPasswordValidators = Substitute.For <IEnumerable <IPasswordValidator <UserModel> > >();
            var mockKeyNormalizer      = Substitute.For <ILookupNormalizer>();
            var mockErrors             = Substitute.For <IdentityErrorDescriber>();
            var mockServices           = Substitute.For <IServiceProvider>();
            var mockUserLogger         = Substitute.For <ILogger <UserManager <UserModel> > >();
            var fakeA3SContext         = new A3SContextFake(new Microsoft.EntityFrameworkCore.DbContextOptions <A3SContext>());

            mockConfiguration = Substitute.For <IConfiguration>();
            var fakesCustomUserStore = new CustomUserStoreFake(fakeA3SContext, mockConfiguration);

            fakeUserManager = new CustomUserManagerFake(fakesCustomUserStore, mockOptionsAccessor, mockPasswordHasher, mockUserValidators, mockPasswordValidators, mockKeyNormalizer,
                                                        mockErrors, mockServices, mockUserLogger);

            var mockContextAccessor = Substitute.For <IHttpContextAccessor>();
            var mocClaimsFactory    = Substitute.For <IUserClaimsPrincipalFactory <UserModel> >();
            var mockSignInLogger    = Substitute.For <ILogger <SignInManager <UserModel> > >();
            var mockLdapAuthenticationModeRepository = Substitute.For <LdapAuthenticationModeRepository>(fakeA3SContext, mockConfiguration);
            var mockLdapConnectionService            = Substitute.For <ILdapConnectionService>();

            mockAuthenticationSchemeProvider = Substitute.For <IAuthenticationSchemeProvider>();
            var mockUserConfirmation = Substitute.For <IUserConfirmation <UserModel> >();

            fakeSignInManager = new CustomSignInManagerFake <UserModel>(fakeUserManager, mockContextAccessor, mocClaimsFactory, mockOptionsAccessor, mockSignInLogger, fakeA3SContext,
                                                                        mockAuthenticationSchemeProvider, mockLdapAuthenticationModeRepository, mockLdapConnectionService, mockUserConfirmation);

            termsOfServiceRepository             = Substitute.For <ITermsOfServiceRepository>();
            mockClientStore                      = Substitute.For <IClientStore>();
            mockEventService                     = Substitute.For <IEventService>();
            mockIdentityServerInteractionService = Substitute.For <IIdentityServerInteractionService>();

            userModel = new UserModel()
            {
                UserName = "******",
                Id       = Guid.NewGuid().ToString()
            };

            termsOfServiceModel = new TermsOfServiceModel()
            {
                AgreementName = "Test agreement",
                Version       = "2019.1",
                HtmlContents  = "<html />",
                CssContents   = ".my-class { font-size: 2; }"
            };

            // Prepare controller contexts
            authorizationRequest = new AuthorizationRequest()
            {
                IdP       = "testIdp",
                ClientId  = "clientId1",
                LoginHint = "LoginHint"
            };

            client = new Client()
            {
                EnableLocalLogin = true
            };
        }
 public TermsOfServiceService(ITermsOfServiceRepository termsOfServiceRepository, IArchiveHelper archiveHelper, IMapper mapper)
 {
     this.termsOfServiceRepository = termsOfServiceRepository;
     this.archiveHelper            = archiveHelper;
     this.mapper = mapper;
 }