Exemplo n.º 1
0
        public void SelectAllFrom_UseCache()
        {
            var value = new TableWithGuid
            {
                Id   = Guid.NewGuid(),
                Text = "Text"
            };

            connection.Save(value);
            var parent = new ParentTableWithGuid {
                Key = Guid.NewGuid(), Reference = value
            };

            connection.Save(parent);
            var grandParent = new GrandParentWithGuid {
                Key = Guid.NewGuid(), Reference = parent
            };

            connection.Save(grandParent);
            value = connection.Get <TableWithGuid>(value.Id);
            var all = connection.SelectAllFrom <GrandParentWithGuid>().Where(x => x.Reference == parent).ToList();

            Assert.Equal(value, all[0].Reference.Reference);
            Assert.Equal("Text", value.Text);
        }
Exemplo n.º 2
0
        public void Load_ObjectWithGuid_WithAutoJoin()
        {
            var value = new TableWithGuid
            {
                Id   = Guid.NewGuid(),
                Text = "Text"
            };

            connection.Save(value);
            var parent = new ParentTableWithGuid
            {
                Key       = Guid.NewGuid(),
                Text      = "Parent",
                Reference = value
            };

            connection.Save(parent);
            var result = connection.Load <ParentTableWithGuid>(parent.Key, x => x.Reference);

            Assert.Equal(parent.Key, result.Key);
            Assert.Equal(parent.Text, result.Text);
            Assert.Equal(value.Id, parent.Reference.Id);
            Assert.Equal(value.Text, parent.Reference.Text);
        }