public WineryControllerTests() { // Create inMemory database for testing. _optionsBuilder = new DbContextOptionsBuilder <WineCellarDBContext>( ); _optionsBuilder.UseInMemoryDatabase("WineryUnitTestInMemDB"); _dbContext = new WineCellarDBContext(_optionsBuilder.Options); // Create commands controller for testing. _controller = new WineryController(_dbContext, new NullLogger <WineryController>( )); }
public void Dispose() { _optionsBuilder = null; // Cleanup any created database items. foreach (var Winery in _dbContext.Wineries) { _dbContext.Wineries.Remove(Winery); } _dbContext.SaveChanges( ); _dbContext.Dispose( ); _controller = null; }
public WineryControllerTest() : base() { _wineryController = new WineryController(RavenStore); }
public WineryControllerFixture() { _wineryRepository = Substitute.For <IWineryRepository>(); _controller = new WineryController(_wineryRepository); }