예제 #1
0
        public void CheckSniHead()
        {
            var user1 = new User {Ideas = new[] {new Idea {SniHeadId = "1"}}};
            var user2 = new User { Ideas = new[] { new Idea { SniHeadId = "1" } } };
            var user3 = new User { Ideas = new[] { new Idea { SniHeadId = "2" } } };
            _matcher = new Matcher(user1, user2);

            Assert.That(_matcher.Match().SniHeadMatch.IsMatch, Is.EqualTo(true));
            Assert.That(_matcher.Match().Score, Is.EqualTo(20));
        }
예제 #2
0
        public void CheckLookingFor()
        {
            var userLookingForPartnerToMyIdea = new User {LookingFor = new LookingFor {PartnerToMyIdea = true}};
            var userLookingForIdeasToJoin = new User {LookingFor = new LookingFor {IdeasToJoin = true}};
            var userJoinOrBeJoined = new User {LookingFor = new LookingFor {JoinOrBeJoined = true}};
            var userLookingForInvestements = new User {LookingFor = new LookingFor {Investements = true}};

            _matcher = new Matcher(userLookingForPartnerToMyIdea, userLookingForPartnerToMyIdea);
            Assert.That(_matcher.MatchLookingFor().IsMatch, Is.EqualTo(new DoesNotMatch().IsMatch));
            Assert.That(_matcher.MatchLookingFor(), Is.EqualTo(new DoesNotMatch().IsMatch));

            Assert.That(userLookingForIdeasToJoin.LookingFor.MatchWith(userLookingForPartnerToMyIdea.LookingFor), Is.EqualTo(true));
        }
예제 #3
0
        public ActionResult Single(Guid id)
        {
            var currentUser = _currentUserService.Get();
            var userToMatchWith = _repository.Query(m => m.Users.First(u => u.UserId == id));
            var matcher = new Matcher(currentUser, userToMatchWith, _repository);
            var matchResult = matcher.Match();

            return Json(new
                        {
                            matchResult,
                            currentUser = _converter.Present(currentUser),
                            userToMatchWith = _converter.Present(userToMatchWith)
                        }, JsonRequestBehavior.AllowGet);
        }
예제 #4
0
        public void CheckCompetencesNeeded()
        {
            var userSeeksDesign = new User
            {
                Ideas = new[]
                                                  {
                                                      new Idea
                                                          {
                                                              SearchProfile = new SearchProfile {CompetencesNeeded = new[] {"design"}}
                                                          }
                                                  }
            };
            var designer = new User {Competences = new[] {"design"}};

            _matcher = new Matcher(userSeeksDesign, designer);
            Assert.That(_matcher.MatchCompetencesNeeded().IsMatch, Is.EqualTo(true));
        }
예제 #5
0
        public void CheckUserType()
        {
            var user1= new User {UserType = 1};
            var userLookingFor1 = new User
                                              {
                                                  Ideas = new List<Idea>
                                                          {
                                                              new Idea
                                                                  {
                                                                      SearchProfile = new SearchProfile
                                                                              {
                                                                                  UserTypesNeeded = new UserTypesNeeded
                                                                                          {
                                                                                              UserTypeIds = new[] {1, 2, 3}
                                                                                          }
                                                                              }
                                                                  }
                                                          }
                                              };

            _matcher = new Matcher(user1, userLookingFor1);
            var matchResult = _matcher.MatchUserType();
            Assert.That(matchResult.IsMatch, Is.EqualTo(true));
            var userTypeMatch = matchResult as UserTypeMatch;
            Assert.That(userTypeMatch.UserType, Is.EqualTo(1));
            Assert.That(userTypeMatch.SecondUserTypes.Count(), Is.EqualTo(3));

            _matcher = new Matcher(new User(), userLookingFor1);
            Assert.That(_matcher.MatchUserType().IsMatch, Is.EqualTo(false));
        }
예제 #6
0
        public void CheckUserTypesNeeded()
        {
            var user1 = new User { UserType = 1 };
            var userLookingFor1 = new User
            {
                Ideas = new List<Idea>
                                                          {
                                                              new Idea
                                                                  {
                                                                      SearchProfile = new SearchProfile
                                                                              {
                                                                                  UserTypesNeeded = new UserTypesNeeded
                                                                                          {
                                                                                              UserTypeIds = new[] {1, 2, 3}
                                                                                          }
                                                                              }
                                                                  }
                                                          }
            };

            _matcher = new Matcher(userLookingFor1, user1);
            var matchResult = _matcher.MatchUserTypesNeeded();
            Assert.That(matchResult.IsMatch, Is.EqualTo(true));
        }