Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ShockThunder committed Nov 12, 2023
1 parent 0b485f5 commit 0122980
Showing 1 changed file with 59 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,21 @@ public async Task UpgradeToSpecifiedTarget_On_MigrateAsync()
firstMigration
.Setup(x => x.Version)
.Returns(new MigrationVersion(1));
firstMigration.Setup(x => x.Dependencies)
.Returns(new List<MigrationVersion>());
var secondMigration = new Mock<IMigration>();
secondMigration
.Setup(x => x.Version)
.Returns(new MigrationVersion(1, 1));
secondMigration.Setup(x => x.Dependencies)
.Returns(new List<MigrationVersion>());
var thirdMigration = new Mock<IMigration>();
thirdMigration
.Setup(x => x.Version)
.Returns(new MigrationVersion(1, 2));

thirdMigration.Setup(x => x.Dependencies)
.Returns(new List<MigrationVersion>());

var migrations = new List<IMigration>
{
firstMigration.Object,
Expand Down Expand Up @@ -145,15 +151,21 @@ public async Task UpgradeWithNotSpecifiedTarget_On_MigrateAsync()
firstMigration
.Setup(x => x.Version)
.Returns(new MigrationVersion(1));
firstMigration.Setup(x => x.Dependencies)
.Returns(new List<MigrationVersion>());
var secondMigration = new Mock<IMigration>();
secondMigration
.Setup(x => x.Version)
.Returns(new MigrationVersion(1, 1));
secondMigration.Setup(x => x.Dependencies)
.Returns(new List<MigrationVersion>());
var thirdMigration = new Mock<IMigration>();
thirdMigration
.Setup(x => x.Version)
.Returns(new MigrationVersion(1, 2));

thirdMigration.Setup(x => x.Dependencies)
.Returns(new List<MigrationVersion>());

var migrations = new List<IMigration>
{
firstMigration.Object,
Expand Down Expand Up @@ -257,25 +269,33 @@ public async Task SkipLongRunningMigration_On_MigrateAsync()
firstMigration
.Setup(x => x.Version)
.Returns(new MigrationVersion(1));
firstMigration.Setup(x => x.Dependencies)
.Returns(new List<MigrationVersion>());
var secondMigration = new Mock<IMigration>();
secondMigration
.Setup(x => x.Version)
.Returns(new MigrationVersion(1, 1));
secondMigration
.Setup(x => x.IsLongRunning)
.Returns(true);
secondMigration.Setup(x => x.Dependencies)
.Returns(new List<MigrationVersion>());
var thirdMigration = new Mock<IMigration>();
thirdMigration
.Setup(x => x.Version)
.Returns(new MigrationVersion(1, 2));
thirdMigration
.Setup(x => x.IsLongRunning)
.Returns(true);
thirdMigration.Setup(x => x.Dependencies)
.Returns(new List<MigrationVersion>());
var fourthMigration = new Mock<IMigration>();
fourthMigration
.Setup(x => x.Version)
.Returns(new MigrationVersion(2));

fourthMigration.Setup(x => x.Dependencies)
.Returns(new List<MigrationVersion>());

var migrations = new List<IMigration>
{
firstMigration.Object,
Expand Down Expand Up @@ -328,25 +348,33 @@ public async Task SkipShortRunningMigration_On_MigrateAsync()
firstMigration
.Setup(x => x.Version)
.Returns(new MigrationVersion(1));
firstMigration.Setup(x => x.Dependencies)
.Returns(new List<MigrationVersion>());
var secondMigration = new Mock<IMigration>();
secondMigration
.Setup(x => x.Version)
.Returns(new MigrationVersion(1, 1));
secondMigration
.Setup(x => x.IsLongRunning)
.Returns(true);
secondMigration.Setup(x => x.Dependencies)
.Returns(new List<MigrationVersion>());
var thirdMigration = new Mock<IMigration>();
thirdMigration
.Setup(x => x.Version)
.Returns(new MigrationVersion(1, 2));
thirdMigration
.Setup(x => x.IsLongRunning)
.Returns(true);
thirdMigration.Setup(x => x.Dependencies)
.Returns(new List<MigrationVersion>());
var fourthMigration = new Mock<IMigration>();
fourthMigration
.Setup(x => x.Version)
.Returns(new MigrationVersion(2));

fourthMigration.Setup(x => x.Dependencies)
.Returns(new List<MigrationVersion>());

var migrations = new List<IMigration>
{
firstMigration.Object,
Expand Down Expand Up @@ -399,25 +427,33 @@ public async Task ExecutesOnlyTargetLongRunning_On_MigrateAsync()
firstMigration
.Setup(x => x.Version)
.Returns(new MigrationVersion(1));
firstMigration.Setup(x => x.Dependencies)
.Returns(new List<MigrationVersion>());
var secondMigration = new Mock<IMigration>();
secondMigration
.Setup(x => x.Version)
.Returns(new MigrationVersion(1, 1));
secondMigration
.Setup(x => x.IsLongRunning)
.Returns(true);
secondMigration.Setup(x => x.Dependencies)
.Returns(new List<MigrationVersion>());
var thirdMigration = new Mock<IMigration>();
thirdMigration
.Setup(x => x.Version)
.Returns(new MigrationVersion(1, 2));
thirdMigration
.Setup(x => x.IsLongRunning)
.Returns(true);
thirdMigration.Setup(x => x.Dependencies)
.Returns(new List<MigrationVersion>());
var fourthMigration = new Mock<IMigration>();
fourthMigration
.Setup(x => x.Version)
.Returns(new MigrationVersion(2));

fourthMigration.Setup(x => x.Dependencies)
.Returns(new List<MigrationVersion>());

var migrations = new List<IMigration>
{
firstMigration.Object,
Expand Down Expand Up @@ -681,6 +717,9 @@ private IMigration GetIMigrationMock(string version)
.Setup(x => x.Version)
.Returns(new MigrationVersion(version));

migration.Setup(x => x.Dependencies)
.Returns(new List<MigrationVersion>());

return migration.Object;
}

Expand Down Expand Up @@ -711,14 +750,20 @@ public async Task MigrateAsync_Downgrade_Ok()
firstMigration
.Setup(x => x.Version)
.Returns(new MigrationVersion(1));
firstMigration.Setup(x => x.Dependencies)
.Returns(new List<MigrationVersion>());
var secondMigration = new Mock<IDowngradeMigration>();
secondMigration
.Setup(x => x.Version)
.Returns(new MigrationVersion(1, 1));
secondMigration.Setup(x => x.Dependencies)
.Returns(new List<MigrationVersion>());
var thirdMigration = new Mock<IDowngradeMigration>();
thirdMigration
.Setup(x => x.Version)
.Returns(new MigrationVersion(1, 2));
thirdMigration.Setup(x => x.Dependencies)
.Returns(new List<MigrationVersion>());

var migrations = new List<IMigration>
{
Expand Down Expand Up @@ -770,19 +815,27 @@ public async Task MigrateAsync_DowngradeForbidden_Error()
firstMigration
.Setup(x => x.Version)
.Returns(new MigrationVersion(1));
firstMigration.Setup(x => x.Dependencies)
.Returns(new List<MigrationVersion>());
var secondMigration = new Mock<IDowngradeMigration>();
secondMigration
.Setup(x => x.Version)
.Returns(new MigrationVersion(1, 1));
secondMigration.Setup(x => x.Dependencies)
.Returns(new List<MigrationVersion>());
var thirdMigration = new Mock<IDowngradeMigration>();
thirdMigration
.Setup(x => x.Version)
.Returns(new MigrationVersion(1, 2));
thirdMigration.Setup(x => x.Dependencies)
.Returns(new List<MigrationVersion>());
var fourthMigration = new Mock<IDowngradeMigration>();
fourthMigration
.Setup(x => x.Version)
.Returns(new MigrationVersion(2));

fourthMigration.Setup(x => x.Dependencies)
.Returns(new List<MigrationVersion>());

var migrations = new List<IMigration>
{
firstMigration.Object,
Expand Down

0 comments on commit 0122980

Please sign in to comment.