Quellcode durchsuchen

completed unit tests for technology service

pull/151/head
Dzenis Hadzifejzovic vor 3 Jahren
Ursprung
Commit
8c35b134a0
1 geänderte Dateien mit 12 neuen und 6 gelöschten Zeilen
  1. 12
    6
      Diligent.WebAPI.Tests/Services/TechnologyServiceTests.cs

+ 12
- 6
Diligent.WebAPI.Tests/Services/TechnologyServiceTests.cs Datei anzeigen

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

}
}

Laden…
Abbrechen
Speichern