예제 #1
0
        public async Task FindByIdReturnsNullIfNothing()
        {
            using (var conn = OpenConnection()) {
                var b = new Brand("Name");
                await conn.ExecuteAsync("insert into brands (id, name) values (@Id, @Name);", b);

                var repo  = new BrandRepo(Database);
                var found = (await repo.FindById(Guid.NewGuid()));

                Assert.IsNull(found);
            }
        }
예제 #2
0
        // ignore
        public async Task FindByIdFinds()
        {
            using (var conn = OpenConnection()) {
                var b = new Brand("Name");
                await conn.ExecuteAsync("insert into brands (id, name) values (@Id, @Name);", b);

                var repo  = new BrandRepo(Database);
                var found = (await repo.FindById(b.Id)) !;

                Assert.AreEqual(b.Id, found.Id);
                Assert.AreEqual(b.Name, found.Name);
            }
        }