public async Task <DatabaseModel.ItemBetted> InsertAsync(DatabaseModel.ItemBetted itemBetted)
        {
            var query = _itemBetQueries.InsertAsync(itemBetted);
            await _databaseConnection.ExecuteNonQueryAsync(query);

            return(itemBetted);
        }
        public async void InsertItemBetSuccess()
        {
            var itemBet = new DatabaseModel.ItemBetted(_setup.Bet1.Id, _setup.Item1.DescriptionId, _setup.Item1.AssetId, new decimal(1.0));

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

            Assert.Equal(itemBet.BetId, res.BetId);
            Assert.Equal(itemBet.AssetId, res.AssetId);
            Assert.Equal(itemBet.DescriptionId, res.DescriptionId);
        }
        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);
        }
示例#4
0
 public SqlQuery InsertAsync(DatabaseModel.ItemBetted itemBetted)
 {
     return(InsertRangeAsync(new List <DatabaseModel.ItemBetted> {
         itemBetted
     }));
 }