1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- using Hotline.Api.Controllers;
- using Hotline.Caching.Interfaces;
- using Hotline.Caching.Services;
- using Hotline.Identity.Accounts;
- using Hotline.Identity.Roles;
- using Hotline.Settings;
- using Hotline.Snapshot.Interfaces;
- using Hotline.Users;
- using Microsoft.AspNetCore.Http;
- using Microsoft.Extensions.DependencyInjection;
- using Shouldly;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using XF.Domain.Repository;
- namespace Hotline.Application.Tests.Application;
- public class SystemSettingCacheManagerTest : TestBase
- {
- private readonly ISystemSettingCacheManager _systemSettingCacheManager;
- private readonly ISystemDicDataCacheManager _systemDicDataCacheManager;
- private readonly IRepository<SystemSetting> _systemSettingRepository;
- public SystemSettingCacheManagerTest(IAccountRepository accountRepository, IRepository<Role> roleRepository, UserController userController, IServiceScopeFactory scopeFactory, IRepository<User> userRepository, IHttpContextAccessor httpContextAccessor, ISystemSettingCacheManager systemSettingCacheManager, ISystemDicDataCacheManager systemDicDataCacheManager, IRepository<SystemSetting> systemSettingRepository, IThirdIdentiyService thirdService, IThirdAccountRepository thirdAccount) : base(accountRepository, roleRepository, userController, scopeFactory, userRepository, httpContextAccessor, thirdService, thirdAccount)
- {
- _systemSettingCacheManager = systemSettingCacheManager;
- _systemDicDataCacheManager = systemDicDataCacheManager;
- _systemSettingRepository = systemSettingRepository;
- }
- [Fact]
- public void CancelPublishOrderEnabled_Test()
- {
- var dd = DateTime.Parse("11/19/2024 18:08:00");
- _systemSettingCacheManager.CallSyncUnPushDateTime.ShouldBe(DateTime.Parse("2024/11/19 18:08:00"));
- //var result = _systemSettingCacheManager.CancelPublishOrderEnabled;
- //result.ShouldBeTrue();
- var seconds = _systemSettingCacheManager.VisitCallDelaySecond;
- seconds.ShouldBe(60);
- var delaySecond = _systemSettingCacheManager.DefaultVisitSmsDelaySecond;
- delaySecond.ShouldBe(172800);
- var delaySecondEntity = _systemSettingRepository.GetAsync("08dc0681-a6d2-4ce7-877d-db65f846d523");
- delaySecondEntity.ShouldNotBeNull("DefaultVisitSmsDelaySecond 系统设置为NULL");
- _systemSettingCacheManager.GetAboutToExpireVersion.ShouldBe(0);
- _systemSettingCacheManager.WxOpenAppId.ShouldNotBeNull();
- _systemSettingCacheManager.WxOpenAppSecret.ShouldNotBeNull();
- _systemSettingCacheManager.VisitCallDelaySecond.ShouldNotBe(0);
- _systemSettingCacheManager.AutomaticPublishOrder.ShouldBe(true);
- //_systemSettingCacheManager.CancelPublishOrderEnabled.ShouldBe(true);
- _systemDicDataCacheManager.RemoveSysDicDataCache(SysDicTypeConsts.Workplace);
- var workplace = _systemDicDataCacheManager.Workplace;
- workplace.ShouldNotBeNull();
- workplace.Count.ShouldNotBe(0);
- _systemDicDataCacheManager.RemoveSysDicDataCache(SysDicTypeConsts.WorkplaceName);
- var workArea = _systemDicDataCacheManager.WorkplaceName;
- workArea.ShouldNotBeNull();
- workArea.Count.ShouldNotBe(0);
- _systemDicDataCacheManager.RemoveSysDicDataCache(SysDicTypeConsts.SnapshotBulletinType);
- var snapshotBulletinType = _systemDicDataCacheManager.SnapshotBulletinType;
- snapshotBulletinType.ShouldNotBeNull();
- snapshotBulletinType.Count.ShouldNotBe(0);
- }
- }
|