Example #1
0
        public void GetPilotById_WhenNegativeId_ThrowsArgumentException()
        {
            var id      = -1;
            var service = new PilotService(fakeUnitOfWork, mapper);

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

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

            var pilot = await pilotService.GetById(5);

            Assert.AreEqual(5, pilot.Id);
        }
Example #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);
        }
Example #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));
        }