forked from ddrilling/AsbCloudServer
fix EventServiceTest.Upsert_telemetry_events()
This commit is contained in:
parent
a8c4fa58e9
commit
2f5178a68e
@ -15,25 +15,22 @@ namespace AsbCloudWebApi.Tests.ServicesTests;
|
|||||||
public class EventServiceTest
|
public class EventServiceTest
|
||||||
{
|
{
|
||||||
private readonly AsbCloudDbContext context;
|
private readonly AsbCloudDbContext context;
|
||||||
private readonly CacheDb cacheDb;
|
private readonly CacheDb cacheDb;
|
||||||
private readonly Mock<ITelemetryService> telemetryService;
|
private readonly EventService service;
|
||||||
|
|
||||||
public EventServiceTest()
|
public EventServiceTest()
|
||||||
{
|
{
|
||||||
context = TestHelpter.MakeTestContext();
|
context = TestHelpter.MakeTestContext();
|
||||||
cacheDb = new CacheDb();
|
cacheDb = new CacheDb();
|
||||||
telemetryService = new Mock<ITelemetryService>();
|
var telemetryTracker = new Mock<ITelemetryTracker>();
|
||||||
telemetryService.Setup(s => s.GetOrCreateTelemetryIdByUid(It.IsAny<string>()))
|
var imezoneServiceMock = new Mock<ITimezoneService>();
|
||||||
.Returns(1);
|
var telemetryService = new TelemetryService(context, telemetryTracker.Object, imezoneServiceMock.Object, cacheDb);
|
||||||
context.TelemetryEvents.RemoveRange(context.TelemetryEvents);
|
service = new EventService(context, cacheDb, telemetryService);
|
||||||
context.SaveChanges();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task It_should_save_two_telemetry_events()
|
public async Task Upsert_telemetry_events()
|
||||||
{
|
{
|
||||||
var service = new EventService(context, cacheDb, telemetryService.Object);
|
|
||||||
|
|
||||||
var dtos = new List<EventDto>
|
var dtos = new List<EventDto>
|
||||||
{
|
{
|
||||||
new EventDto {Id = 1, IdCategory = 1, Message = "Test message 1"},
|
new EventDto {Id = 1, IdCategory = 1, Message = "Test message 1"},
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
using AsbCloudDb.Model;
|
using AsbCloudDb.Model;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace AsbCloudWebApi.Tests
|
namespace AsbCloudWebApi.Tests
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user