public void TestBaseRepositoryNumbersNullCrudAsync()
        {
            // Setup
            var entity = new NumbersClass
            {
                SessionId        = Guid.NewGuid(),
                ColumnBigInt     = null,
                ColumnBit        = null,
                ColumnDecimal    = null,
                ColumnFloat      = null,
                ColumnInt        = null,
                ColumnMoney      = null,
                ColumnNumeric    = null,
                ColumnReal       = null,
                ColumnSmallInt   = null,
                ColumnSmallMoney = null
            };

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

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

                // Assert
                Assert.IsNotNull(data);
                Assert.IsNull(data.ColumnBigInt);
                Assert.IsNull(data.ColumnBit);
                Assert.IsNull(data.ColumnDecimal);
                Assert.IsNull(data.ColumnFloat);
                Assert.IsNull(data.ColumnInt);
                Assert.IsNull(data.ColumnMoney);
                Assert.IsNull(data.ColumnNumeric);
                Assert.IsNull(data.ColumnReal);
                Assert.IsNull(data.ColumnSmallInt);
                Assert.IsNull(data.ColumnSmallMoney);
            }
        }
Пример #2
0
        public void TestBaseRepositoryNumbersCrudAsync()
        {
            // Setup
            var entity = new NumbersClass
            {
                SessionId        = Guid.NewGuid(),
                ColumnBigInt     = 12345,
                ColumnBit        = true,
                ColumnDecimal    = 12345,
                ColumnFloat      = (float)12345.12,
                ColumnInt        = 12345,
                ColumnMoney      = (decimal)12345.12,
                ColumnNumeric    = 12345,
                ColumnReal       = (float)12345.12,
                ColumnSmallInt   = 12345,
                ColumnSmallMoney = 12345
            };

            using (var repository = new NumbersClassRepository(Database.ConnectionStringForRepoDb))
            {
                // Act Insert
                var insertResult = repository.InsertAsync(entity);
                var id           = insertResult.Result.Extract();

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

                // Assert
                Assert.IsNotNull(data);
                Assert.AreEqual(entity.ColumnBigInt, data.ColumnBigInt);
                Assert.AreEqual(entity.ColumnBit, data.ColumnBit);
                Assert.AreEqual(entity.ColumnDecimal, data.ColumnDecimal);
                Assert.AreEqual(entity.ColumnFloat, data.ColumnFloat);
                Assert.AreEqual(entity.ColumnInt, data.ColumnInt);
                Assert.AreEqual(entity.ColumnMoney, data.ColumnMoney);
                Assert.AreEqual(entity.ColumnNumeric, data.ColumnNumeric);
                Assert.AreEqual(entity.ColumnReal, data.ColumnReal);
                Assert.AreEqual(entity.ColumnSmallInt, data.ColumnSmallInt);
                Assert.AreEqual(entity.ColumnSmallMoney, data.ColumnSmallMoney);
            }
        }