コード例 #1
0
        public void GetRuneProcessingStrategy_WithInvalidRepository_ExpectException()
        {
            // ARRANGE
            var mockedRepositoryFactory = new Mock <IRepositoryFactory>();
            var repositoryFactory       = mockedRepositoryFactory.Object;
            var strategyFactory         = new ProcessingStrategyFactory(repositoryFactory);

            // ACT
            var resultingStrategy = strategyFactory.GetProcessingStrategy(ApiProcessing.Enumerations.ObjectType.Rune);
        }
コード例 #2
0
        static void Main()
        {
            var          config      = ConfigurationManager.GetCurrentConfiguration(ConfigFileLocation);
            IMongoClient mongoClient = new MongoClient("mongodb://*****:*****@spirital.tk:1801");
            var          database    = mongoClient.GetDatabase("LeagueComparer");
            var          repoFactory = new RepositoryFactory(database);
            var          strategyProcessingFactory = new ProcessingStrategyFactory(repoFactory);

            var queryBuilder  = new QueryBuilder(config.ApiKey, ApiUrlBuilder.BuildApiStaticDataUrl(Regions.euw, config));
            var championQuery = queryBuilder.BuildQuery(ObjectType.Champion, new QueryParameter("champData", "all"));

            var queryExecutor              = new QueryExecutor();
            var championQueryResponse      = queryExecutor.ExecuteQuery(championQuery).Result;
            var championProcessingStrategy = strategyProcessingFactory.GetProcessingStrategy(championQueryResponse.QueryObjectType);

            championProcessingStrategy.ProcessQueryResponse(championQueryResponse).Wait();
        }
コード例 #3
0
        public void GetItemProcessingStrategy_WithValidRepository_ExpectSuccess()
        {
            // ARRANGE
            var mockedRepositoryFactory = new Mock <IRepositoryFactory>();

            mockedRepositoryFactory.Setup(r => r.GetRepository <Item>())
            .Returns(new MongoPocoRepository <Item>(null));
            var repositoryFactory = mockedRepositoryFactory.Object;
            var strategyFactory   = new ProcessingStrategyFactory(repositoryFactory);

            // ACT
            var resultingStrategy = strategyFactory.GetProcessingStrategy(ApiProcessing.Enumerations.ObjectType.Item);

            // ASSERT
            var expectedResultType = typeof(ItemProcessingStrategy);

            Assert.IsInstanceOfType(resultingStrategy, expectedResultType);
        }