public void TryToInviteTeacherToGroupWithApprovedTeacher_GetException() { //Arrange var publisher = new Mock <IEventPublisher>(); var groupFacade = new GroupFacade(_groupRepository, _userRepository, _sanctionRepository, new GroupSettings(1, 100, 0, 1000), publisher.Object); var accountFacade = new AccountFacade(_keysRepository, _userRepository, _emailSender.Object, userSettings); var userFacade = new UserFacade(_userRepository, _groupRepository, _eventRepository, _publisher.Object); var creatorId = accountFacade.RegUser("Creator", new Credentials("email1", "password"), false); var teacherId = accountFacade.RegUser("Teacher", new Credentials("email2", "password"), true); var anotherTeacherId = accountFacade.RegUser("Another teacher", new Credentials("email3", "password"), true); var createdGroupId = groupFacade.CreateGroup(creatorId, "Some group", new List <string> { "c#" }, "Very interesting", 1, 100, false, GroupType.Lecture); var createdGroup = groupFacade.GetGroup(createdGroupId, creatorId); groupFacade.ApproveTeacher(userFacade.GetUser(teacherId).Id, createdGroupId); //Act userFacade.Invite(creatorId, anotherTeacherId, createdGroupId, MemberRole.Teacher); }
public void TryToAcceptTeacherInvitationWithAlreadyFoundTeacher_GetException() { //Arrange var publisher = new Mock <IEventPublisher>(); var groupFacade = new GroupFacade(_groupRepository, _userRepository, _sanctionRepository, new GroupSettings(1, 100, 0, 1000), publisher.Object); var accountFacade = new AccountFacade(_keysRepository, _userRepository, _emailSender.Object, userSettings); var userFacade = new UserFacade(_userRepository, _groupRepository, _eventRepository, _publisher.Object); var creatorId = accountFacade.RegUser("Creator", new Credentials("email1", "password"), false); var teacherId = accountFacade.RegUser("Teacher", new Credentials("email2", "password"), true); var newTeacherId = accountFacade.RegUser("Teacher", new Credentials("email3", "password"), true); var createdGroupId = groupFacade.CreateGroup(creatorId, "Some group", new List <string> { "c#" }, "Very interesting", 1, 100, false, GroupType.Lecture); userFacade.Invite(creatorId, newTeacherId, createdGroupId, MemberRole.Teacher); var invitation = userFacade.GetAllInvitationsForUser(newTeacherId).ToList()[0]; //Act groupFacade.ApproveTeacher(teacherId, createdGroupId); userFacade.ChangeInvitationStatus(newTeacherId, invitation.Id, InvitationStatus.Accepted); }