public void TryToGetAllGroupsOfUser_ReturnRightResult() { //Arrange var accountFacade = new AccountFacade(_keysRepository, _userRepository, _emailSender.Object, userSettings); var userFacade = new UserFacade(_userRepository, _groupRepository, _eventRepository, _publisher.Object); var publisher = new Mock <IEventPublisher>(); var groupFacade = new GroupFacade(_groupRepository, _userRepository, _sanctionRepository, new GroupSettings(2, 10, 0, 100), publisher.Object); var testUserId = accountFacade.RegUser("Alena", new Credentials("email1", "password"), true); var creatorId = accountFacade.RegUser("Galya", new Credentials("email2", "password"), true); var createdGroupId1 = groupFacade.CreateGroup(creatorId, "Group1", new List <string> { "c#" }, "Good group", 5, 0, false, GroupType.MasterClass); var createdGroupId2 = groupFacade.CreateGroup(creatorId, "Group2", new List <string> { "c#" }, "The best group!", 7, 0, true, GroupType.Seminar); var createdGroup1 = groupFacade.GetGroup(createdGroupId1, creatorId); var createdGroup2 = groupFacade.GetGroup(createdGroupId2, creatorId); //Act groupFacade.AddMember(createdGroup1.GroupInfoView.GroupId, testUserId); groupFacade.AddMember(createdGroup2.GroupInfoView.GroupId, testUserId); var expected = new List <FullGroupView> { createdGroup1, createdGroup2 }; var groups = userFacade.GetAllGroupsOfUser(testUserId).ToList(); //Assert Assert.AreEqual(groups.Count, expected.Count); }