public void DeleteShouldCallRepository()
        {
            const int boxerId = 1;
            m_BoxerRepositoryMock = new Mock<IBoxerRepository>();
            m_BoxerService = new BoxerService(m_BoxerRepositoryMock.Object);

            m_BoxerService.DeleteBoxer(boxerId);

            m_BoxerRepositoryMock.Verify(x => x.Delete(boxerId), Times.Once);
        }
        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 void GetBoxersShouldCallRepository()
        {
            m_BoxerRepositoryMock = new Mock<IBoxerRepository>();
            m_BoxerRepositoryMock.Setup(x => x.GetBoxers()).Returns(new Task<IList<Boxer>>(() => new List<Boxer>()));
            m_BoxerService = new BoxerService(m_BoxerRepositoryMock.Object);

            m_BoxerService.GetBoxers();

            m_BoxerRepositoryMock.Verify(x => x.GetBoxers(), Times.Once);
        }
Example #4
0
 public BattleService(ICratiaAppUnitOfWork unitOfWork, IBoxerService boxerService) : base(unitOfWork)
 {
     _boxerService = boxerService;
 }
 public BoxerController(IBoxerService boxerService)
 {
     m_BoxerService = boxerService;
 }
 public HomeController(IBoxerService boxerService)
 {
     _boxerService = boxerService;
 }