Exemple #1
0
        public void Persist_Compression()
        {
            var session = SessionFactoryProvider.Instance.OpenSession();

            JsonCompressor.CompressionThreshold = 10;
            var id        = 12;
            var identifer = Guid.NewGuid();
            var repo      = new ExampleEntityRepository(session);
            var entity    = new ExampleEntity(id, "Something", new ExampleJsonModel(identifer, new List <string> {
                "AAAAAA", "BBBBBBBB", "CCCCCCC", "DDDDDDD"
            }));

            repo.Save(entity);
            repo.Flush();

            var found = repo.FindAll();

            Assert.Equal(1, found.Count);

            Assert.Equal(id, entity.Id);
            Assert.Equal("Something", found.First().Title);
            Assert.Equal(identifer, entity.Json.Identifier);
            Assert.Equal("AAAAAA", entity.Json.List.First());
            session.Dispose();
            JsonCompressor.CompressionThreshold = 10000;
        }
Exemple #2
0
        public void CanSetupSession()
        {
            var session = SessionFactoryProvider.Instance.OpenSession();

            var repo = new ExampleEntityRepository(session);

            Assert.NotNull(repo);
        }