private static void TestSSLCore(Action <SyncConfiguration> setupSecureConfig, bool openAsync) { AsyncContext.Run(async() => { var user = await SyncTestHelpers.GetUser(); var realmUrl = SyncTestHelpers.GetRealmUrl(); var config = new SyncConfiguration(user, new Uri(realmUrl)); var secureRealmUrl = realmUrl.Replace("realm://", "realms://").Replace("9080", "9443"); var secureConfig = new SyncConfiguration(user, new Uri(secureRealmUrl), config.DatabasePath + "2"); setupSecureConfig(secureConfig); try { using (var realm = Realm.GetInstance(config)) { realm.Write(() => { realm.Add(new IntPrimaryKeyWithValueObject { Id = 1, StringValue = "some value" }); }); await realm.GetSession().WaitForUploadAsync(); } using (var newRealm = await SyncTestHelpers.GetInstanceAsync(secureConfig, openAsync)) { var items = newRealm.All <IntPrimaryKeyWithValueObject>(); Assert.That(items.Count(), Is.EqualTo(1)); Assert.That(items.Single().StringValue, Is.EqualTo("some value")); } } finally { Realm.DeleteRealm(config); Realm.DeleteRealm(secureConfig); } }); }
private void TestSSLCore(Action <SyncConfiguration> setupSecureConfig, bool openAsync) { AsyncContext.Run(async() => { var user = await SyncTestHelpers.GetUserAsync(); const string path = "~/TestSSLCore"; var realmUri = SyncTestHelpers.RealmUri(path); var config = new SyncConfiguration(user, realmUri); var secureRealmUri = SyncTestHelpers.SecureRealmUri(path); var secureConfig = new SyncConfiguration(user, secureRealmUri, config.DatabasePath + "2"); setupSecureConfig(secureConfig); using (var realm = GetRealm(config)) { realm.Write(() => { realm.Add(new IntPrimaryKeyWithValueObject { Id = 1, StringValue = "some value" }); }); await GetSession(realm).WaitForUploadAsync(); } using (var newRealm = await SyncTestHelpers.GetInstanceAsync(secureConfig, openAsync)) { CleanupOnTearDown(newRealm); var items = newRealm.All <IntPrimaryKeyWithValueObject>(); Assert.That(items.Count(), Is.EqualTo(1)); Assert.That(items.Single().StringValue, Is.EqualTo("some value")); } }); }