using AsbCloudApp.Data.SAUB; using AsbCloudApp.Services; using AsbCloudDb.Model; using AsbCloudInfrastructure.Services.SAUB; using Moq; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Xunit; namespace AsbCloudWebApi.Tests.ServicesTests; public class EventServiceTest { private readonly AsbCloudDbContext context; private readonly EventService service; public EventServiceTest() { context = TestHelpter.MakeRealTestContext(); var telemetryTracker = new Mock(); var imezoneServiceMock = new Mock(); var telemetryService = new TelemetryService(context, telemetryTracker.Object, imezoneServiceMock.Object); service = new EventService(context, telemetryService); } [Fact] public async Task Upsert_telemetry_events() { var dtos = new List { new EventDto {Id = 1, IdCategory = 1, Message = "Test message 1"}, new EventDto {Id = 2, IdCategory = 1, Message = "Test message 2"} }; await service.UpsertAsync("uid", dtos); Assert.Equal(2, context.TelemetryEvents.Count()); } }