Ejemplo n.º 1
0
        public async Task GetBotsAndItemsForWithdrawSuccess()
        {
            //this will lookup where his items is and create a new offer for every bot that the item is in.

            var assetAndDescIds = new List<AssetAndDescriptionId>
            {
                new AssetAndDescriptionId {AssetId = "assetId1", DescriptionId = 1},
                new AssetAndDescriptionId {AssetId = "assetId2", DescriptionId = 3},
                new AssetAndDescriptionId {AssetId = "assetId1", DescriptionId = 2},
                new AssetAndDescriptionId {AssetId = "assetId5", DescriptionId = 1},
            };

            var databaseItem = new List<DatabaseModel.Item>
            {
                new DatabaseModel.Item("assetId1", 1, 1, -1, DateTimeOffset.Now, -1),
                new DatabaseModel.Item("assetId2", 3, 2, -1, DateTimeOffset.Now, -1),
                new DatabaseModel.Item("assetId1", 2, 3, -1, DateTimeOffset.Now, -1),
                new DatabaseModel.Item("assetId5", 1, 1, -1, DateTimeOffset.Now, -1),
            };

            A.CallTo(() => _fakedItemRepoService.FindAsync(A<List<AssetAndDescriptionId>>._)).Returns(databaseItem);
            A.CallTo(() => _fakedBotRepoService.FindAsync(A<List<int>>._)).ReturnsLazily(CreateBots);

            var dict = await _botService.GetBotsWithWithdrawItems(assetAndDescIds);

            Assert.Equal(3, dict.Count);
            Assert.Equal(2, dict.First(kvp => kvp.Key.Id == 1).Value.Count);
            Assert.Equal(1, dict.First(kvp => kvp.Key.Id == 2).Value.Count);
            Assert.Equal(1, dict.First(kvp => kvp.Key.Id == 3).Value.Count);
        }