Example #1
0
        public void TestCreate()
        {
            Support.ExecSql(@"
            insert into users (id, name) values (12, 'Jack');
            insert into accounts (id, owner_id, name) values (1, 12, 'anAccount');");

            var gateway = new ProjectDataGateway(new ProjectContext(DbContextOptions));

            gateway.Create(1, "aProject");

            // todo...
            var projects = Support.QuerySql("select name from projects where account_id = 1");

            Assert.Equal("aProject", projects[0]["name"]);
        }
Example #2
0
        public void TestCreate()
        {
            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');
");

            var gateway = new ProjectDataGateway(new DatabaseTemplate(_dataSourceConfig));

            gateway.Create(1, "aProject");

            // todo...
            var template = new DatabaseTemplate(_dataSourceConfig);
            var projects = template.Query("select name from projects where account_id = 1",
                                          reader => reader.GetString(0),
                                          new List <DbParameter>());

            Assert.Equal("aProject", projects.First());
        }