public ConfigWithPath ( string newConfigPath ) : |
||
newConfigPath | string | Path to the realm, must be a valid full path for the current platform, relative subdirectory, or just filename. |
Résultat |
public void CanOverrideConfigurationFilename() { // Arrange var config = new RealmConfiguration(); var config2 = config.ConfigWithPath("fred.realm"); // Assert Assert.That(config2.DatabasePath, Is.StringEnding("fred.realm")); }
public void TriggerMigrationBySchemaVersion() { // Arrange var config1 = new RealmConfiguration("ChangingVersion.realm"); Realm.DeleteRealm(config1); // ensure start clean var realm1 = Realm.GetInstance(config1); // new database doesn't push back a version number Assert.That(config1.SchemaVersion, Is.EqualTo(0)); realm1.Dispose(); // Act var config2 = config1.ConfigWithPath("ChangingVersion.realm"); config2.SchemaVersion = 99; Realm realm2 = null; // should be updated by DoesNotThrow // Assert Assert.DoesNotThrow(() => realm2 = Realm.GetInstance(config2)); // same path, different version, should auto-migrate quietly Assert.That(realm2.Config.SchemaVersion, Is.EqualTo(99)); realm2.Dispose(); }
public void CanSetDefaultConfiguration() { // Arrange var config = new RealmConfiguration(); RealmConfiguration.DefaultConfiguration = config.ConfigWithPath("fred.realm"); // Assert Assert.That(RealmConfiguration.DefaultConfiguration.DatabasePath, Is.StringEnding("fred.realm")); }