コード例 #1
0
        public async Task GetGendersAllTest()
        {
            _repoWrapper.Setup(r => r.Gender.GetAllAsync(null, null)).ReturnsAsync(new List <Gender>().AsQueryable());

            var service = new UserPersonalDataService(_repoWrapper.Object, _mapper.Object);

            _mapper.Setup(x => x.Map <Gender, GenderDTO>(It.IsAny <Gender>())).Returns(new GenderDTO());
            // Act
            var result = await service.GetAllGendersAsync();

            // Assert
            Assert.NotNull(result);
            Assert.IsAssignableFrom <IEnumerable <GenderDTO> >(result);
        }
コード例 #2
0
        public async Task GetAllEducationsGroupBySpecialityTest()
        {
            _repoWrapper.Setup(r => r.Education.GetAllAsync(null, null)).ReturnsAsync(new List <Education>().AsQueryable());

            var service = new UserPersonalDataService(_repoWrapper.Object, _mapper.Object);

            _mapper.Setup(x => x.Map <Education, EducationDTO>(It.IsAny <Education>())).Returns(new EducationDTO());
            // Act
            var result = await service.GetAllEducationsGroupBySpecialityAsync();

            // Assert
            Assert.NotNull(result);
            Assert.IsAssignableFrom <IEnumerable <EducationDTO> >(result);
        }
コード例 #3
0
        public async Task GetEducationsByIdTest()
        {
            _repoWrapper.Setup(r => r.Education.GetFirstOrDefaultAsync(It.IsAny <Expression <Func <Education, bool> > >(), null)).ReturnsAsync(new Education());

            var service = new UserPersonalDataService(_repoWrapper.Object, _mapper.Object);

            _mapper.Setup(x => x.Map <Education, EducationDTO>(It.IsAny <Education>())).Returns(new EducationDTO());
            // Act
            var result = await service.GetEducationsByIdAsync(1);

            // Assert
            Assert.NotNull(result);
            Assert.IsType <EducationDTO>(result);
        }
コード例 #4
0
        public async Task GetAllWorkGroupByPositionTest()
        {
            _repoWrapper.Setup(r => r.Work.GetAllAsync(null, null)).ReturnsAsync(new List <Work>().AsQueryable());

            var service = new UserPersonalDataService(_repoWrapper.Object, _mapper.Object);

            _mapper.Setup(x => x.Map <Work, WorkDTO>(It.IsAny <Work>())).Returns(new WorkDTO());
            // Act
            var result = await service.GetAllWorkGroupByPositionAsync();

            // Assert
            Assert.NotNull(result);
            Assert.IsAssignableFrom <IEnumerable <WorkDTO> >(result);
        }