public void NeedsMigrate_ValidVersionedFile_ReturnsIfNeedsMigrate(string fromVersion, string toVersion, bool shouldMigrate) { // Setup var mockRepository = new MockRepository(); var versionedFile = mockRepository.Stub <IVersionedFile>(); versionedFile.Expect(vf => vf.GetVersion()).Return(fromVersion); mockRepository.ReplayAll(); var migrator = new SimpleVersionedFileMigrator(new SimpleVersionComparer()) { CreateScripts = { new TestCreateScript(toVersion) }, UpgradeScripts = { new TestUpgradeScript(fromVersion, toVersion) } }; // Call bool needsMigrate = migrator.NeedsMigrate(versionedFile, toVersion); // Assert Assert.AreEqual(shouldMigrate, needsMigrate); mockRepository.VerifyAll(); }
public void NeedsMigrate_VersionedFileNull_ThrowsArgumentNullException() { // Setup var mockRepository = new MockRepository(); var comparer = mockRepository.Stub <IComparer>(); mockRepository.ReplayAll(); var migrator = new SimpleVersionedFileMigrator(comparer); // Call TestDelegate call = () => migrator.NeedsMigrate(null, ""); // Assert string paramName = Assert.Throws <ArgumentNullException>(call).ParamName; Assert.AreEqual("versionedFile", paramName); mockRepository.VerifyAll(); }