Example #1
0
        public async Task GetRegionByIdAsync_ReturnsRegionDTO()
        {
            // Arrange
            int id = 1;

            _repoWrapper
            .Setup(x => x.Region.GetFirstOrDefaultAsync(It.IsAny <Expression <Func <DataAccess.Entities.Region, bool> > >(),
                                                        It.IsAny <Func <IQueryable <DataAccess.Entities.Region>, IIncludableQueryable <DataAccess.Entities.Region, object> > >()))
            .ReturnsAsync(new DataAccess.Entities.Region());
            _mapper.Setup(x => x.Map <DataAccess.Entities.Region, RegionDTO>(It.IsAny <DataAccess.Entities.Region>()))
            .Returns(regions.First);
            // Act
            var result = await _regionService.GetRegionByIdAsync(id);

            var actual = result.ID;

            // Assert
            Assert.IsInstanceOf <RegionDTO>(result);
            Assert.AreEqual(1, actual);
            Assert.IsNotNull(result);
        }