コード例 #1
0
 public async Task<Bet> MapFromDto(BetDto betDto)
 {
     return new Bet
    {
        BoxerId = betDto.BoxerId,
        MatchId = betDto.MatchId,
        Id = betDto.Id,
        UserId = betDto.UserId,
        Canceled = betDto.Canceled
    };
 }
コード例 #2
0
        public async Task PlaceBetShouldCallRepository()
        {
            BetDto bet = new BetDto();
            m_BetRepositoryMock = new Mock<IBetRepository>();
            m_BetMapperMock = new Mock<IBetMapper>();
            m_BetService = new BetService(m_BetRepositoryMock.Object, m_BetMapperMock.Object);

            await m_BetService.CreateBet(bet).ConfigureAwait(false);

            m_BetRepositoryMock.Verify(x => x.Persist(It.IsAny<Bet>()), Times.Once);
        }
コード例 #3
0
 public async Task<HttpResponseMessage> Create(BetDto bet)
 {
     await m_BetService.CreateBet(bet).ConfigureAwait(false);
     return Request.CreateResponse(HttpStatusCode.Created);
 }
コード例 #4
0
 public async Task CreateBet(BetDto bet)
 {
     await m_BetRepository.Persist(await m_BetMapper.MapFromDto(bet).ConfigureAwait(false)).ConfigureAwait(false);
 }