public void DeleteAll()
        {
            using (var db = GetSqlDatabase())
            {
                var p = new PersonCompositeKey {
                    GuidId = Guid.NewGuid(), StringId = "test", FirstName = "Alice", LastName = "Jones"
                };
                Assert.True(db.Insert(p));

                Assert.True(db.Delete <PersonCompositeKey>());

                Assert.Equal(0, db.Count <PersonCompositeKey>());
            }
        }
Example #2
0
        public async Task DeleteAllAsync()
        {
            using (var connection = GetSqlDatabase())
            {
                var p = new PersonCompositeKey {
                    GuidId = Guid.NewGuid(), StringId = "test", FirstName = "Alice", LastName = "Jones"
                };
                Assert.True(await connection.InsertAsync(p));

                Assert.True(await connection.DeleteAsync <PersonCompositeKey>());

                Assert.Equal(0, await connection.CountAsync <PersonCompositeKey>());
            }
        }
        public void DeletePersonCompositeKey()
        {
            using (var db = GetSqlDatabase())
            {
                var p = new PersonCompositeKey {
                    GuidId = Guid.NewGuid(), StringId = "test", FirstName = "Alice", LastName = "Jones"
                };
                Assert.True(db.Insert(p));

                Assert.True(db.Delete <PersonCompositeKey>("where GuidId = @GuidId and StringId = @StringId", p));

                var gp = db.Get(p);
                Assert.Null(gp);
            }
        }
        public void InsertPersonCompositeKey()
        {
            using (var db = GetSqlDatabase())
            {
                var gid = Guid.NewGuid();
                var p   = new PersonCompositeKey {
                    GuidId = gid, StringId = "test", FirstName = "Alice", LastName = "Jones"
                };
                Assert.True(db.Insert(p));
                var gp = db.Get <PersonCompositeKey>("where GuidId = @GuidId and StringId = @StringId", p);

                Assert.Equal(p.StringId, gp.StringId);
                Assert.Equal(p.FirstName, gp.FirstName);
                Assert.Equal(p.LastName, gp.LastName);
            }
        }
Example #5
0
        public async Task InsertPersonCompositeKeyAsync()
        {
            using (var connection = GetSqlDatabase())
            {
                var gid = Guid.NewGuid();
                var p   = new PersonCompositeKey {
                    GuidId = gid, StringId = "test", FirstName = "Alice", LastName = "Jones"
                };
                Assert.True(await connection.InsertAsync(p));
                var gp = await connection.GetAsync <PersonCompositeKey>("where GuidId = @GuidId and StringId = @StringId", p);

                Assert.Equal(p.StringId, gp.StringId);
                Assert.Equal(p.FirstName, gp.FirstName);
                Assert.Equal(p.LastName, gp.LastName);
            }
        }
Example #6
0
        public async Task DeletePersonCompositeKeyAsync()
        {
            using (var connection = GetSqlDatabase())
            {
                var p = new PersonCompositeKey {
                    GuidId = Guid.NewGuid(), StringId = "test", FirstName = "Alice", LastName = "Jones"
                };
                Assert.True(await connection.InsertAsync(p));

                Assert.True(await connection.DeleteAsync <PersonCompositeKey>("where GuidId = @GuidId and StringId = @StringId", p));

                var gp = await connection.GetAsync(p);

                Assert.Null(gp);
            }
        }