public void NotNullableConstraintCompletion() { TestDatabase db = new TestDatabase(createNotNullConstraint: true); Group group = new Group { Id = 1}; db.Groups.Insert(group); }
public void NCharContraintCompletion() { TestDatabase db = new TestDatabase(createNcharContraintForGroup: true); Group group = new Group { Id = 1, Name = "wat" }; db.Groups.Insert(group); Assert.AreEqual("wat ", db.Groups.Single().Name); }
public void IdentityReturned() { TestDatabase db = new TestDatabase(createIdentityForGroup:true); Group group = new Group { Name = "Group" }; db.Groups.Insert(group); Assert.AreEqual(group.Id, 1); }
public void InsertEntityWithIdentity() { Database database = new Database(); Table<Group, int> table = database.Tables.Create<Group, int>(g => g.Id, new IdentitySpecification<Group>(g => g.Id)); Group group1 = new Group { Name = "Group 1" }; Group group2 = new Group { Name = "Group 2" }; table.Insert(group1); table.Insert(group2); Assert.AreEqual(group1.Id + 1, group2.Id); }
public void OuterJoinNulledFields() { TestDatabase db = new TestDatabase(); db.AddMemberGroupRelation(); Group group = new Group { Name = "Group" }; db.Groups.Insert(group); db.Members.Insert(new Member { Id = "A", Name = "John", GroupId = null }); db.Members.Insert(new Member { Id = "B", Name = "Kay", GroupId = group.Id }); var q = from m in db.Members join g_ in db.Groups on m.GroupId equals g_.Id into groups_ from g in groups_.DefaultIfEmpty() select new { Name = m.Name, GroupName = g.Name }; var result = q.ToList(); Assert.IsTrue(result.Any(x => x.GroupName == null)); }
public void InsertEntityAfterReseed() { Database database = new Database(); Table<Group, int> table = database.Tables.Create<Group, int>(g => g.Id, new IdentitySpecification<Group>(g => g.Id)); Group group1 = new Group { Name = "Group 1" }; table.Insert(group1); Assert.AreEqual(group1.Id, 1); table.Clear(true); Group group2 = new Group { Name = "Group 2" }; table.Insert(group2); Assert.AreEqual(group1.Id, 1); //just add another to check if still increment Group group3 = new Group { Name = "Group 3" }; table.Insert(group3); Assert.AreEqual(group3.Id, 2); }