Пример #1
0
        public void GuidTest()
        {
            TestGuidRecord record = TestData.CreateTestGuidRecord("test");

            Assert.IsTrue(DbTestUtils.SaveTest(record));

            var recordLoaded = gateway.Load <TestGuidRecord>(record.Guid);

            assert(record, recordLoaded);

            record.Title = "test2";
            Assert.IsTrue(DbTestUtils.UpdateTest(record));


            var workLog2 = gateway.Load <TestGuidRecord>(record.Guid);

            Assert.IsNotNull(workLog2);
            assert(record, workLog2);

            var workLog3 = new TestGuidRecord();

            Assert.IsTrue(gateway.Load(workLog3, "Guid", record.Guid));
            assert(record, workLog3);

            DbTestUtils.DeleteTest(record);

            Assert.IsNull(gateway.Load <TestGuidRecord>(record.Guid));
        }
Пример #2
0
        private void AssertWorkLog(WorkLog workLog, WorkLog workLog2)
        {
            Assert.AreEqual(workLog.Id, workLog2.Id);
            Assert.AreEqual(workLog.Description, workLog2.Description);

            Assert.AreEqual(0, DbTestUtils.DiffInSeconds(workLog.Date, workLog2.Date));
            Assert.AreEqual(0, DbTestUtils.DiffInSeconds(workLog.Timestamp, workLog2.Timestamp));
        }
Пример #3
0
        public void EmptyGuidTest()
        {
            TestGuidRecord record2 = TestData.CreateTestGuidRecord("test");

            record2.TestGuidField = Guid.Empty;
            Assert.IsTrue(DbTestUtils.SaveTest(record2));

            var record2Loaded = gateway.Load <TestGuidRecord>(record2.Guid);

            assert(record2, record2Loaded);
        }
Пример #4
0
        public void SetUp()
        {
            TestData    = new TestData(gateway.Accessor);
            DbTestUtils = new DbTestUtils(gateway.Accessor);

            sgateway.DropTables(Assembly);

            CreateTables();

            TestData.CreateUser();
        }
Пример #5
0
        public void ConvertBinaryToStringTest()
        {
            var record = new BinaryDataRecord3 {
                Data = "77"
            };

            Assert.IsTrue(DbTestUtils.SaveTest(record));

            var record2 = gateway.Load <BinaryDataRecord3>(record.Id);

            Assert.AreEqual(record.Data, record2.Data);
        }
Пример #6
0
        public void BinaryTest()
        {
            const int value = 777;

            BinaryDataRecord record = new BinaryDataRecord {
                Data = BitConverter.GetBytes(value)
            };

            Assert.IsTrue(DbTestUtils.SaveTest(record));

            BinaryDataRecord record2 = gateway.Load <BinaryDataRecord>(record.Id);

            Assert.AreEqual(record.Data, record2.Data);
            Assert.AreEqual(value, BitConverter.ToInt32(record2.Data, 0));
        }
Пример #7
0
        public void GatewayCoreTest()
        {
            var workLog = TestData.CreateWorkLog("Test");

            DbTestUtils.SaveTest(workLog);

            workLog.Description = "test2";
            DbTestUtils.UpdateTest(workLog);


            var workLog2 = gateway.Load <WorkLog>(workLog.Id);

            AssertWorkLog(workLog, workLog2);

            var workLog3 = new WorkLog();

            Assert.IsTrue(gateway.Load(workLog3, "Id", workLog.Id));
            AssertWorkLog(workLog, workLog3);

            DbTestUtils.DeleteTest(workLog);

            Assert.IsNull(gateway.Load <WorkLog>(workLog.Id));
        }