Esempio n. 1
0
        public AdventureSampleProcessor(ILogger <AdventureSampleProcessor> logger,
                                        IAdventureRepository adventureRep,
                                        ICurrentNodeRepository curNodeRep,
                                        IMediaLinkProcessor linkProcessor)
        {
            if (logger == null)
            {
                throw new ArgumentNullException("logger is not set");
            }

            if (adventureRep == null)
            {
                throw new ArgumentNullException("adventureRep is not set");
            }

            if (curNodeRep == null)
            {
                throw new ArgumentNullException("curNodeRep is not set");
            }

            if (linkProcessor == null)
            {
                throw new ArgumentNullException("linkProcessor is not set");
            }


            _logger = logger;


            //  _adventureConfig = adventureConfig.Value;
            _adventureRep  = adventureRep;
            _curNodeRep    = curNodeRep;
            _linkProcessor = linkProcessor;
        }
        private IServiceProvider GetTestProvider(string imageRoot)
        {
            AdventureSampleConfig checkerConfig = new AdventureSampleConfig();

            var serviceProvider = new Mock <IServiceProvider>();


            IOptions <AdventureSampleConfig> mockConfig = Options.Create(new AdventureSampleConfig());


            serviceProvider
            .Setup(x => x.GetService(typeof(IOptions <AdventureSampleConfig>)))
            .Returns(mockConfig);

            ILogger <AdventureSampleProcessor> adventureLogger = Mock.Of <ILogger <AdventureSampleProcessor> >();

            serviceProvider
            .Setup(x => x.GetService(typeof(ILogger <AdventureSampleProcessor>)))
            .Returns(adventureLogger);


            //ISqsService sqsService = Mock.Of<ISqsService>();
            //serviceProvider
            //    .Setup(x => x.GetService(typeof(ISqsService)))
            //    .Returns(sqsService);


            IAdventureRepository advRep = Mock.Of <IAdventureRepository>();

            ICurrentNodeRepository curRep = Mock.Of <ICurrentNodeRepository>();

            IMediaLinkProcessor mediaLinker = Mock.Of <IMediaLinkProcessor>();

            // IAdventureSampleProcessor adventureProcessor = new AdventureSampleProcessor(mockConfig, emailLogger, userManager, progMan, sqsService);

            IAdventureSampleProcessor adventureProcessor = new AdventureSampleProcessor(adventureLogger, advRep, curRep, mediaLinker);

            serviceProvider
            .Setup(x => x.GetService(typeof(IAdventureSampleProcessor)))
            .Returns(adventureProcessor);

            return(serviceProvider.Object);

            //public EmailProcessor(IOptions<EmailCheckerConfig> emailCheckerConfig,
            //                        ILogger<EmailProcessor> logger,
            //                        IAlexaUserDataManager userDataManager,
            //                        IProgressiveResponseManager progMan,
            //                        ISqsService sqsService
            //                      )
        }