public void Roundtrip()
        {
            AssertExtensions.WithCulture("ru", delegate() {
                _storage.EnterFluidMode();
                var checker = new RoundtripChecker(_db, _storage);

                // supported ranks
                checker.Check(null, null);
                checker.Check((sbyte)123, (sbyte)123);
                checker.Check(1000, 1000);
                checker.Check(0x80000000L, 0x80000000L);
                checker.Check(3.14, 3.14);
                checker.Check("hello", "hello");
                checker.Check(SharedChecks.SAMPLE_DATETIME, SharedChecks.SAMPLE_DATETIME);
                checker.Check(SharedChecks.SAMPLE_BLOB, SharedChecks.SAMPLE_BLOB);

                // extremal vaues
                SharedChecks.CheckRoundtripOfExtremalValues(checker, checkDateTime: true);

                // conversion to string
                SharedChecks.CheckBigNumberRoundtripForcesString(checker);
                checker.Check(SharedChecks.SAMPLE_GUID, SharedChecks.SAMPLE_GUID.ToString());

                // bool
                checker.Check(true, (sbyte)1);
                checker.Check(false, (sbyte)0);

                // enum
                checker.Check(DayOfWeek.Thursday, (sbyte)4);
            });
        }
        public void Roundtrip()
        {
            AssertExtensions.WithCulture("ru", delegate() {
                _storage.EnterFluidMode();
                var checker = new RoundtripChecker(_db, _storage);

                // native SQLite types
                checker.Check(null, null);
                checker.Check("hello", "hello");
                checker.Check(123L, 123L);
                checker.Check(3.14, 3.14);
                checker.Check(SharedChecks.SAMPLE_BLOB, SharedChecks.SAMPLE_BLOB);

                // extremal vaues
                SharedChecks.CheckRoundtripOfExtremalValues(checker);

                // conversion to string
                checker.Check(SharedChecks.SAMPLE_DATETIME, "1984-06-14 11:22:33");
                SharedChecks.CheckBigNumberRoundtripForcesString(checker);

                // Guid
                checker.Check(SharedChecks.SAMPLE_GUID, SharedChecks.SAMPLE_GUID.ToByteArray());

                // upscale to long
                checker.Check(0, 0L);
                checker.Check(1, 1L);
                checker.Check(true, 1L);
                checker.Check(false, 0L);
                checker.Check(DayOfWeek.Thursday, 4L);
            });
        }
示例#3
0
        public void Roundtrip()
        {
            AssertExtensions.WithCulture("ru", delegate() {
                _storage.EnterFluidMode();
                var checker = new RoundtripChecker(_db, _storage);

                // similar to https://github.com/StackExchange/dapper-dot-net/issues/229
                _db.QueryExecuting += cmd => {
                    foreach (SqlParameter p in cmd.Parameters)
                    {
                        if (Equals(p.Value, DateTime.MinValue))
                        {
                            p.SqlDbType = SqlDbType.DateTime2;
                        }
                    }
                };

                // supported ranks
                checker.Check(null, null);
                checker.Check(255, (byte)255);
                checker.Check(1000, 1000);
                checker.Check(0x80000000L, 0x80000000L);
                checker.Check(3.14, 3.14);
                checker.Check("hello", "hello");
                checker.Check(SharedChecks.SAMPLE_DATETIME, SharedChecks.SAMPLE_DATETIME);
                checker.Check(SharedChecks.SAMPLE_DATETIME_OFFSET, SharedChecks.SAMPLE_DATETIME_OFFSET);
                checker.Check(SharedChecks.SAMPLE_GUID, SharedChecks.SAMPLE_GUID);
                checker.Check(SharedChecks.SAMPLE_BLOB, SharedChecks.SAMPLE_BLOB);

                // extremal vaues
                SharedChecks.CheckRoundtripOfExtremalValues(checker, checkDateTime: true, checkDateTimeOffset: true);

                // conversion to string
                SharedChecks.CheckBigNumberRoundtripForcesString(checker);

                // bool
                checker.Check(true, (byte)1);
                checker.Check(false, (byte)0);

                // enum
                checker.Check(DayOfWeek.Thursday, (byte)4);
            });
        }