public void InitializeTests() { _stubVoteRepository = new Mock <IVoteRepository>(); _stubContestantRepository = new Mock <IContestantRepository>(); _stubWarRepo = new Mock <IWarRepository>(); _stubRankingService = new Mock <IRankingService>(); _stubMatchFactory = new Mock <IMatchFactory>(); _stubMatchRepository = new Mock <IMatchRepository>(); _stubUserRepository = new Mock <IUserRepository>(); var stubClaimsPrincipal = new ClaimsPrincipal(); _stubUser = new War.Users.User { Id = new UserIdentifier { AuthenticationType = Guid.NewGuid().ToString(), NameIdentifier = Guid.NewGuid().ToString() } }; _stubMapper = new Mock <IMapper>(); _stubMapper.Setup(x => x.Map <ClaimsPrincipal, War.Users.User>(stubClaimsPrincipal)).Returns(_stubUser); _controller = new WarController(_stubMapper.Object, _stubRankingService.Object, _stubWarRepo.Object, _stubMatchFactory.Object, _stubMatchRepository.Object, _stubContestantRepository.Object, _stubUserRepository.Object, _stubVoteRepository.Object) { User = stubClaimsPrincipal }; _stubWarRepo.Setup(x => x.Get(ValidWarId)).Returns(Task.FromResult(new War.Wars.War())); _stubWarRepo.Setup(x => x.Get(InvalidWarId)).Returns(Task.FromResult((War.Wars.War)null)); }
private static bool IsUserWhoCreatedMatch(Match existingMatch, War.Users.User user) { return(existingMatch.UserId.AuthenticationType == user.Id.AuthenticationType && existingMatch.UserId.NameIdentifier == user.Id.NameIdentifier); }