Пример #1
0
        public void TestFindObject()
        {
            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, active) values (22, 1, 'aProject', true);");

            var gateway = new ProjectDataGateway(new ProjectContext(DbContextOptions));
            var actual  = gateway.FindObject(22);

            // todo...
            Assert.Equal(22, actual.Id);
            Assert.Equal(1, actual.AccountId);
            Assert.Equal("aProject", actual.Name);
            Assert.True(actual.Active);

            Assert.Null(gateway.FindObject(23));
        }
Пример #2
0
        public void TestFindObject()
        {
            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, active) values (22, 1, 'aProject', true);
");

            var gateway = new ProjectDataGateway(new DatabaseTemplate(_dataSourceConfig));
            var actual  = gateway.FindObject(22);

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