public void TestSqlConnectionNumbersMappedNullCrudAsync()
        {
            // Setup
            var entity = new NumbersMappedClass
            {
                SessionId              = Guid.NewGuid(),
                ColumnBigIntMapped     = null,
                ColumnBitMapped        = null,
                ColumnDecimalMapped    = null,
                ColumnFloatMapped      = null,
                ColumnIntMapped        = null,
                ColumnMoneyMapped      = null,
                ColumnNumericMapped    = null,
                ColumnRealMapped       = null,
                ColumnSmallIntMapped   = null,
                ColumnSmallMoneyMapped = null
            };

            using (var connection = new SqlConnection(Database.ConnectionStringForRepoDb))
            {
                // Act Insert
                var insertResult = connection.InsertAsync(entity);
                var id           = insertResult.Result;

                // Act Query
                var queryResult = connection.QueryAsync <NumbersMappedClass>(e => e.SessionId == (Guid)id);
                var data        = queryResult.Result.FirstOrDefault();

                // Assert
                Assert.IsNotNull(data);
                Assert.IsNull(data.ColumnBigIntMapped);
                Assert.IsNull(data.ColumnBitMapped);
                Assert.IsNull(data.ColumnDecimalMapped);
                Assert.IsNull(data.ColumnFloatMapped);
                Assert.IsNull(data.ColumnIntMapped);
                Assert.IsNull(data.ColumnMoneyMapped);
                Assert.IsNull(data.ColumnNumericMapped);
                Assert.IsNull(data.ColumnRealMapped);
                Assert.IsNull(data.ColumnSmallIntMapped);
                Assert.IsNull(data.ColumnSmallMoneyMapped);
            }
        }
示例#2
0
        public void TestDbRepositoryNumbersMappedCrudAsync()
        {
            // Setup
            var entity = new NumbersMappedClass
            {
                SessionId              = Guid.NewGuid(),
                ColumnBigIntMapped     = 12345,
                ColumnBitMapped        = true,
                ColumnDecimalMapped    = 12345,
                ColumnFloatMapped      = (float)12345.12,
                ColumnIntMapped        = 12345,
                ColumnMoneyMapped      = (decimal)12345.12,
                ColumnNumericMapped    = 12345,
                ColumnRealMapped       = (float)12345.12,
                ColumnSmallIntMapped   = 12345,
                ColumnSmallMoneyMapped = 13456
            };

            using (var repository = new DbRepository <SqlConnection>(Database.ConnectionStringForRepoDb))
            {
                // Act Insert
                var insertResult = repository.InsertAsync(entity);
                var id           = insertResult.Result;

                // Act Query
                var queryResult = repository.QueryAsync <NumbersMappedClass>(e => e.SessionId == (Guid)id);
                var data        = queryResult.Result.FirstOrDefault();

                // Assert
                Assert.IsNotNull(data);
                Assert.AreEqual(entity.ColumnBigIntMapped, data.ColumnBigIntMapped);
                Assert.AreEqual(entity.ColumnBitMapped, data.ColumnBitMapped);
                Assert.AreEqual(entity.ColumnDecimalMapped, data.ColumnDecimalMapped);
                Assert.AreEqual(entity.ColumnFloatMapped, data.ColumnFloatMapped);
                Assert.AreEqual(entity.ColumnIntMapped, data.ColumnIntMapped);
                Assert.AreEqual(entity.ColumnMoneyMapped, data.ColumnMoneyMapped);
                Assert.AreEqual(entity.ColumnNumericMapped, data.ColumnNumericMapped);
                Assert.AreEqual(entity.ColumnRealMapped, data.ColumnRealMapped);
                Assert.AreEqual(entity.ColumnSmallIntMapped, data.ColumnSmallIntMapped);
                Assert.AreEqual(entity.ColumnSmallMoneyMapped, data.ColumnSmallMoneyMapped);
            }
        }
        public void TestSqlConnectionNumbersMappedCrud()
        {
            // Setup
            var entity = new NumbersMappedClass
            {
                SessionId              = Guid.NewGuid(),
                ColumnBigIntMapped     = 12345,
                ColumnBitMapped        = true,
                ColumnDecimalMapped    = 12345,
                ColumnFloatMapped      = (float)12345.12,
                ColumnIntMapped        = 12345,
                ColumnMoneyMapped      = (decimal)12345.12,
                ColumnNumericMapped    = 12345,
                ColumnRealMapped       = (float)12345.12,
                ColumnSmallIntMapped   = 12345,
                ColumnSmallMoneyMapped = 13456
            };

            using (var connection = new SqlConnection(Database.ConnectionStringForRepoDb))
            {
                // Act Insert
                var id = connection.Insert(entity);

                // Act Query
                var data = connection.Query <NumbersMappedClass>(e => e.SessionId == (Guid)id).FirstOrDefault();

                // Assert
                Assert.IsNotNull(data);
                Assert.AreEqual(entity.ColumnBigIntMapped, data.ColumnBigIntMapped);
                Assert.AreEqual(entity.ColumnBitMapped, data.ColumnBitMapped);
                Assert.AreEqual(entity.ColumnDecimalMapped, data.ColumnDecimalMapped);
                Assert.AreEqual(entity.ColumnFloatMapped, data.ColumnFloatMapped);
                Assert.AreEqual(entity.ColumnIntMapped, data.ColumnIntMapped);
                Assert.AreEqual(entity.ColumnMoneyMapped, data.ColumnMoneyMapped);
                Assert.AreEqual(entity.ColumnNumericMapped, data.ColumnNumericMapped);
                Assert.AreEqual(entity.ColumnRealMapped, data.ColumnRealMapped);
                Assert.AreEqual(entity.ColumnSmallIntMapped, data.ColumnSmallIntMapped);
                Assert.AreEqual(entity.ColumnSmallMoneyMapped, data.ColumnSmallMoneyMapped);
            }
        }
示例#4
0
        public void TestDbRepositoryNumbersMappedNullCrud()
        {
            // Setup
            var entity = new NumbersMappedClass
            {
                SessionId              = Guid.NewGuid(),
                ColumnBigIntMapped     = null,
                ColumnBitMapped        = null,
                ColumnDecimalMapped    = null,
                ColumnFloatMapped      = null,
                ColumnIntMapped        = null,
                ColumnMoneyMapped      = null,
                ColumnNumericMapped    = null,
                ColumnRealMapped       = null,
                ColumnSmallIntMapped   = null,
                ColumnSmallMoneyMapped = null
            };

            using (var repository = new DbRepository <SqlConnection>(Database.ConnectionStringForRepoDb))
            {
                // Act Insert
                var id = repository.Insert(entity);

                // Act Query
                var data = repository.Query <NumbersMappedClass>(e => e.SessionId == (Guid)id).FirstOrDefault();

                // Assert
                Assert.IsNotNull(data);
                Assert.IsNull(data.ColumnBigIntMapped);
                Assert.IsNull(data.ColumnBitMapped);
                Assert.IsNull(data.ColumnDecimalMapped);
                Assert.IsNull(data.ColumnFloatMapped);
                Assert.IsNull(data.ColumnIntMapped);
                Assert.IsNull(data.ColumnMoneyMapped);
                Assert.IsNull(data.ColumnNumericMapped);
                Assert.IsNull(data.ColumnRealMapped);
                Assert.IsNull(data.ColumnSmallIntMapped);
                Assert.IsNull(data.ColumnSmallMoneyMapped);
            }
        }