public class ActionLoadTableFromHistoryTests : IClassFixture<DbFixture> {
public ActionLoadTableFromHistoryTests(DbFixture fixture)
=> Fixture = fixture;
private DbFixture Fixture { get; }
[Fact]
public async Task DoesLoadFromHistory_Load1() {
// Arrange
using var context = Fixture.CreateContext();
context.Database.BeginTransaction();
await SeedData.Perform(context);
await context.SaveChangesAsync();
context.ChangeTracker.Clear();
// Action
var action = new ActionLoadTableFromHistory(Actions.Get());
var historySql = await action.Perform(0, 1, false); // Uses data in EF to produce a SQL Script
var finalSql = $"{historySql.SelectSql} select * from {historySql.CurrentTableName} {historySql.CloseSql}";
var result = await context.Database.SqlQueryRaw<SourceTable>(finalSql, new object[0]).ToListAsync();
// Assert
Assert.NotNull(result);
Assert.NotEmpty(result);
}
}
public class ActionLoadTableFromHistoryTests : IClassFixture<DbFixture> {
public ActionLoadTableFromHistoryTests(DbFixture fixture)
=> Fixture = fixture;
private DbFixture Fixture { get; }
[Fact]
public async Task DoesLoadFromHistory_Load1() {
// Arrange
using var context = Fixture.CreateContext();
context.Database.BeginTransaction();
await SeedData.Perform(context);
await context.SaveChangesAsync();
context.ChangeTracker.Clear();
// Action
var action = new ActionLoadTableFromHistory(Actions.Get());
var historySql = await action.Perform(0, 1, false); // Uses data in EF to produce a SQL Script
var finalSql = $"{historySql.SelectSql} select * from {historySql.CurrentTableName} {historySql.CloseSql}";
var result = await context.Database.SqlQueryRaw<SourceTable>(finalSql, new object[0]).ToListAsync();
// Assert
Assert.NotNull(result);
Assert.NotEmpty(result);
}
}