Просмотр исходного кода

completed unit tests for technology service

pull/151/head
Dzenis Hadzifejzovic 3 лет назад
Родитель
Сommit
8c35b134a0
1 измененных файлов: 12 добавлений и 6 удалений
  1. 12
    6
      Diligent.WebAPI.Tests/Services/TechnologyServiceTests.cs

+ 12
- 6
Diligent.WebAPI.Tests/Services/TechnologyServiceTests.cs Просмотреть файл

@@ -1,16 +1,10 @@
using AutoMapper;
using Castle.Core.Logging;
using Diligent.WebAPI.Business.MappingProfiles;
using Diligent.WebAPI.Business.Services;
using Diligent.WebAPI.Contracts.DTOs.Technology;
using Diligent.WebAPI.Contracts.Exceptions;
using Diligent.WebAPI.Data.Entities;
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
{
@@ -90,5 +84,17 @@ namespace Diligent.WebAPI.Tests.Services

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);
}

}
}

Загрузка…
Отмена
Сохранить