Exemplo n.º 1
0
        public void GetPilotById_WhenNegativeId_ThrowsArgumentException()
        {
            var id      = -1;
            var service = new PilotService(fakeUnitOfWork, mapper);

            Assert.ThrowsAsync <ArgumentException>(
                () => service.GetById(id));
        }
Exemplo n.º 2
0
        public void GetPilotById_WhenWrongId_ThrowsNotFoundException()
        {
            var id      = 10;
            var service = new PilotService(fakeUnitOfWork, mapper);

            Assert.ThrowsAsync <NotFoundException>(
                () => service.GetById(id));
        }
Exemplo n.º 3
0
        public async Task ReturnsDtoWithCorrectId()
        {
            var pilotService = new PilotService(_unitOfWork, _mapper);

            var pilot = await pilotService.GetById(5);

            Assert.AreEqual(5, pilot.Id);
        }
Exemplo n.º 4
0
        public async Task GetPilotById_WhenCorrectId_ReturnsPilot()
        {
            var id      = 1;
            var service = new PilotService(fakeUnitOfWork, mapper);

            var result = await service.GetById(id);

            Assert.IsTrue(result != null);
        }
Exemplo n.º 5
0
        public async Task DeletePilot_WhenCorrectId_DeletesPilot()
        {
            var id      = 1;
            var service = new PilotService(fakeUnitOfWork, mapper);

            await service.Remove(id);

            Assert.ThrowsAsync <NotFoundException>(
                () => service.GetById(id));
        }