Ejemplo n.º 1
0
 public async Task CreateBoxer(BoxerDto boxer, string adminKey)
 {
     if (await m_AdministratorService.IsProvidedAdministratorKeyValid(adminKey))
     {
         await m_BoxerRepository.Persist(Mapper.Map<Boxer>(boxer));
     }
 }
        public void CreateBoxerShouldCallRepository()
        {
            BoxerDto boxer = new BoxerDto();
            m_BoxerRepositoryMock = new Mock<IBoxerRepository>();
            m_BoxerService = new BoxerService(m_BoxerRepositoryMock.Object);

            m_BoxerService.CreateBoxer(boxer);

            m_BoxerRepositoryMock.Verify(x => x.Persist(It.IsAny<Boxer>()), Times.Once);
        }
 public async Task<HttpResponseMessage> Create(BoxerDto boxer, string adminKey)
 {
     await m_BoxerService.CreateBoxer(boxer, adminKey).ConfigureAwait(false);
     return Request.CreateResponse(HttpStatusCode.Created);
 }