public async Task MemberDeletionWorks() { await firstContext.CreateUser(firstAuth); await secondContext.CreateUser(secondAuth, "SecondFellow"); var groupId = await firstGroups.UpsertGroup(DefaultGroup()); await firstGroups.InvitePerson(groupId, secondContext.UserId); await secondGroups.AcceptInvitation(groupId); var before = await secondGroups.List(); await firstGroups.DeletePerson(groupId, secondContext.UserId); var after = await secondGroups.List(); Assert.Single(before); Assert.Equal(groupId, before[0].Id); Assert.Empty(after); }
public async Task MemberDeletionFailsForInvalidGroup() { await firstContext.CreateUser(firstAuth); await secondContext.CreateUser(secondAuth, "SecondFellow"); var groupId = await firstGroups.UpsertGroup(DefaultGroup()); var exception = await Assert.ThrowsAsync <DatesException>(async() => { await secondGroups.DeletePerson(groupId, firstContext.UserId); }); Assert.Equal("You do not own this group", exception.Message); }
public Task DeletePerson([FromRoute] int group, [FromRoute] int user) { return(groupsService.DeletePerson(group, user)); }