protected override void Arrange() { _transaction = new TransactionScope(); var configValueProviderStub = Stub <IConfigValueProvider>(); var usersContextFactory = A.Fake <IUsersContextFactory>(); A.CallTo(() => usersContextFactory.CreateContext()) .Returns(new SqlServerUsersContext()); var clientAppRepo = new ClientAppRepo(usersContextFactory, configValueProviderStub); var edOrgs = _expectedEducationOrganizations .Select( edOrgId => new ApplicationEducationOrganization { EducationOrganizationId = edOrgId }) .ToList(); var profiles = _expectedProfiles.Select( profile => new Profile { ProfileName = profile }) .ToList(); var application = new Application { Profiles = profiles, ClaimSetName = "MyTestClaimSetName", Vendor = new Vendor { VendorNamespacePrefixes = new List <VendorNamespacePrefix> { new VendorNamespacePrefix { NamespacePrefix = "MyTestNamespacePrefix" } } }, OperationalContextUri = "uri://ed-fi-api-host.org" }; _testClient = new ApiClient(true) { Name = $"ClientAppRepoTest{Guid.NewGuid():N}", Application = application, ApplicationEducationOrganizations = edOrgs }; using (var context = new SqlServerUsersContext()) { context.Clients.Add(_testClient); context.SaveChanges(); } _apiClientIdentityProvider = new EdFiAdminApiClientIdentityProvider(clientAppRepo); }
public ApiClientAuthenticator( IApiClientIdentityProvider apiClientIdentityProvider, IApiClientSecretProvider apiClientSecretProvider, ISecretVerifier secretVerifier) { _apiClientIdentityProvider = apiClientIdentityProvider; _apiClientSecretProvider = apiClientSecretProvider; _secretVerifier = secretVerifier; }
protected override void Arrange() { _transaction = new TransactionScope(); var configValueProviderStub = Stub <IConfigValueProvider>(); var usersContextFactory = A.Fake <IUsersContextFactory>(); A.CallTo(() => usersContextFactory.CreateContext()) .Returns(new SqlServerUsersContext()); var clientAppRepo = new ClientAppRepo(usersContextFactory, configValueProviderStub); _apiClientIdentityProvider = new EdFiAdminApiClientIdentityProvider(clientAppRepo); }
protected override void Arrange() { _transaction = new TransactionScope(); var usersContextFactory = A.Fake <IUsersContextFactory>(); var config = new ConfigurationBuilder() .SetBasePath(TestContext.CurrentContext.TestDirectory) .AddJsonFile("appsettings.json", optional: true) .AddEnvironmentVariables() .Build(); var connectionStringProvider = new ConfigConnectionStringsProvider(config); string connectionstring = connectionStringProvider.GetConnectionString("EdFi_Admin"); A.CallTo(() => usersContextFactory.CreateContext()) .Returns(new SqlServerUsersContext(connectionstring)); var clientAppRepo = new ClientAppRepo(usersContextFactory, config); _apiClientIdentityProvider = new EdFiAdminApiClientIdentityProvider(clientAppRepo); }
protected override void Arrange() { _transaction = new TransactionScope(); var config = new ConfigurationBuilder() .SetBasePath(TestContext.CurrentContext.TestDirectory) .AddJsonFile("appsettings.json", optional: true) .AddEnvironmentVariables() .Build(); var connectionStringProvider = new ConfigConnectionStringsProvider(config); string connectionstring = connectionStringProvider.GetConnectionString("EdFi_Admin"); var usersContextFactory = A.Fake <IUsersContextFactory>(); A.CallTo(() => usersContextFactory.CreateContext()) .Returns(new SqlServerUsersContext(connectionstring)); var clientAppRepo = new ClientAppRepo(usersContextFactory, config); var edOrgs = _expectedEducationOrganizations .Select( edOrgId => new ApplicationEducationOrganization { EducationOrganizationId = edOrgId }) .ToList(); var profiles = _expectedProfiles.Select( profile => new Profile { ProfileName = profile }) .ToList(); var application = new Application { Profiles = profiles, ClaimSetName = "MyTestClaimSetName", Vendor = new Vendor { VendorNamespacePrefixes = new List <VendorNamespacePrefix> { new VendorNamespacePrefix { NamespacePrefix = "MyTestNamespacePrefix" } } }, OperationalContextUri = "uri://ed-fi-api-host.org" }; _testClient = new ApiClient(true) { Name = $"ClientAppRepoTest{Guid.NewGuid():N}", Application = application, ApplicationEducationOrganizations = edOrgs }; using (var context = new SqlServerUsersContext(connectionstring)) { context.Clients.Add(_testClient); context.SaveChanges(); } _apiClientIdentityProvider = new EdFiAdminApiClientIdentityProvider(clientAppRepo); }