test: fix AnalyticsServiceTests by mocking missing dependencies and adding moq
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.11" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.11" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||||
|
<PackageReference Include="Moq" Version="4.20.72" />
|
||||||
<PackageReference Include="xunit" Version="2.9.3" />
|
<PackageReference Include="xunit" Version="2.9.3" />
|
||||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ using Predictalytics.Domain.Enums;
|
|||||||
using Predictalytics.Domain.Interfaces;
|
using Predictalytics.Domain.Interfaces;
|
||||||
using Predictalytics.Infrastructure.Data;
|
using Predictalytics.Infrastructure.Data;
|
||||||
using Predictalytics.Infrastructure.Data.Repositories;
|
using Predictalytics.Infrastructure.Data.Repositories;
|
||||||
|
using Moq;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -35,17 +36,21 @@ public class AnalyticsServiceTests
|
|||||||
var tradeRepo = new TradeRepository(db);
|
var tradeRepo = new TradeRepository(db);
|
||||||
var marketRepo = new MarketRepository(db);
|
var marketRepo = new MarketRepository(db);
|
||||||
|
|
||||||
var discoveryMock = new MockDiscoveryService();
|
var discoveryMock = new Mock<IDiscoveryService>();
|
||||||
|
var pnlEngineMock = new Mock<IPositionPnLEngine>();
|
||||||
|
var alertRepoMock = new Mock<IAlertRepository>();
|
||||||
|
var watchlistRepoMock = new Mock<IWatchlistRepository>();
|
||||||
var providers = new List<IPlatformProvider>();
|
var providers = new List<IPlatformProvider>();
|
||||||
|
|
||||||
var analyticsService = new AnalyticsService(
|
var analyticsService = new AnalyticsService(
|
||||||
traderRepo,
|
traderRepo,
|
||||||
tradeRepo,
|
tradeRepo,
|
||||||
null!, // alertRepo (not used in GetTraderDeepDiveAsync)
|
alertRepoMock.Object,
|
||||||
null!, // watchlistRepo (not used in GetTraderDeepDiveAsync)
|
watchlistRepoMock.Object,
|
||||||
marketRepo,
|
marketRepo,
|
||||||
discoveryMock,
|
discoveryMock.Object,
|
||||||
providers,
|
providers,
|
||||||
|
pnlEngineMock.Object,
|
||||||
NullLogger<AnalyticsService>.Instance
|
NullLogger<AnalyticsService>.Instance
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user