Пример #1
0
        public async Task Test_CreateAsIdentity_LoadAndCheckEqual()
        {
            var p0 = new TrackableTestTypePoco();

            p0.ValBool           = true;
            p0.ValByte           = 1;
            p0.ValShort          = 1;
            p0.ValChar           = '\x1';
            p0.ValInt            = 1;
            p0.ValLong           = 1;
            p0.ValFloat          = 1;
            p0.ValDouble         = 1;
            p0.ValDecimal        = 1;
            p0.ValDateTime       = new DateTime(2001, 1, 1, 1, 1, 1);
            p0.ValDateTimeOffset = new DateTimeOffset(2001, 1, 1, 1, 1, 1, TimeSpan.Zero);
            p0.ValTimeSpan       = new TimeSpan(1, 1, 1);
            p0.ValString         = "1";
            p0.ValBytes          = new byte[] { 1 };
            p0.ValGuid           = new Guid(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
            p0.ValSuit           = Suit.Spade;

            await _mapper.CreateAsync(_db, p0, _testId);

            var p1 = await _mapper.LoadAsync(_db, _testId);

            AssertTestPocoEqual(p0, p1);
        }
Пример #2
0
        public async Task Test_CreateAsMinimum_LoadAndCheckEqual()
        {
            var p0 = new TrackableTestTypePoco();

            p0.ValBool  = false;
            p0.ValByte  = 0;
            p0.ValShort = -32768;
            p0.ValChar  = '\x0';
            p0.ValInt   = -2147483648;
            p0.ValLong  = -9223372036854775807L;

            // just arbitrary value for float, double, decimal
            p0.ValFloat   = -9999.99f;
            p0.ValDouble  = -99999.99;
            p0.ValDecimal = -999999.99m;

            p0.ValDateTime       = DateTime.MinValue;
            p0.ValDateTimeOffset = DateTimeOffset.MinValue;
            p0.ValTimeSpan       = TimeSpan.MinValue;

            p0.ValString = "0";
            p0.ValBytes  = new byte[] { 0 };
            p0.ValGuid   = Guid.Empty;
            p0.ValSuit   = (Suit)0;
            await _mapper.CreateAsync(_db, p0, _testId);

            var p1 = await _mapper.LoadAsync(_db, _testId);

            AssertTestPocoEqual(p0, p1);
        }
Пример #3
0
        public async Task Test_CreateAsMaximum_LoadAndCheckEqual()
        {
            var p0 = new TrackableTestTypePoco();

            p0.ValBool  = true;
            p0.ValByte  = 255;
            p0.ValShort = 32767;
            p0.ValChar  = '\xFFFF';
            p0.ValInt   = 2147483647;
            p0.ValLong  = 9223372036854775807L;

            // just arbitrary value for float, double, decimal
            p0.ValFloat   = 9999.99f;
            p0.ValDouble  = 99999.99;
            p0.ValDecimal = 999999.99m;

            p0.ValDateTime       = DateTime.MaxValue;
            p0.ValDateTimeOffset = DateTimeOffset.MaxValue;
            p0.ValTimeSpan       = TimeSpan.MaxValue;

            p0.ValString = "\xAC00\xD7A3";
            p0.ValBytes  = new byte[] { 0, 127, 255 };
            p0.ValGuid   = new Guid(0xFFFFFFFF, 0xFFFF, 0xFFFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
            p0.ValSuit   = (Suit)0xFF;
            await _mapper.CreateAsync(_db, p0, _testId);

            var p1 = await _mapper.LoadAsync(_db, _testId);

            AssertTestPocoEqual(p0, p1);
        }
Пример #4
0
        public TrackableTestTypePoco Clone()
        {
            var o = new TrackableTestTypePoco();

            o._ValBool           = _ValBool;
            o._ValByte           = _ValByte;
            o._ValShort          = _ValShort;
            o._ValChar           = _ValChar;
            o._ValInt            = _ValInt;
            o._ValLong           = _ValLong;
            o._ValFloat          = _ValFloat;
            o._ValDouble         = _ValDouble;
            o._ValDecimal        = _ValDecimal;
            o._ValDateTime       = _ValDateTime;
            o._ValDateTimeOffset = _ValDateTimeOffset;
            o._ValTimeSpan       = _ValTimeSpan;
            o._ValString         = _ValString;
            o._ValBytes          = _ValBytes;
            o._ValGuid           = _ValGuid;
            o._ValSuit           = _ValSuit;
            return(o);
        }