public Add ( |
||
user | uživatel, který vytváří skupinu | |
group | skupina | |
return | void |
public void AddTest() { FelBookDBEntities DBEntities = new FelBookDBEntities(); IWallService wallService = null; // Snad ji zatím nepotřebuji GroupService target = new GroupService(DBEntities, wallService); User user = User.CreateUser(0, "group", "creator", DateTime.Now, "mail", "groupCreator", "1234"); DBEntities.UserSet.AddObject(user); DBEntities.SaveChanges(); Group group = Group.CreateGroup(0, "newGroup", "groupDescription"); target.Add(user, group); Assert.IsTrue(DBEntities.GroupSet.ToList().Contains(group)); Assert.AreEqual(user, group.Creator); Assert.IsTrue(group.Administrators.Contains(user)); Assert.IsTrue(group.Users.Contains(user)); Assert.IsTrue(user.AdminedGroups.Contains(group)); Assert.IsTrue(user.CreatedGroups.Contains(group)); Assert.IsTrue(user.JoinedGroups.Contains(group)); DBEntities.GroupSet.DeleteObject(group); DBEntities.UserSet.DeleteObject(user); DBEntities.SaveChanges(); }