public async Task Statistics_BadConnection() { var options = new DbContextOptionsBuilder <GridBeyondDBContext>() .UseSqlServer("Bad string connection").Options; using (var context = new GridBeyondDBContext(options)) { AnalyzerController analyzer = new AnalyzerController(context); //var statistics = await analyzer.GetCommonStatistics(); Assert.ThrowsAsync <ArgumentException>(() => analyzer.GetCommonStatistics()); } }
public async Task Statistics_FullDatabase() { var options = new DbContextOptionsBuilder <GridBeyondDBContext>() .UseSqlServer("[REAL_STRING_CONNECTION]").Options; using (var context = new GridBeyondDBContext(options)) { AnalyzerController analyzer = new AnalyzerController(context); var statistics = await analyzer.GetCommonStatistics(); Assert.IsTrue(statistics.TotalItems == 3133); } }
public async Task Statistics_EmptyDatabase() { var options = new DbContextOptionsBuilder <GridBeyondDBContext>() .UseSqlServer("[REAL_STRING_CONNECTION]").Options; using (var context = new GridBeyondDBContext(options)) { AnalyzerController analyzer = new AnalyzerController(context); //var statistics = await analyzer.GetCommonStatistics(); Assert.ThrowsAsync <InvalidOperationException>(() => analyzer.GetCommonStatistics()); } }