public void ModifyUserGroup() { IUsersStorageProviderV40 prov = GetProvider(); UserGroup group1 = prov.AddUserGroup("Group1", "Description1"); UserGroup group2 = prov.AddUserGroup("Group2", "Description2"); Assert.IsNull(prov.ModifyUserGroup(new UserGroup("Inexistent", "Descr", prov), "New"), "ModifyUserGroup should return null"); prov.SetUserMembership(prov.AddUser("user", "user", "pass", "*****@*****.**", true, DateTime.Now), new string[] { "Group2" }); UserGroup group2Out = prov.ModifyUserGroup(new UserGroup("Group2", "Description2", prov), "Mod"); UserGroup expected = new UserGroup("Group2", "Mod", prov); expected.Users = new string[] { "user" }; AssertUserGroupsAreEqual(expected, group2Out, true); UserGroup[] allGroups = prov.GetUserGroups(); Assert.AreEqual(2, allGroups.Length, "Wrong group count"); Array.Sort(allGroups, delegate(UserGroup x, UserGroup y) { return(x.Name.CompareTo(y.Name)); }); AssertUserGroupsAreEqual(new UserGroup("Group1", "Description1", prov), allGroups[0], true); AssertUserGroupsAreEqual(expected, allGroups[1], true); }
public void ModifyUserGroup_NullDescription() { IUsersStorageProviderV40 prov = GetProvider(); prov.ModifyUserGroup(prov.AddUserGroup("Group", "Description"), null); }
public void ModifyUserGroup_NullGroup() { IUsersStorageProviderV40 prov = GetProvider(); prov.ModifyUserGroup(null, "Description"); }