public void TestGetOrCreateFromConfiguration() { // Default configur. var cfg = new CacheClientConfiguration("a"); var cache = Client.GetOrCreateCache <int, int>(cfg); TestUtils.AssertReflectionEqual(cfg, cache.GetConfiguration()); cache[1] = 1; // Create when exists. cache = Client.GetOrCreateCache <int, int>("a"); Assert.AreEqual(1, cache[1]); // Custom config. cfg = GetFullCacheConfiguration("b"); cache = Client.GetOrCreateCache <int, int>(cfg); ClientCacheConfigurationTest.AssertClientConfigsAreEqual(cfg, cache.GetConfiguration()); }
public void TestCreateFromConfiguration() { // Default config. var cfg = new CacheClientConfiguration("a"); var cache = Client.CreateCache <int, int>(cfg); TestUtils.AssertReflectionEqual(cfg, cache.GetConfiguration()); // Create when exists. var ex = Assert.Throws <IgniteClientException>(() => Client.CreateCache <int, int>(cfg)); Assert.AreEqual( "Failed to start cache (a cache with the same name is already started): a", ex.Message); Assert.AreEqual((int)ClientStatus.CacheExists, ex.ErrorCode); // Custom config. cfg = GetFullCacheConfiguration("b"); cache = Client.CreateCache <int, int>(cfg); ClientCacheConfigurationTest.AssertClientConfigsAreEqual(cfg, cache.GetConfiguration()); }