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); }
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(); }
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); }