public void Resolve_twice_with_no_CompressionType_does_not_cache_compressed_result()
        {
            var xmlResult = ContentCacheManager.Resolve(
                () => model,
                MimeTypes.Xml,
                null,
                cacheClient,
                CacheKey,
                null);

            Assert.That(xmlResult, Is.EqualTo(xmlModel));

            xmlResult = ContentCacheManager.Resolve(
                () => model,
                MimeTypes.Xml,
                null,
                cacheClient,
                CacheKey,
                null);

            Assert.That(xmlResult, Is.EqualTo(xmlModel));

            var cachedResult = cacheClient.Get <ModelWithIdAndName>(CacheKey);

            ModelWithIdAndName.AssertIsEqual(model, cachedResult);

            var serializedCacheKey     = ContentCacheManager.GetSerializedCacheKey(CacheKey, MimeTypes.Xml);
            var serializedCachedResult = cacheClient.Get <string>(serializedCacheKey);

            Assert.That(serializedCachedResult, Is.EqualTo(xmlModel));

            AssertNoCompressedResults(cacheClient, serializedCacheKey);
        }
        public void Can_convert_model_with_TypeChar()
        {
            var model = new ModelWithIdAndName {
                Id = 1, Name = "in } valid"
            };
            var toModel = Serialize(model);

            ModelWithIdAndName.AssertIsEqual(toModel, model);
        }
Example #3
0
        public async Task Can_store_and_get_model()
        {
            var model    = ModelWithIdAndName.Create(1);
            var cacheKey = model.CreateUrn();
            await cacheClient.SetAsync(cacheKey, model);

            var existingModel = await cacheClient.GetAsync <ModelWithIdAndName>(cacheKey);

            ModelWithIdAndName.AssertIsEqual(existingModel, model);
        }
        public void Can_store_and_get_model()
        {
            var model    = ModelWithIdAndName.Create(1);
            var cacheKey = model.CreateUrn();

            cacheClient.Set(cacheKey, model);

            var existingModel = cacheClient.Get <ModelWithIdAndName>(cacheKey);

            ModelWithIdAndName.AssertIsEqual(existingModel, model);
        }
        public async Task Can_Store_and_GetById_ModelWithIdAndName()
        {
            await using IRedisClientAsync redis = new RedisClient(TestConfig.SingleHost);
            const int modelId = 1;
            var       to      = ModelWithIdAndName.Create(modelId);
            await redis.StoreAsync(to);

            var from = await redis.GetByIdAsync <ModelWithIdAndName>(modelId);

            ModelWithIdAndName.AssertIsEqual(to, from);
        }
Example #6
0
        public void Can_Store_and_GetById_ModelWithIdAndName()
        {
            using (var redis = new RedisClient(Config.MasterHost)) {
                const int modelId = 1;
                var       to      = ModelWithIdAndName.Create(modelId);
                redis.Store(to);

                var from = redis.GetById <ModelWithIdAndName>(modelId);

                ModelWithIdAndName.AssertIsEqual(to, from);
            }
        }
        public void Can_convert_model_with_ListChar()
        {
            var model = new ModelWithIdAndName {
                Id = 1, Name = "in [ valid"
            };
            var toModel = Serialize(model);

            ModelWithIdAndName.AssertIsEqual(toModel, model);

            var model2 = new ModelWithIdAndName {
                Id = 1, Name = "in valid]"
            };
            var toModel2 = Serialize(model2);

            ModelWithIdAndName.AssertIsEqual(toModel2, model2);
        }
        public void Can_Save_table_with_null_fields()
        {
            using var db = OpenDbConnection();
            db.CreateTable <ModelWithIdAndName>(true);

            var row = ModelWithIdAndName.Create(1);

            row.Name = null;

            db.Save(row);

            var rows = db.Select <ModelWithIdAndName>();

            Assert.That(rows, Has.Count.EqualTo(1));

            ModelWithIdAndName.AssertIsEqual(rows[0], row);
        }
Example #9
0
        public void Can_insert_table_with_null_fields()
        {
            using (var db = new OrmLiteConnectionFactory(ConnectionString, FirebirdDialect.Provider).Open())
            {
                db.CreateTable <ModelWithIdAndName>(true);
                db.DeleteAll <ModelWithIdAndName>();
                var row = ModelWithIdAndName.Create(0);
                row.Name = null;

                db.Insert(row);

                var rows = db.Select <ModelWithIdAndName>();

                Assert.That(rows, Has.Count.EqualTo(1));

                ModelWithIdAndName.AssertIsEqual(rows[0], row);
            }
        }
Example #10
0
        public void Can_insert_table_with_null_fields()
        {
            using (var db = ConnectionString.OpenDbConnection())
            {
                db.CreateTable <ModelWithIdAndName>(true);
                db.DeleteAll <ModelWithIdAndName>();
                var row = ModelWithIdAndName.Create(0);
                row.Name = null;

                db.Insert(row);

                var rows = db.Select <ModelWithIdAndName>();

                Assert.That(rows, Has.Count.EqualTo(1));

                ModelWithIdAndName.AssertIsEqual(rows[0], row);
            }
        }