Exemple #1
0
        public async Task <IActionResult> DeleteQualification([Range(1, int.MaxValue)] int qualificationId, CancellationToken cancellationToken)
        {
            var deleted = await _qualificationService.DeleteQualification(qualificationId, cancellationToken);

            if (deleted)
            {
                return(Ok());
            }

            return(NotFound("No Qualification"));
        }
        public async Task DeleteQualification_failed()
        {
            Setup();

            _applicationContextMock.Setup(x => x.Qualifications).ReturnsDbSet(new List <Qualification>());

            _testedService = new QualificationService(Logger, _applicationContextMock.Object);

            var result = await _testedService.DeleteQualification(9, CancellationToken.None);

            Assert.False(result);
        }
        public async Task DeleteQualification_Success()
        {
            Setup();

            var expectedQual = new Qualification()
            {
                Id = 1, CoachId = 1, ServiceId = 1
            };
            var qualifications = new List <Qualification>()
            {
                expectedQual
            };

            _applicationContextMock.Setup(x => x.Qualifications).ReturnsDbSet(qualifications);

            _testedService = new QualificationService(Logger, _applicationContextMock.Object);

            var result = await _testedService.DeleteQualification(1, CancellationToken.None);

            Assert.True(result);
        }