Beispiel #1
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;
 }
        public void SetUp()
        {
            _itemsToSell = TestHelpers.GetData<List<ToMarket>>(typeof(ToMarket).ToString());
            _stockItems = TestHelpers.GetData<List<StockItem>>(typeof(StockItem).ToString());

            var apiMock = new Mock<IApiService>();
            apiMock.Setup(p => p.GetApiResult<Asset>(It.IsAny<Credential>(), It.IsAny<CallContext>(), It.IsAny<CallEndPoint>())).Returns(CreateAssets());

            var todoMock = new Mock<IToDoListRepository>();
            todoMock.Setup(p => p.GetList<StockItem>()).ReturnsAsync(_stockItems);
            todoMock.Setup(p => p.GetList<ToMarket>()).ReturnsAsync(_itemsToSell);

            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<ToMarket>>())).Callback((IEnumerable<ToMarket> items) => { _itemsToSell = items; }).ReturnsAsync(true);

            _assetUpdateService = new AssetUpdateService(todoMock.Object, apiMock.Object);
        }