private static void ValidateDatabaseVersion(RiskeerEntities riskeerEntities, string databaseFilePath) { try { string databaseVersion = riskeerEntities.VersionEntities.Select(v => v.Version).Single(); if (!ProjectVersionHelper.IsValidVersion(databaseVersion)) { string m = string.Format(Resources.StorageSqLite_ValidateDatabaseVersion_DatabaseVersion_0_is_invalid, databaseVersion); string message = new FileReaderErrorMessageBuilder(databaseFilePath).Build(m); throw new StorageValidationException(message); } if (ProjectVersionHelper.IsNewerThanCurrent(databaseVersion)) { string m = string.Format(Resources.StorageSqLite_ValidateDatabaseVersion_DatabaseVersion_0_higher_then_current_DatabaseVersion_1_, databaseVersion, ProjectVersionHelper.GetCurrentDatabaseVersion()); string message = new FileReaderErrorMessageBuilder(databaseFilePath).Build(m); throw new StorageValidationException(message); } } catch (InvalidOperationException e) { string message = new FileReaderErrorMessageBuilder(databaseFilePath).Build(Resources.StorageSqLite_ValidateDatabaseVersion_Database_must_have_one_VersionEntity_row); throw new StorageValidationException(message, e); } }
public void IsValidVersion_ValidVersion_ReturnsTrue(string validVersion) { // Call bool isNewer = ProjectVersionHelper.IsValidVersion(validVersion); // Assert Assert.IsTrue(isNewer); }
public void IsValidVersion_InvalidVersion_ReturnsFalse(string invalidVersion) { // Call bool isNewer = ProjectVersionHelper.IsValidVersion(invalidVersion); // Assert Assert.IsFalse(isNewer); }