예제 #1
0
 public GameDefinitionController(IDataContext dataContext,
                                 IGameDefinitionRetriever gameDefinitionRetriever,
                                 IGameDefinitionDetailsViewModelBuilder gameDefinitionTransformation,
                                 IShowingXResultsMessageBuilder showingXResultsMessageBuilder,
                                 IGameDefinitionSaver gameDefinitionCreator,
                                 IBoardGameGeekApiClient boardGameGeekApiClient)
 {
     this.dataContext                   = dataContext;
     this.gameDefinitionRetriever       = gameDefinitionRetriever;
     this.gameDefinitionTransformation  = gameDefinitionTransformation;
     this.showingXResultsMessageBuilder = showingXResultsMessageBuilder;
     this.gameDefinitionSaver           = gameDefinitionCreator;
     _boardGameGeekApiClient            = boardGameGeekApiClient;
 }
 public GameDefinitionController(IGameDefinitionRetriever gameDefinitionRetriever,
     ITrendingGamesRetriever trendingGamesRetriever,
     IGameDefinitionDetailsViewModelBuilder gameDefinitionTransformation,
     IGameDefinitionSaver gameDefinitionCreator,
     IBoardGameGeekApiClient boardGameGeekApiClient,
     IUserRetriever userRetriever,
     IBoardGameGeekGamesImporter boardGameGeekGamesImporter,
     ITransformer transformer)
 {
     _gameDefinitionRetriever = gameDefinitionRetriever;
     _trendingGamesRetriever = trendingGamesRetriever;
     _gameDefinitionTransformation = gameDefinitionTransformation;
     _gameDefinitionSaver = gameDefinitionCreator;
     _boardGameGeekApiClient = boardGameGeekApiClient;
     _userRetriever = userRetriever;
     _boardGameGeekGamesImporter = boardGameGeekGamesImporter;
     _transformer = transformer;
 }
 public GameDefinitionController(IGameDefinitionRetriever gameDefinitionRetriever,
                                 ITrendingGamesRetriever trendingGamesRetriever,
                                 IGameDefinitionDetailsViewModelBuilder gameDefinitionTransformation,
                                 IGameDefinitionSaver gameDefinitionCreator,
                                 IBoardGameGeekApiClient boardGameGeekApiClient,
                                 IUserRetriever userRetriever,
                                 IBoardGameGeekGamesImporter boardGameGeekGamesImporter,
                                 ITransformer transformer)
 {
     _gameDefinitionRetriever      = gameDefinitionRetriever;
     _trendingGamesRetriever       = trendingGamesRetriever;
     _gameDefinitionTransformation = gameDefinitionTransformation;
     _gameDefinitionSaver          = gameDefinitionCreator;
     _boardGameGeekApiClient       = boardGameGeekApiClient;
     _userRetriever = userRetriever;
     _boardGameGeekGamesImporter = boardGameGeekGamesImporter;
     _transformer = transformer;
 }
예제 #4
0
        public virtual void SetUp()
        {
            AutomapperConfiguration.Configure();
            dataContextMock                   = MockRepository.GenerateMock <NemeStatsDataContext>();
            gameDefinitionRetrieverMock       = MockRepository.GenerateMock <IGameDefinitionRetriever>();
            gameDefinitionTransformationMock  = MockRepository.GenerateMock <IGameDefinitionDetailsViewModelBuilder>();
            showingXResultsMessageBuilderMock = MockRepository.GenerateMock <IShowingXResultsMessageBuilder>();
            gameDefinitionCreatorMock         = MockRepository.GenerateMock <IGameDefinitionSaver>();
            urlHelperMock          = MockRepository.GenerateMock <UrlHelper>();
            boardGameGeekApiClient = MockRepository.GenerateMock <IBoardGameGeekApiClient>();
            gameDefinitionControllerPartialMock = MockRepository.GeneratePartialMock <GameDefinitionController>(
                dataContextMock,
                gameDefinitionRetrieverMock,
                gameDefinitionTransformationMock,
                showingXResultsMessageBuilderMock,
                gameDefinitionCreatorMock,
                boardGameGeekApiClient);
            gameDefinitionControllerPartialMock.Url = urlHelperMock;

            asyncRequestMock = MockRepository.GenerateMock <HttpRequestBase>();
            asyncRequestMock.Expect(x => x.Headers)
            .Repeat.Any()
            .Return(new System.Net.WebHeaderCollection
            {
                { "X-Requested-With", "XMLHttpRequest" }
            });

            var context = MockRepository.GenerateMock <HttpContextBase>();

            context.Expect(x => x.Request)
            .Repeat.Any()
            .Return(asyncRequestMock);

            gameDefinitionControllerPartialMock.ControllerContext = new ControllerContext(context, new RouteData(), gameDefinitionControllerPartialMock);

            currentUser = new ApplicationUser()
            {
                Id = "user id",
                CurrentGamingGroupId = 15151
            };
        }