public void SetUp()
        {
            _date = DateTime.UtcNow;

            _productList = TestHelpers.GetData<List<Product>>(typeof(Product).ToString());
            _componentList = TestHelpers.GetData<List<Component>>(typeof(Component).ToString());
            _stockItems = TestHelpers.GetData<List<StockItem>>(typeof(StockItem).ToString());
            _blueprints = TestHelpers.GetData<List<BlueprintInfo>>(typeof(BlueprintInfo).ToString());
            _productTypes = TestHelpers.GetData<List<ProductType>>(typeof(ProductType).ToString());

            var apiMock = new Mock<IApiService>();
            apiMock.Setup(p => p.GetApiResult<IndustryJobDto>(It.IsAny<Credential>(), It.IsAny<CallContext>(), CallEndPoint.IndustryJobs)).Returns(CreateIndyJobs());
            apiMock.Setup(p => p.GetApiResult<IndustryJobDto>(It.IsAny<Credential>(), It.IsAny<CallContext>(), CallEndPoint.IndustryJobsHistory)).Returns(CreateIndyJobsHistory);
            apiMock.Setup(p => p.GetApiResult<Blueprint>(It.IsAny<Credential>(), It.IsAny<CallContext>(), CallEndPoint.Blueprints)).Returns(CreateMyBlueprints());
            apiMock.Setup(p => p.GetApiResult<Asset>(It.IsAny<Credential>(), It.IsAny<CallContext>(), CallEndPoint.AssetList)).Returns(CreateAssets());
            apiMock.Setup(p => p.GetMarketStatistics(It.IsAny<List<int>>(), It.IsAny<int>())).Returns((List<int> items, int system) => CreateMarketStats(items));

            var todoMock = new Mock<IToDoListRepository>();
            todoMock.Setup(p => p.GetList<Product>()).ReturnsAsync(_productList);
            todoMock.Setup(p => p.GetList<Component>()).ReturnsAsync(_componentList);
            todoMock.Setup(p => p.GetList<StockItem>()).ReturnsAsync(_stockItems);

            todoMock.Setup(p => p.SaveList(It.IsAny<IEnumerable<StockItem>>())).Callback((IEnumerable<StockItem> items) => { _stockItems = items; }).ReturnsAsync(true);
            todoMock.Setup(p => p.SaveList(It.IsAny<IEnumerable<Product>>())).Callback((IEnumerable<Product> items) => { _productList = items; }).ReturnsAsync(true);
            todoMock.Setup(p => p.SaveList(It.IsAny<IEnumerable<Component>>())).Callback((IEnumerable<Component> items) => { _componentList = items; }).ReturnsAsync(true);

            var staticMock = new Mock<IStaticRepository>();
            staticMock.Setup(p => p.GetAllAsync<BlueprintInfo>()).ReturnsAsync(_blueprints);
            staticMock.Setup(p => p.GetAllAsync<ProductType>()).ReturnsAsync(_productTypes);

            _updateService = new IndustryJobUpdateService(todoMock.Object, apiMock.Object, staticMock.Object);
        }
Esempio n. 2
0
 public UpdateService(IApiService apiService, IToDoListRepository todoRepository, IStaticDataService staticService, IIndustryJobUpdateService indyService, IAssetUpdateService assetUpdate, IInventionService inventionService, IManufacturingService manufacturingService, IMarketOrderUpdateService marketService, ITransactionService transactionService)
 {
     _apiService = apiService;
     _todoRepository = todoRepository;
     _staticService = staticService;
     _indyService = indyService;
     _assetUpdate = assetUpdate;
     _inventionService = inventionService;
     _manufacturingService = manufacturingService;
     _marketService = marketService;
     _transactionService = transactionService;
 }