public void InitializeSettingCacheProvider() { LazyLoadSettingCacheProvider provider = new LazyLoadSettingCacheProvider(new LazyLoadManagerArguments()); provider.InitializeSettingCacheProvider(); Assert.IsFalse(provider.IsInitalized); }
public void ManagerArguments() { LazyLoadSettingCacheProvider provider = new LazyLoadSettingCacheProvider(new LazyLoadManagerArguments()); Assert.IsNotNull(provider.ManagerArguments); Assert.IsTrue(provider.ManagerArguments.GetType() == typeof(LazyLoadManagerArguments)); }
public void GetDbAppSetting_NotInitialized() { Assert.Throws(typeof(Exception), () => { DummyReturnOneLazyLoadSettingDao dao = new DummyReturnOneLazyLoadSettingDao(); LazyLoadSettingCacheProvider provider = new LazyLoadSettingCacheProvider(new LazyLoadManagerArguments() { LazyLoadSettingDao = dao, CacheRefreshTimeout = () => TimeSpan.FromMilliseconds(0) }); provider.GetDbAppSetting <DbAppSettingTestSetting, int>(); }); }
public void SettingWatchTaskAction_Results() { DummyReturnOneLazyLoadSettingDao dao = new DummyReturnOneLazyLoadSettingDao(); LazyLoadSettingCacheProvider provider = new LazyLoadSettingCacheProvider(new LazyLoadManagerArguments() { LazyLoadSettingDao = dao, CacheRefreshTimeout = () => TimeSpan.FromMilliseconds(0) }); provider.InitalizeSettingWatchTask(); SpinWait.SpinUntil(() => SettingCacheProviderBase.SettingDtosByKey.Count > 0); Assert.IsTrue(SettingCacheProviderBase.SettingDtosByKey.Count == 1); }
public void SettingWatchTaskAction_NoResults() { DummyLazyLoadSettingDao dao = new DummyLazyLoadSettingDao(); LazyLoadSettingCacheProvider provider = new LazyLoadSettingCacheProvider(new LazyLoadManagerArguments() { LazyLoadSettingDao = dao, CacheRefreshTimeout = () => TimeSpan.FromMilliseconds(0) }); provider.InitalizeSettingWatchTask(); SpinWait.SpinUntil(() => dao.GetChangedDbAppSettingsHitCount > 0); Assert.IsTrue(dao.GetChangedDbAppSettingsHitCount > 1); }
public void GetDbAppSettingInitialized() { DummyReturnDbAppSettingTestSettingLazyLoadSettingDao dao = new DummyReturnDbAppSettingTestSettingLazyLoadSettingDao(); LazyLoadSettingCacheProvider provider = new LazyLoadSettingCacheProvider(new LazyLoadManagerArguments() { LazyLoadSettingDao = dao, CacheRefreshTimeout = () => TimeSpan.FromMilliseconds(0) }); SettingCacheProviderBase.Initalized = true; Assert.IsTrue(SettingCacheProviderBase.SettingDtosByKey.Count == 0); DbAppSetting <DbAppSettingTestSetting, int> result = provider.GetDbAppSetting <DbAppSettingTestSetting, int>(); Assert.IsTrue(SettingCacheProviderBase.SettingDtosByKey.Count == 1); Assert.IsTrue(result.InternalValue == 100); Assert.IsTrue(dao.GetDbAppSettingHitCount == 1); }