|
@@ -17,6 +17,7 @@ using Hotline.Share.Enums.Snapshot;
|
|
|
using Hotline.Share.Tools;
|
|
|
using Hotline.Snapshot;
|
|
|
using Hotline.Snapshot.Interfaces;
|
|
|
+using Hotline.Snapshot.Notifications;
|
|
|
using Hotline.Users;
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
@@ -41,8 +42,9 @@ public class SnapshotApplicationTest : TestBase
|
|
|
private readonly ISessionContext _sessionContext;
|
|
|
private readonly IGuiderSystemService _guiderSystemService;
|
|
|
private readonly ISystemSettingCacheManager _systemSettingCacheManager;
|
|
|
+ private readonly SnapshotPushNotificationHandler _snapshotPushNotificationHandler;
|
|
|
|
|
|
- public SnapshotApplicationTest(IAccountRepository accountRepository, IRepository<Role> roleRepository, UserController userController, IServiceScopeFactory scopeFactory, IRepository<User> userRepository, IHttpContextAccessor httpContextAccessor, ISnapshotApplication snapshotApplication, IIdentityAppService identityAppService, IRepository<RedPackRecord> redPackRecordRepository, IIndustryApplication industryApplication, IIndustryRepository industryRepository, IFileRepository fileRepository, OrderServiceMock orderServiceMock, IOrderRepository orderRepository, IOrderSnapshotRepository orderSnapshotRepository, IThirdIdentiyService thirdService, IThirdAccountRepository thirdAccount, ISessionContext sessionContext, IGuiderSystemService guiderSystemService, ISystemSettingCacheManager systemSettingCacheManager) : base(accountRepository, roleRepository, userController, scopeFactory, userRepository, httpContextAccessor, thirdService, thirdAccount)
|
|
|
+ public SnapshotApplicationTest(IAccountRepository accountRepository, IRepository<Role> roleRepository, UserController userController, IServiceScopeFactory scopeFactory, IRepository<User> userRepository, IHttpContextAccessor httpContextAccessor, ISnapshotApplication snapshotApplication, IIdentityAppService identityAppService, IRepository<RedPackRecord> redPackRecordRepository, IIndustryApplication industryApplication, IIndustryRepository industryRepository, IFileRepository fileRepository, OrderServiceMock orderServiceMock, IOrderRepository orderRepository, IOrderSnapshotRepository orderSnapshotRepository, IThirdIdentiyService thirdService, IThirdAccountRepository thirdAccount, ISessionContext sessionContext, IGuiderSystemService guiderSystemService, ISystemSettingCacheManager systemSettingCacheManager, SnapshotPushNotificationHandler snapshotPushNotificationHandler) : base(accountRepository, roleRepository, userController, scopeFactory, userRepository, httpContextAccessor, thirdService, thirdAccount)
|
|
|
{
|
|
|
_snapshotApplication = snapshotApplication;
|
|
|
_identityAppService = identityAppService;
|
|
@@ -57,6 +59,7 @@ public class SnapshotApplicationTest : TestBase
|
|
|
_sessionContext = sessionContext;
|
|
|
_guiderSystemService = guiderSystemService;
|
|
|
_systemSettingCacheManager = systemSettingCacheManager;
|
|
|
+ _snapshotPushNotificationHandler = snapshotPushNotificationHandler;
|
|
|
}
|
|
|
|
|
|
[Fact]
|
|
@@ -266,6 +269,19 @@ public class SnapshotApplicationTest : TestBase
|
|
|
result.Id.ShouldNotBeNull();
|
|
|
}
|
|
|
|
|
|
+ [Fact]
|
|
|
+ public async Task SnapshotPushNotificationHandler_Test()
|
|
|
+ {
|
|
|
+ var orderId = "08dd18e0-1c9e-4aa5-8dc6-f639e8d1b3ea";
|
|
|
+ await _snapshotPushNotificationHandler.Handle(new PostGuiderSystemNotification { OrderId = orderId}, CancellationToken.None);
|
|
|
+ var order = await _orderRepository.GetAsync(orderId);
|
|
|
+ var orderSnapshot = await _orderSnapshotRepository.GetAsync(orderId);
|
|
|
+ orderSnapshot.ShouldNotBeNull();
|
|
|
+ orderSnapshot.GuiderAccLog.ShouldNotBeNullOrEmpty();
|
|
|
+ orderSnapshot.GuiderSystemId.ShouldNotBeNullOrEmpty();
|
|
|
+ orderSnapshot.DeadLine.ShouldNotBeNull();
|
|
|
+ }
|
|
|
+
|
|
|
[Fact]
|
|
|
public async Task SaveInvitationCode_Test()
|
|
|
{
|