public void GetOrCreateSetsDefaultValueIfNoneExists() { var settings = new SettingsStorageProxy(); settings.GetOrCreateProxy(42, "TestNumber"); Assert.Equal(42, settings.GetOrCreateProxy(20, "TestNumber")); }
public void GetOrCreateSmokeTest() { var settings = new SettingsStorageProxy(); settings.SetOrCreateProxy(42, "TestNumber"); Assert.Equal(42, settings.GetOrCreateProxy(20, "TestNumber")); }
public async Task GetOrCreateInsertsDefaultValueIntoBlobCache() { var cache = new InMemoryBlobCache(); var settings = new SettingsStorageProxy(cache); settings.GetOrCreateProxy(42, "TestNumber"); Assert.Equal(1, await cache.GetAllKeys().Count()); }
public void GetOrCreateHitsInternalCacheFirst() { var cache = Substitute.For <IBlobCache>(); var settings = new SettingsStorageProxy(cache); settings.SetOrCreateProxy(42, "TestNumber"); settings.GetOrCreateProxy(20, "TestNumber"); cache.ReceivedWithAnyArgs(1).Insert(Arg.Any <string>(), Arg.Any <byte[]>(), Arg.Any <DateTimeOffset?>()); }
public void GetOrCreateWithNullKeyThrowsArgumentNullException() { var settings = new SettingsStorageProxy(); Assert.Throws <ArgumentNullException>(() => settings.GetOrCreateProxy(42, null)); }