コード例 #1
0
        public void GetOrCreateSetsDefaultValueIfNoneExists()
        {
            var settings = new SettingsStorageProxy();

            settings.GetOrCreateProxy(42, "TestNumber");

            Assert.Equal(42, settings.GetOrCreateProxy(20, "TestNumber"));
        }
コード例 #2
0
        public void GetOrCreateSmokeTest()
        {
            var settings = new SettingsStorageProxy();

            settings.SetOrCreateProxy(42, "TestNumber");

            Assert.Equal(42, settings.GetOrCreateProxy(20, "TestNumber"));
        }
コード例 #3
0
        public async Task SetOrCreateInsertsValueIntoBlobCache()
        {
            var cache    = new InMemoryBlobCache();
            var settings = new SettingsStorageProxy(cache);

            settings.SetOrCreateProxy(42, "TestNumber");

            Assert.Equal(1, await cache.GetAllKeys().Count());
        }
コード例 #4
0
        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?>());
        }
コード例 #5
0
        public void GetOrCreateWithNullKeyThrowsArgumentNullException()
        {
            var settings = new SettingsStorageProxy();

            Assert.Throws <ArgumentNullException>(() => settings.GetOrCreateProxy(42, null));
        }