public async void InsertSameItemBetThrows()
        {
            var itemBet = new DatabaseModel.ItemBetted(_setup.Bet1.Id, _setup.Item5.DescriptionId, _setup.Item5.AssetId, new decimal(1.0));

            var itemBetRepo = new ItemBettedRepoService(_databaseFactory, new ItemBetQueries());
            await itemBetRepo.InsertAsync(itemBet);

            var exception1 = await Record.ExceptionAsync(async() => { await itemBetRepo.InsertAsync(itemBet); });

            Assert.IsType(typeof(SqlException), exception1);
        }
        public async void GetItemsForBet()
        {
            var itemBetRepo = new ItemBettedRepoService(_databaseFactory, new ItemBetQueries());

            await itemBetRepo.InsertAsync(new List <DatabaseModel.ItemBetted>
            {
                new DatabaseModel.ItemBetted(_setup.Bet2.Id, _setup.Item6.DescriptionId, _setup.Item6.AssetId, new decimal(1.0)),
                new DatabaseModel.ItemBetted(_setup.Bet2.Id, _setup.Item7.DescriptionId, _setup.Item7.AssetId, new decimal(1.0)),
                new DatabaseModel.ItemBetted(_setup.Bet2.Id, _setup.Item8.DescriptionId, _setup.Item8.AssetId, new decimal(1.0))
            });

            var items = await itemBetRepo.FindAsync(_setup.Bet2);

            Assert.Equal(3, items.Count);
        }
        public async void GetValueOfItemBetSuccess()
        {
            var itemBetRepo = new ItemBettedRepoService(_databaseFactory, new ItemBetQueries());

            await itemBetRepo.InsertAsync(new List <DatabaseModel.ItemBetted>
            {
                new DatabaseModel.ItemBetted(_setup.Bet3.Id, _setup.Item1.DescriptionId, _setup.Item1.AssetId, new decimal(1.0)),
                new DatabaseModel.ItemBetted(_setup.Bet3.Id, _setup.Item2.DescriptionId, _setup.Item2.AssetId, new decimal(3.0)),
                new DatabaseModel.ItemBetted(_setup.Bet3.Id, _setup.Item3.DescriptionId, _setup.Item3.AssetId, new decimal(5.54)),
                new DatabaseModel.ItemBetted(_setup.Bet3.Id, _setup.Item4.DescriptionId, _setup.Item4.AssetId, new decimal(154.68)),
            });

            var items = await itemBetRepo.FindAsync(_setup.Bet3);

            Assert.Equal(4, items.Count);
            Assert.Equal(new decimal(164.22), items.Sum(item => item.Value));
        }
        public async void GetItemsFromBets()
        {
            var itemBetRepo = new ItemBettedRepoService(_databaseFactory, new ItemBetQueries());

            await itemBetRepo.InsertAsync(new List <DatabaseModel.ItemBetted>
            {
                new DatabaseModel.ItemBetted(_setup.Bet4.Id, _setup.Item9.DescriptionId, _setup.Item9.AssetId, new decimal(1.0)),
                new DatabaseModel.ItemBetted(_setup.Bet4.Id, _setup.Item10.DescriptionId, _setup.Item10.AssetId, new decimal(1.0)),
                new DatabaseModel.ItemBetted(_setup.Bet4.Id, _setup.Item11.DescriptionId, _setup.Item11.AssetId, new decimal(1.0)),
                new DatabaseModel.ItemBetted(_setup.Bet4.Id, _setup.Item12.DescriptionId, _setup.Item12.AssetId, new decimal(1.0)),
                new DatabaseModel.ItemBetted(_setup.Bet4.Id, _setup.Item13.DescriptionId, _setup.Item13.AssetId, new decimal(1.0)),
                new DatabaseModel.ItemBetted(_setup.Bet5.Id, _setup.Item14.DescriptionId, _setup.Item14.AssetId, new decimal(1.0)),
                new DatabaseModel.ItemBetted(_setup.Bet5.Id, _setup.Item15.DescriptionId, _setup.Item15.AssetId, new decimal(1.0))
            });

            var ids = new List <DatabaseModel.Bet>();

            ids.Add(_setup.Bet4);
            ids.Add(_setup.Bet5);
            var res = await itemBetRepo.FindAsync(ids);

            Assert.Equal(7, res.Count);
        }