52 lines
1.5 KiB
C#
52 lines
1.5 KiB
C#
|
using Mapster;
|
|||
|
using Microsoft.AspNetCore.Mvc;
|
|||
|
using Microsoft.EntityFrameworkCore;
|
|||
|
using Persistence.IntegrationTests.Clients;
|
|||
|
using Persistence.Models;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Net;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using Xunit;
|
|||
|
|
|||
|
namespace Persistence.IntegrationTests.Controllers;
|
|||
|
public abstract class TimeSeriesBaseControllerTest<TDto> : BaseIntegrationTest
|
|||
|
where TDto : class, new()
|
|||
|
{
|
|||
|
private ITimeSeriesClient<TDto> client;
|
|||
|
|
|||
|
public TimeSeriesBaseControllerTest(WebAppFactoryFixture factory) : base(factory)
|
|||
|
{
|
|||
|
//dbContext.CleanupDbSet<TEntity>();
|
|||
|
client = factory.GetHttpClient<ITimeSeriesClient<TDto>>(string.Empty);
|
|||
|
}
|
|||
|
|
|||
|
public async Task InsertRangeSuccess(TDto dto)
|
|||
|
{
|
|||
|
//arrange
|
|||
|
var expected = dto.Adapt<TDto>();
|
|||
|
|
|||
|
//act
|
|||
|
var response = await client.InsertRangeAsync(new TDto[] { expected });
|
|||
|
|
|||
|
//assert
|
|||
|
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
|||
|
Assert.Equal(1, response.Content);
|
|||
|
|
|||
|
//var entity = GetByWellId();
|
|||
|
|
|||
|
//Assert.NotNull(entity);
|
|||
|
|
|||
|
//var actual = entity.Adapt<ChangeLogDto<TDto>>();
|
|||
|
//Assert.Equal(ProcessMapPlanBase.IdStateActual, actual.IdState);
|
|||
|
|
|||
|
//var excludeProps = new[] {
|
|||
|
// nameof(ProcessMapPlanBaseDto.Id),
|
|||
|
// nameof(ProcessMapPlanBaseDto.Section)
|
|||
|
//};
|
|||
|
//MatchHelper.Match(expected, actual.Item, excludeProps);
|
|||
|
}
|
|||
|
}
|