public void Using_data_context_is_an_option() { var cs = CreateConnectionString(); using (var db = new SqliteDataContext(cs)) { Assert.IsNotNull(db); } }
public void Data_context_instantiates() { var cs = _fixture.CreateConnectionString(); using (var db = new SqliteDataContext(cs)) { Assert.NotNull(db); } }
/// <summary> /// Configures the Data Context of the aplication with a SQLite database. /// </summary> /// <param name="services">The <see cref="IServiceCollection"/> implementation of the Asp.Net Core application.</param> /// <returns>The configured <see cref="IServiceCollection"/> implementation of the Asp.Net Core application.</returns> public static IServiceCollection AddSqliteDataContext(this IServiceCollection services) { var connectionString = services.BuildServiceProvider() .GetService <IConfiguration>() .GetConnectionString("Sqlite"); var dataContext = new SqliteDataContext(connectionString); services.AddSingleton <DataContext>(dataContext); return(services); }
public UserServiceTest() { var passwordHelperLocalizer = Substitute.For<IStringLocalizer<PasswordHelper>>(); passwordHelperLocalizer[Arg.Any<string>()].Returns(p => new LocalizedString((string)p[0], (string)p[0])); _passwordHelper = new PasswordHelper(passwordHelperLocalizer); _totpService = new TimeBasedOneTimePasswordNuGetService(); var dataHelper = new DataHelper(); _db = dataHelper.CreateDbContext(_passwordHelper); _factory = dataHelper.Factory; _service = new UserService(_db, _totpService); }
public FeedController(ILogger <FeedController> logger, IRssFeedRepository rssFeedRepository, IRefreshRssFeed refreshRssFeed, IFeedParser feedParser, IHttpClientFactory clientFactory, SqliteDataContext context) { _logger = logger; _rssFeedRepository = rssFeedRepository; _refreshRssFeed = refreshRssFeed; _feedParser = feedParser; _clientFactory = clientFactory; _context = context; }
public UsersController(SqliteDataContext context) { _context = context; }
public Factory(SqliteDataContext context, IPasswordHelper passwordHelper) { Context = context; _passwordHelper = passwordHelper; Context.SaveChanges(); }
public AccountController(SqliteDataContext context, ITokenService tokenService) { _tokenService = tokenService; _context = context; }