public void TestSetGet() { var cacheProvider = new IgniteOutputCacheProvider(); cacheProvider.Initialize("myProvider", new NameValueCollection { { "cacheName", "aspNetCache" } }); cacheProvider.Set("1", 3, DateTime.MaxValue); Assert.AreEqual(3, cacheProvider.Get("1")); }
/// <summary> /// Gets the initialized provider. /// </summary> private static IgniteOutputCacheProvider GetProvider() { var cacheProvider = new IgniteOutputCacheProvider(); cacheProvider.Initialize("testName", new NameValueCollection { { GridNameAttr, GridName }, { CacheNameAttr, CacheName } }); return(cacheProvider); }
public void TestStartFromWebConfigSection() { var cacheProvider = new IgniteOutputCacheProvider(); cacheProvider.Initialize("testName2", new NameValueCollection { { SectionNameAttr, "igniteConfiguration2" }, { CacheNameAttr, "cacheName2" } }); cacheProvider.Set("1", 3, DateTime.MaxValue); Assert.AreEqual(3, cacheProvider.Get("1")); }
public void TestInitialization() { var cacheProvider = new IgniteOutputCacheProvider(); // Not initialized. Assert.Throws <InvalidOperationException>(() => cacheProvider.Get("1")); // Invalid section. Assert.Throws <IgniteException>(() => cacheProvider.Initialize("testName", new NameValueCollection { { SectionNameAttr, "invalidSection" }, })); // Valid grid. cacheProvider = GetProvider(); cacheProvider.Set("1", 1, DateTime.MaxValue); Assert.AreEqual(1, cacheProvider.Get("1")); }
public void TestInitialization() { var cacheProvider = new IgniteOutputCacheProvider(); // Not initialized. Assert.Throws<InvalidOperationException>(() => cacheProvider.Get("1")); // Invalid section. Assert.Throws<IgniteException>(() => cacheProvider.Initialize("testName", new NameValueCollection { {SectionNameAttr, "invalidSection"}, })); // Valid grid. cacheProvider = GetProvider(); cacheProvider.Set("1", 1, DateTime.MaxValue); Assert.AreEqual(1, cacheProvider.Get("1")); }
public void TestInitialization() { var cacheProvider = new IgniteOutputCacheProvider(); // Not initialized Assert.Throws <InvalidOperationException>(() => cacheProvider.Get("1")); // Grid not started Assert.Throws <IgniteException>(() => cacheProvider.Initialize("testName", new NameValueCollection { { GridNameAttr, "invalidGridName" }, { CacheNameAttr, CacheName } })); // Valid grid cacheProvider = GetProvider(); cacheProvider.Set("1", 1, DateTime.MaxValue); Assert.AreEqual(1, cacheProvider.Get("1")); }
public void TestStartFromWebConfigSection() { var cacheProvider = new IgniteOutputCacheProvider(); cacheProvider.Initialize("testName2", new NameValueCollection { {SectionNameAttr, "igniteConfiguration2"}, {CacheNameAttr, "cacheName2"} }); cacheProvider.Set("1", 3, DateTime.MaxValue); Assert.AreEqual(3, cacheProvider.Get("1")); }
/// <summary> /// Gets the initialized provider. /// </summary> private static IgniteOutputCacheProvider GetProvider() { var cacheProvider = new IgniteOutputCacheProvider(); cacheProvider.Initialize("testName", new NameValueCollection { {GridNameAttr, GridName}, {CacheNameAttr, CacheName} }); return cacheProvider; }