| using AutoMapper; | using AutoMapper; | ||||
| using Castle.Core.Logging; | |||||
| using Diligent.WebAPI.Business.MappingProfiles; | using Diligent.WebAPI.Business.MappingProfiles; | ||||
| using Diligent.WebAPI.Business.Services; | using Diligent.WebAPI.Business.Services; | ||||
| using Diligent.WebAPI.Contracts.DTOs.Technology; | using Diligent.WebAPI.Contracts.DTOs.Technology; | ||||
| using Diligent.WebAPI.Contracts.Exceptions; | using Diligent.WebAPI.Contracts.Exceptions; | ||||
| using Diligent.WebAPI.Data.Entities; | using Diligent.WebAPI.Data.Entities; | ||||
| using Microsoft.Extensions.Logging; | using Microsoft.Extensions.Logging; | ||||
| using System; | |||||
| using System.Collections.Generic; | |||||
| using System.Linq; | |||||
| using System.Text; | |||||
| using System.Threading.Tasks; | |||||
| namespace Diligent.WebAPI.Tests.Services | namespace Diligent.WebAPI.Tests.Services | ||||
| { | { | ||||
| await Assert.ThrowsAsync<EntityNotFoundException>(async () => await tehnologyService.GetEntityByIdAsync(1000)); | await Assert.ThrowsAsync<EntityNotFoundException>(async () => await tehnologyService.GetEntityByIdAsync(1000)); | ||||
| } | } | ||||
| [Fact] | |||||
| public async Task GetEntitiesAsync_ShouldReturnListOfTechnologies_Always() | |||||
| { | |||||
| var databaseContext = await Helpers<Technology>.GetDatabaseContext(_technologies); | |||||
| TechnologyService tehnologyService = new(_mapper, databaseContext, _logger); | |||||
| var result = await tehnologyService.GetEntitiesAsync(new int[] {1}); | |||||
| Assert.Single(result); | |||||
| } | |||||
| } | } | ||||
| } | } |