Esempio n. 1
0
        public async Task InvitationAcceptingWorks()
        {
            await firstContext.CreateUser(firstAuth);

            await secondContext.CreateUser(secondAuth, "SecondFellow");

            var groupId = await firstGroups.UpsertGroup(DefaultGroup());

            await firstGroups.InvitePerson(groupId, secondContext.UserId);

            var before = await secondGroups.Invitations();

            await secondGroups.AcceptInvitation(groupId);

            var after = await secondGroups.Invitations();

            var details = await secondGroups.Details(groupId);

            var groups = await secondGroups.List();

            Assert.Single(before);
            Assert.Equal(groupId, before[0].Id);
            Assert.Empty(after);
            Assert.Contains(firstContext.UserId, details.Members.Select(x => x.Id));
            Assert.Contains(secondContext.UserId, details.Members.Select(x => x.Id));
            Assert.Single(groups);
            Assert.Equal(groupId, groups[0].Id);
        }
Esempio n. 2
0
        public async Task InvitationFailsForNonexistentInvitation()
        {
            await firstContext.CreateUser(firstAuth);

            var exception = await Assert.ThrowsAsync <DatesException>(async() =>
            {
                await firstGroups.AcceptInvitation(100);
            });

            Assert.Equal("No invitation found", exception.Message);
        }
 public Task AcceptInvitation(int group)
 {
     return(groupsService.AcceptInvitation(group));
 }