瀏覽代碼

completed unit tests for technology service

pull/151/head
Dzenis Hadzifejzovic 3 年之前
父節點
當前提交
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);
}

}
}

Loading…
取消
儲存