示例#1
0
        public void GetTradeIdsTakesPlayersAndReturnsStringWithIds()
        {
            //Arrange
            var players = new List <BidViewModel>
            {
                new BidViewModel
                {
                    TradeId = "12345",
                    Status  = "outbid"
                },
                new BidViewModel
                {
                    TradeId = "54321",
                    Status  = "outbid"
                },
                new BidViewModel
                {
                    TradeId = "9876",
                    Status  = "highest"
                }
            };
            var expected = new TradeIdsModel
            {
                TradeIds = "12345,54321"
            };

            //Act
            var actual = _tradeIdsBuilder.GetTradeIds(players);

            //Assert
            actual.Should().BeEquivalentTo(expected);
        }
示例#2
0
        public void DeleteExpiredPlayersCallsDeleteMakerAndDoesNotThrowError()
        {
            //Arrange
            var token   = "Abc";
            var players = new List <BidViewModel>();
            var ids     = new TradeIdsModel
            {
                TradeIds = "12345"
            };

            A.CallTo(() => _tradeIdsBuilder.GetTradeIds(players)).Returns(ids);
            A.CallTo(() => _urlBuilder.BuildDeletePlayerUrl(ids.TradeIds)).Returns("DeleteUrl");
            //Act

            //Assert
            Assert.DoesNotThrow(() => _deleteHandler.DeleteExpiredPlayers(token, players));
            A.CallTo(() => _deleteMaker.MakeDeleteRequest(token, "DeleteUrl")).MustHaveHappenedOnceExactly();
        }
示例#3
0
 public async Task DeleteExpiredPlayers(string accessToken, List <BidViewModel> players)
 {
     var tradeIds = _tradeIdsBuilder.GetTradeIds(players);
     var url      = _urlBuilder.BuildDeletePlayerUrl(tradeIds.TradeIds);
     await _deleteMaker.MakeDeleteRequest(accessToken, url);
 }