public async Task ExceptionThrownIfSecondUpdateDocumentFailure() { Mock.Setup(x => x.UpsertDocumentAsync(It.IsAny <object>())) .Returns(Task.FromResult(new Exception())); var migration = new _0003_TimedMigration(); Assert.ThrowsAnyAsync <Exception>(() => migration.ExectuteMigration(Mock.Object, 1)); }
public async Task MigrationCanBeUsedToSetupDatabase() { var callTimes = 0; Mock.Setup(x => x.UpdateVersionDocumentAsync(It.IsAny <int>(), It.IsAny <bool>())) .Callback(() => callTimes++).Returns( callTimes < 1 ? Task.CompletedTask : throw new Exception()); var migration = new _0003_TimedMigration(); migration.ExectuteMigration(Mock.Object, 1); Assert.Equal(updatedMigrationDocs.Count, 2); }