Beispiel #1
0
        public void TestFind()
        {
            Support.ExecSql(@"insert into time_entries (id, project_id, user_id, date, hours) 
            values (2346, 22, 12, now(), 8);");

            var gateway = new TimeEntryDataGateway(new TimeEntryContext(DbContextOptions));
            var list    = gateway.FindBy(12);

            // todo...
            var actual = list.First();

            Assert.Equal(2346, actual.Id);
            Assert.Equal(22, actual.ProjectId);
            Assert.Equal(12, actual.UserId);
        }
        public void TestFind()
        {
            var support = new TestDatabaseSupport(_dataSourceConfig);

            support.ExecSql(@"
insert into users (id, name) values (12, 'Jack');
insert into accounts (id, owner_id, name) values (1, 12, 'anAccount');
insert into projects (id, account_id, name) values (22, 1, 'aProject');
insert into time_entries (id, project_id, user_id, date, hours) values (2346, 22, 12, now(), 8);
");

            var gateway = new TimeEntryDataGateway(new DatabaseTemplate(_dataSourceConfig));
            var list    = gateway.FindBy(12);

            // todo...
            var actual = list.First();

            Assert.Equal(2346, actual.Id);
            Assert.Equal(22, actual.ProjectId);
            Assert.Equal(12, actual.UserId);
        }