Esempio n. 1
0
        public async Task StringTest()
        {
            using (DataTypesContext context = await DataTypesContext.Create(this))
            {
                await context.CheckValues <string>((o, v) => o.String = v,
                                                   null, "", "a", "abc", "a bad ba sdf asdf", "'", "\"",
                                                   "'asdfas'", "\"asdfasd\"", "a's'\"asdf'\"as", "a ' \" a",
                                                   new string('*', 1025), new string('*', 2049), "ÃÇßÑᾆΏ");

                // Split every character between 128 and 0xD7FF into 64
                // strings and try them out.  Disabled only so the test
                // doesn't take forever to run.
                //await context.CheckValues<string>((o, v) => o.String = v,
                //    Enumerable.Zip(
                //        Enumerable.Range(128, 0xD7FF),
                //        Enumerable.Range(128, 0xD7FF),
                //        (index, ch) => Tuple.Create(index, (char)ch))
                //    .GroupBy(pair => pair.Item1 % 64)
                //    .Select(group => new string(group.Select(pair => pair.Item2).ToArray()))
                //    .ToArray());

                await context.ExpectInsertFailure <string>((o, v) => o.String = v,
                                                           "\uDC801\uDC01");
            }
        }
Esempio n. 2
0
        public async Task CharTest()
        {
            using (DataTypesContext context = await DataTypesContext.Create(this))
            {
                await context.CheckValues <char>((o, v) => o.Char = v,
                                                 (char)0, (char)1, (char)2, ' ', '\t', '\n', '\b', '?',
                                                 'a', '1', '\u1000', 'Ã', 'Ç', 'ß', 'Ñ', 'ᾆ', 'Ώ');

                await context.ExpectInsertFailure <char>((o, v) => o.Char = v,
                                                         '\uDC01');
            }
        }
Esempio n. 3
0
        public async Task FloatTest()
        {
            using (DataTypesContext context = await DataTypesContext.Create(this))
            {
                await context.CheckValues <float>((o, v) => o.Float = v,
                                                  0.0f, float.MaxValue, float.MinValue, float.Epsilon, 1.0f,
                                                  1.5f, 2.0f, -2.0f, 3.14e12f, -5.2222e-10f);

                await context.ExpectInsertFailure <float>((o, v) => o.Float = v,
                                                          float.PositiveInfinity, float.NegativeInfinity, float.NaN);
            }
        }
Esempio n. 4
0
        public async Task DoubleTest()
        {
            using (DataTypesContext context = await DataTypesContext.Create(this))
            {
                await context.CheckValues <double>((o, v) => o.Double = v,
                                                   0.0, double.MaxValue, double.MinValue, double.Epsilon, 1.0,
                                                   1.5, 2.0, -2.0, 3.14e12, -5.2222e-10);

                await context.ExpectInsertFailure <double>((o, v) => o.Double = v,
                                                           double.PositiveInfinity, double.NegativeInfinity, double.NaN);
            }
        }