Ejemplo n.º 1
0
        public void TestFind()
        {
            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');");

            var gateway = new ProjectDataGateway(new ProjectContext(DbContextOptions));
            var list    = gateway.FindBy(1);

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

            Assert.Equal(22, actual.Id);
            Assert.Equal(1, actual.AccountId);
            Assert.Equal("aProject", actual.Name);
            Assert.True(actual.Active);
        }
Ejemplo n.º 2
0
        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');
");

            var gateway = new ProjectDataGateway(new DatabaseTemplate(_dataSourceConfig));
            var list    = gateway.FindBy(1);

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

            Assert.Equal(22, actual.Id);
            Assert.Equal(1, actual.AccountId);
            Assert.Equal("aProject", actual.Name);
            Assert.Equal(true, actual.Active);
        }