コード例 #1
0
        public ExpiringDataStore(IExpirationPolicy <TValue, TExpirationInfo, TScanInfo> expirationPolicy, IEqualityComparer <TKey> equalityComparer)
        {
            ArgumentUtility.CheckNotNull("expirationPolicy", expirationPolicy);
            ArgumentUtility.CheckNotNull("equalityComparer", equalityComparer);

            _innerDataStore   = new SimpleDataStore <TKey, Tuple <TValue, TExpirationInfo> > (equalityComparer);
            _expirationPolicy = expirationPolicy;
            _nextScanInfo     = _expirationPolicy.GetNextScanInfo();
        }
コード例 #2
0
        public void Initialize_WithCustomEqualityComparer()
        {
            var dataStore = new SimpleDataStore <string, int?> (StringComparer.InvariantCultureIgnoreCase);

            dataStore.Add("a", 1);

            Assert.That(dataStore.ContainsKey("a"));
            Assert.That(dataStore.ContainsKey("A"));
        }
コード例 #3
0
        public void DefaultKeyExample()
        {
            const int id = 6133;
            const string value = "norfen pls";

            var db = new SimpleDataStore("keyExamples");
            var input = new KeyExampleClass {Id = id, Value = value};
            db.Save(input);

            var result = db.Get<KeyExampleClass>(id);
            Assert.Equal(result.Value, value);
        }
コード例 #4
0
ファイル: App.cs プロジェクト: hasnain2663/MvvmCross-1
        public App()
        {
            // set up the model
            var dataStore = new SimpleDataStore();

            this.RegisterServiceInstance <IDataStore>(dataStore);

            // set the start object
            var startApplicationObject = new StartApplicationObject();

            this.RegisterServiceInstance <IMvxStartNavigation>(startApplicationObject);
        }
コード例 #5
0
ファイル: App.cs プロジェクト: yaircl/MvvmCross-Tutorials
        public App()
        {
            Cirrious.MvvmCross.Plugins.File.PluginLoader.Instance.EnsureLoaded();
            Cirrious.MvvmCross.Plugins.ResourceLoader.PluginLoader.Instance.EnsureLoaded();

            // set up the model
            var dataStore = new SimpleDataStore();

            Mvx.RegisterSingleton <IDataStore>(dataStore);

            // set the start object
            RegisterAppStart <CustomerListViewModel>();
        }
コード例 #6
0
        public void NonIntegerKeyNoConfiguration()
        {
            var id = Guid.NewGuid();
            const string value = "dat not candel in yuor pokit";

            var db = new SimpleDataStore("keyExamples");

            var input = new GuidKeyExampleClass {Id = id, Value = value};
            db.Save(input);

            var result = db.Get<GuidKeyExampleClass>(id);
            Assert.Equal(result.Value, value);
        }
コード例 #7
0
        public void OverrideKeyExample()
        {
            const int id = 164;
            const int registrationNumber = 171339811;
            const string value = "acualy is beef";

            var db = new SimpleDataStore("keyExamples");
            db.Configure<KeyExampleClass>("keyExample1", "RegistrationNumber");

            var input = new KeyExampleClass {Id = id, RegistrationNumber = registrationNumber, Value = value};
            db.Save(input);

            var result = db.Get<KeyExampleClass>(id);
            Assert.Null(result);

            result = db.Get<KeyExampleClass>(registrationNumber);
            Assert.Equal(result.Value, value);
        }
コード例 #8
0
ファイル: Cache.cs プロジェクト: re-motion/Framework-Archive
 public Cache(IEqualityComparer <TKey> comparer)
 {
     _dataStore = new SimpleDataStore <TKey, TValue> (comparer);
 }
コード例 #9
0
 public void SetUp()
 {
     _store = new SimpleDataStore <string, int?>();
     _store.Add("a", 1);
     _store.Add("b", 2);
 }