Exemplo n.º 1
0
        public void TestGetDecimalValueGetFieldValue()
        {
            KoraliumConnectionStringBuilder builder = new KoraliumConnectionStringBuilder();

            builder.DataSource = webFactory.GetUrl();

            KoraliumConnection connection = new KoraliumConnection();

            connection.ConnectionString = builder.ConnectionString;
            connection.Open();

            var cmd = connection.CreateCommand();

            cmd.CommandText = "select decimalvalue from typetest";

            var reader = cmd.ExecuteReader();

            var decimalordinal = reader.GetOrdinal("decimalvalue");

            List <decimal> actual = new List <decimal>();

            while (reader.Read())
            {
                var val = reader.GetFieldValue <decimal>(decimalordinal);
                actual.Add(val);
            }

            List <decimal> expected = new List <decimal>
            {
                1,
                3,
                17,
                1,
                3
            };

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 2
0
        public void TestSelectString()
        {
            KoraliumConnectionStringBuilder builder = new KoraliumConnectionStringBuilder();

            builder.DataSource = webFactory.GetUrl();

            KoraliumConnection connection = new KoraliumConnection();

            connection.ConnectionString = builder.ConnectionString;
            connection.Open();

            var cmd = connection.CreateCommand();

            cmd.CommandText = "select * from project";

            var reader = cmd.ExecuteReader();

            var companyOrdinal = reader.GetOrdinal("company");

            while (reader.Read())
            {
                var company = reader.GetFieldValue <Company>(companyOrdinal);
            }
        }