public void Insert_IGloballyUniqueEntity()
        {
            var tableName = "table_d";
            var entity    = new EntityB()
            {
                Data             = new byte[] { 0x0, 0x1, 0x2 },
                DateTime         = DateTime.MinValue,
                DateTimeOffset   = DateTimeOffset.MinValue,
                Integer          = int.MinValue,
                NullableDateTime = DateTime.MinValue,
                NullableInteger  = int.MinValue,
                String           = new string('S', 120),
                Varchar          = new string('S', 50)
            };

            provider.CreateTable <EntityB>(tableName);

            var id = provider.Insert(tableName, entity);

            Assert.IsTrue(id != Guid.Empty);
            Assert.AreEqual(id, entity.Guid);
        }
        public void Query_IGloballyUniqueEntity()
        {
            var tableName = "table_d";
            var expected  = new EntityB()
            {
                Data             = new byte[] { 0x0, 0x1, 0x2 },
                DateTime         = DateTime.MinValue,
                DateTimeOffset   = new DateTimeOffset(DateTime.Today).ToOffset(TimeSpan.FromHours(6)),
                Integer          = int.MinValue,
                NullableDateTime = DateTime.MinValue,
                NullableInteger  = int.MinValue,
                String           = new string('S', 120),
                Varchar          = new string('S', 50)
            };

            provider.CreateTable <EntityB>(tableName);

            var id = provider.Insert(tableName, expected);

            var actual = provider.Query <EntityB>($"SELECT * FROM {provider.ResolveTableName("table_d")} WHERE \"Guid\" = @0", expected.Guid)
                         .FirstOrDefault();

            Assert.IsNotNull(actual);
            Assert.AreEqual(expected.Guid, actual.Guid);
            Assert.AreEqual(expected.DateTime, actual.DateTime);
            Assert.AreEqual(expected.NullableDateTime, actual.NullableDateTime);
            Assert.AreEqual(expected.DateTimeOffset, actual.DateTimeOffset);
            Assert.AreEqual(expected.DateTimeOffset.Offset, actual.DateTimeOffset.Offset);
            Assert.AreEqual(expected.Integer, actual.Integer);
            Assert.AreEqual(expected.NullableInteger, actual.NullableInteger);
            Assert.AreEqual(expected.String, actual.String);
            Assert.AreEqual(expected.Varchar, actual.Varchar);

            for (var i = 0; i < expected.Data.Length; i++)
            {
                Assert.AreEqual(expected.Data[i], actual.Data[i]);
            }
        }
        public void Query_IGloballyUniqueEntity_SkippingTableResolve()
        {
            var tableName = "table_d";
            var expected  = new EntityB()
            {
                Data             = new byte[] { 0x0, 0x1, 0x2 },
                DateTime         = DateTime.MinValue,
                DateTimeOffset   = DateTimeOffset.MinValue,
                Integer          = int.MinValue,
                NullableDateTime = DateTime.MinValue,
                NullableInteger  = int.MinValue,
                String           = new string('S', 120),
                Varchar          = new string('S', 50)
            };

            provider.CreateTable <EntityB>(tableName);
            var id = provider.Insert(tableName, expected);

            Assert.Throws <MissingPropertyException>(() =>
            {
                provider.Query <EntityB>($"SELECT \"Guid\" AS GUID FROM {provider.ResolveTableName(tableName)} WHERE \"Guid\" = @0", expected.Guid)
                .First();
            });
        }