public void Remove(IntIterator iter) { while (iter.HasNext()) { Remove(iter.Next()); } }
public void Add(IntIterator iter) { while (iter.HasNext()) { Add(iter.Next()); } }
public void StartCourseWithApprovedTeacherAndAllReadyMembers_CourseWasStarted() { //Arrange var approvedTeacher = new User("Sergey", new Credentials("email", "password"), true, UserType.User); var creatorId = IntIterator.GetNextId(); var user1Id = IntIterator.GetNextId(); var user2Id = IntIterator.GetNextId(); var group = new Group(creatorId, "SomeGroup", new List <string> { "c#" }, "The best", 3, 0, false, GroupType.Seminar); var expectedCurriculum = "Awesome course"; //Act group.AddMember(user1Id); group.AddMember(user2Id); group.ApproveTeacher(approvedTeacher); group.OfferCurriculum(approvedTeacher.Id, expectedCurriculum); group.AcceptCurriculum(creatorId); group.AcceptCurriculum(user1Id); group.AcceptCurriculum(user2Id); //Assert Assert.AreEqual(group.Status, CourseStatus.Started); }
public bool Equals_obj(object obj) { if (this == obj) { return(true); } if (!(obj is IntSet)) { return(false); } IntSet set = (IntSet)obj; IntIterator a = this.Iterator(); IntIterator b = set.Iterator(); while (a.HasNext() && b.HasNext()) { if (a.Next() != b.Next()) { return(false); } } if (a.HasNext() || b.HasNext()) { return(false); } return(true); }
public void Add(IntIterator indices) { while (indices.HasNext()) { bitset.Set(indices.Next(), true); } }
public void CancelNotExistingSanction_GetException() { //Arrange var sanctionFacade = new SanctionFacade(_sanctionRepository, _userRepository, _publisher.Object); //Act sanctionFacade.CancelSanction(IntIterator.GetNextId()); }
public void Add(Sanction sanction) { if (sanction == null) { throw new ArgumentNullException(); } sanction.Id = IntIterator.GetNextId(); _listOfSanctions.Add(sanction); }
public void AddEvent(Event @event) { if (@event == null) { throw new ArgumentNullException(); } @event.Id = IntIterator.GetNextId(); _events.Add(@event); }
public void TryToAddSanctionToNotExistingUser_GetException() { //Arrange var sanctionFacade = new SanctionFacade(_sanctionRepository, _userRepository, _publisher.Object); //Act sanctionFacade.AddSanction("some rule", IntIterator.GetNextId(), _adminId, SanctionType.NotAllowToEditProfile); }
public void Add(User user) { if (user == null) { throw new ArgumentNullException(); } user.Id = IntIterator.GetNextId(); _listOfUsers.Add(user); }
public override void Close() { if (!MandatoryKeys.Empty) { for (IntIterator key = MandatoryKeys.intIterator(); key.hasNext();) { Reporter.report(Record, ReportClass, RecordType).missingMandatoryProperty(key.next()); } } }
public void TryToAddInvitationWithWrongReceiverToUser_GetException() { //Arrange var testUser = new User("Petr", new Credentials("SomeEmail", "SomePassword"), true, UserType.User); var invitation = new Invitation(IntIterator.GetNextId(), IntIterator.GetNextId(), IntIterator.GetNextId(), MemberRole.Member, InvitationStatus.InProgress); //Act testUser.AddInvitation(invitation); }
public void TryToAddNotExistingUserToGroup_GetException() { //Arrange var createdGroupId = _groupFacade.CreateGroup(_groupCreator.Id, "Some group", new List <string> { "c#" }, "You're welcome!", 3, 20, false, GroupType.Lecture); //Act _groupFacade.AddMember(createdGroupId, IntIterator.GetNextId()); }
public void TryToCreateGroupByNotExistingUser_GetException() { //Arrange var invalidUserId = IntIterator.GetNextId(); //Act _groupFacade.CreateGroup(invalidUserId, "Some group", new List <string> { "c#" }, "You're welcome!", 3, 100, false, GroupType.Lecture); }
public void TryToDeleteNotExistingMember_GetException() { //Arrange var creatorId = IntIterator.GetNextId(); var someGroup = new Group(creatorId, "SomeGroup", new List <string> { "c#" }, "The best", 3, 0, false, GroupType.Seminar); //Act someGroup.DeleteMember(creatorId, IntIterator.GetNextId()); }
public void TryToAddUserToFullGroup_GetException() { //Arrange var creatorId = IntIterator.GetNextId(); var someGroup = new Group(creatorId, "SomeGroup", new List <string> { "c#" }, "The best", 1, 0, false, GroupType.Seminar); //Act someGroup.AddMember(IntIterator.GetNextId()); }
public void TryToDeclineAlreadyDeclinedInvitation_GetException() { //Arrange var testUser = new User("Petr", new Credentials("SomeEmail", "SomePassword"), true, UserType.User); var invitation = new Invitation(IntIterator.GetNextId(), testUser.Id, IntIterator.GetNextId(), MemberRole.Member, InvitationStatus.InProgress); testUser.AddInvitation(invitation); testUser.DeclineInvitation(invitation.Id); //Act testUser.DeclineInvitation(invitation.Id); }
public void TryToDeleteWithNotEnoughtRights_GetException() { //Arrange var creatorId = IntIterator.GetNextId(); var invitedUserId = IntIterator.GetNextId(); var someGroup = new Group(creatorId, "SomeGroup", new List <string> { "c#" }, "The best", 3, 0, false, GroupType.Seminar); //Act someGroup.AddMember(invitedUserId); someGroup.DeleteMember(invitedUserId, creatorId); }
public void AddReviewToTeacher_GetAddedReview() { //Arrange var teacher = new User("Petr", new Credentials("SomeEmail", "SomePassword"), true, UserType.User); //Act var guid = IntIterator.GetNextId(); var review = new Review(guid, "The best", "The beast teacher of the year", guid); teacher.TeacherProfile.AddReview(guid, "The best", "The beast teacher of the year", guid); //Assert Assert.AreEqual(review.Text, teacher.TeacherProfile.Reviews.ToList()[0].Text); }
public void AddInvitationWithRightReceiverToUser_GetRightInvitationList() { //Arrange var testUser = new User("Petr", new Credentials("SomeEmail", "SomePassword"), true, UserType.User); var invitation = new Invitation(IntIterator.GetNextId(), testUser.Id, IntIterator.GetNextId(), MemberRole.Member, InvitationStatus.InProgress); //Act testUser.AddInvitation(invitation); //Assert Assert.AreEqual(1, testUser.Invitations.Count); Assert.AreEqual(invitation, testUser.Invitations[0]); }
public void TryToApproveAnotherTeacherWithApprovedTeacher_GetException() { //Arrange var approvedTeacher = new User("Sergey", new Credentials("email", "password"), true, UserType.User); var newTeacher = new User("Bogdan", new Credentials("email", "password"), true, UserType.User); var group = new Group(IntIterator.GetNextId(), "SomeGroup", new List <string> { "c#" }, "The best", 1, 0, false, GroupType.Seminar); //Act group.ApproveTeacher(approvedTeacher); group.ApproveTeacher(newTeacher); }
public void Update(Group group) { Ensure.Any.IsNotNull(group); var currentGroup = _listOfGroups.Find(current => current.GroupInfo.Id == group.GroupInfo.Id) ?? throw new GroupNotFoundException(group.GroupInfo.Id); currentGroup.Messages.ToList().ForEach(msg => { if (msg.Id == 0) { msg.Id = IntIterator.GetNextId(); } }); currentGroup = group; }
public void ApproveTeacher_TeacherIsSet() { //Arrange var teacher = new User("Sergey", new Credentials("email", "password"), true, UserType.User); var group = new Group(IntIterator.GetNextId(), "SomeGroup", new List <string> { "c#" }, "The best", 1, 0, false, GroupType.Seminar); //Act group.ApproveTeacher(teacher); //Assert Assert.AreEqual(teacher, group.Teacher); }
private void LoadProperties(PropertyLoader propertyLoader, MutableIntSet additionalPropertiesToLoad, EntityType type) { _hasLoadedAdditionalProperties = true; propertyLoader.LoadProperties(_entityId, type, additionalPropertiesToLoad, this); // loadProperties removes loaded properties from the input set, so the remaining ones were not on the node //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.eclipse.collections.api.iterator.IntIterator propertiesWithNoValue = additionalPropertiesToLoad.intIterator(); IntIterator propertiesWithNoValue = additionalPropertiesToLoad.intIterator(); while (propertiesWithNoValue.hasNext()) { Put(propertiesWithNoValue.next(), _noValue); } }
public void DeclineInvitation_GetDeclinedInvitation() { //Arrange var testUser = new User("Petr", new Credentials("SomeEmail", "SomePassword"), true, UserType.User); var invitation = new Invitation(IntIterator.GetNextId(), testUser.Id, IntIterator.GetNextId(), MemberRole.Member, InvitationStatus.InProgress); testUser.AddInvitation(invitation); //Act testUser.DeclineInvitation(invitation.Id); //Assert Assert.AreEqual(InvitationStatus.Declined, testUser.Invitations[0].Status); }
public void CheckIfGroupContainsNotExistingTags_GetFalse() { //Arrange var group = new Group(IntIterator.GetNextId(), "SomeGroup", new List <string> { "c#", "c++", "js" }, "The best", 1, 0, false, GroupType.Seminar); //Act var expected = false; var actual = group.DoesContainsTags(new List <string> { "c++", "ada" }); //Assert Assert.AreEqual(expected, actual); }
public void AddInvitation_GetRightListOfInvitations() { //Arrange var group = new Group(IntIterator.GetNextId(), "SomeGroup", new List <string> { "c#" }, "The best", 1, 0, false, GroupType.Seminar); var invitation = new Invitation(IntIterator.GetNextId(), IntIterator.GetNextId(), group.GroupInfo.Id, MemberRole.Member, InvitationStatus.InProgress); //Act group.AddInvitation(invitation); //Assert Assert.AreEqual(1, group.Invitations.Count); Assert.AreEqual(invitation, group.Invitations[0]); }
public void AddUserToGroup_UserWasAddedToGroup() { //Arrange var creatorId = IntIterator.GetNextId(); var invitedUserId = IntIterator.GetNextId(); var someGroup = new Group(creatorId, "SomeGroup", new List <string> { "c#" }, "The best", 3, 0, false, GroupType.Seminar); //Act someGroup.AddMember(invitedUserId); var expectedQuantity = 2; var actualQuantity = someGroup.Members.Count; //Assert Assert.AreEqual(expectedQuantity, actualQuantity); }
public void Update(User user) { if (user == null) { throw new ArgumentNullException(); } var currentUser = _listOfUsers.Find(current => current.Id == user.Id) ?? throw new UserNotFoundException(user.Id); currentUser.Invitations.ForEach(inv => { if (inv.Id == 0) { inv.Id = IntIterator.GetNextId(); } }); currentUser = user; }
public void DeleteYourselfFromGroup_ToBeDeleted() { //Arrange var creatorId = IntIterator.GetNextId(); var invitedUserId = IntIterator.GetNextId(); var someGroup = new Group(creatorId, "SomeGroup", new List <string> { "c#" }, "The best", 3, 0, false, GroupType.Seminar); //Act someGroup.AddMember(invitedUserId); someGroup.DeleteMember(invitedUserId, invitedUserId); var expectedQuantity = 1; var resultQuantity = someGroup.Members.Count; //Assert Assert.AreEqual(expectedQuantity, resultQuantity); }