Пример #1
0
        public void InsertUniqueIdentifierWithAliases()
        {
            using (var db = GetSqlDatabase())
            {
                var p = new PersonUniqueIdentifierWithAliases {
                    GuidId = Guid.NewGuid(), First = "Alice", Last = "Jones"
                };
                Assert.True(db.Insert(p));
                var gp = db.Get <PersonUniqueIdentifierWithAliases>(p.GuidId);

                Assert.Equal(p.First, gp.First);
                Assert.Equal(p.Last, gp.Last);
            }
        }
        public async Task InsertUniqueIdentifierWithAliasesAsync()
        {
            using (var db = GetSqlDatabase())
            {
                var p = new PersonUniqueIdentifierWithAliases {
                    GuidId = Guid.NewGuid(), First = "Alice", Last = "Jones"
                };
                Assert.True(await db.InsertAsync(p));
                var gp = await db.GetAsync <PersonUniqueIdentifierWithAliases>(p.GuidId);

                Assert.Equal(p.First, gp.First);
                Assert.Equal(p.Last, gp.Last);
            }
        }
Пример #3
0
        public void DeleteUniqueIdentifierWithAliases()
        {
            using (var db = GetSqlDatabase())
            {
                var pOther = new PersonUniqueIdentifierWithAliases {
                    GuidId = Guid.NewGuid(), First = "OtherAlice", Last = "OtherJones"
                };
                var p = new PersonUniqueIdentifierWithAliases {
                    GuidId = Guid.NewGuid(), First = "Alice", Last = "Jones"
                };
                Assert.True(db.Insert(p));
                Assert.True(db.Insert(pOther));
                Assert.True(db.Delete(p));

                var gp      = db.Get(p);
                var gpOther = db.Get(pOther);
                Assert.Null(gp);
                Assert.NotNull(gpOther);
            }
        }
Пример #4
0
        public async Task DeleteUniqueIdentifierWithAliasesAsync()
        {
            using (var db = GetSqlDatabase())
            {
                var pOther = new PersonUniqueIdentifierWithAliases {
                    GuidId = Guid.NewGuid(), First = "OtherAliceAsync", Last = "OtherJones"
                };
                var p = new PersonUniqueIdentifierWithAliases {
                    GuidId = Guid.NewGuid(), First = "AliceAsync", Last = "Jones"
                };
                Assert.True(await db.InsertAsync(p));
                Assert.True(await db.InsertAsync(pOther));
                Assert.True(await db.DeleteAsync(p));

                var gp = await db.GetAsync(p);

                var gpOther = await db.GetAsync(pOther);

                Assert.Null(gp);
                Assert.NotNull(gpOther);
            }
        }