This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestClass] | |
public class CarServiceContextInitTests | |
{ | |
// to have the same Configuration object as in Startup | |
private IConfigurationRoot _configuration; | |
// represents database's configuration | |
private DbContextOptions<CarServiceContext> _options; | |
public CarServiceContextInitTests() | |
{ | |
var builder = new ConfigurationBuilder() | |
.SetBasePath(Directory.GetCurrentDirectory()) | |
.AddJsonFile("appsettings.json"); | |
_configuration = builder.Build(); | |
_options = new DbContextOptionsBuilder<CarServiceContext>() | |
.UseSqlServer(_configuration.GetConnectionString("DefaultConnection")) | |
.Options; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment