Browse Source

fix unit tests

pull/677/head
cKey 3 years ago
parent
commit
a84a6f11ed
  1. 4
      aspnet-core/tests/LINGYUN.Abp.Notifications.Tests/LINGYUN/Abp/Notifications/FakeNotificationSender.cs
  2. 21
      aspnet-core/tests/LINGYUN.Abp.Notifications.Tests/LINGYUN/Abp/Notifications/NotificationsTestsDefinitionProvider_Tests.cs

4
aspnet-core/tests/LINGYUN.Abp.Notifications.Tests/LINGYUN/Abp/Notifications/FakeNotificationSender.cs

@ -63,7 +63,7 @@ public class FakeNotificationSender : INotificationSender, ITransientDependency
NotificationSeverity severity = NotificationSeverity.Info, NotificationSeverity severity = NotificationSeverity.Info,
IEnumerable<string> useProviders = null) IEnumerable<string> useProviders = null)
{ {
var notification = NotificationDefinitionManager.GetOrNull(name); var notification = await NotificationDefinitionManager.GetOrNullAsync(name);
if (notification == null) if (notification == null)
{ {
return ""; return "";
@ -114,7 +114,7 @@ public class FakeNotificationSender : INotificationSender, ITransientDependency
NotificationSeverity severity = NotificationSeverity.Info, NotificationSeverity severity = NotificationSeverity.Info,
IEnumerable<string> useProviders = null) IEnumerable<string> useProviders = null)
{ {
var notification = NotificationDefinitionManager.GetOrNull(name); var notification = await NotificationDefinitionManager.GetOrNullAsync(name);
if (notification == null) if (notification == null)
{ {
return ""; return "";

21
aspnet-core/tests/LINGYUN.Abp.Notifications.Tests/LINGYUN/Abp/Notifications/NotificationsTestsDefinitionProvider_Tests.cs

@ -1,4 +1,5 @@
using Shouldly; using Shouldly;
using System.Threading.Tasks;
using Volo.Abp.Localization; using Volo.Abp.Localization;
using Xunit; using Xunit;
@ -14,32 +15,32 @@ namespace LINGYUN.Abp.Notifications
} }
[Fact] [Fact]
public void GetGroups_Test() public async Task GetGroups_Test()
{ {
var groups = NotificationDefinitionManager.GetGroups(); var groups = await NotificationDefinitionManager.GetGroupsAsync();
groups.Count.ShouldBe(2); groups.Count.ShouldBe(2);
} }
[Fact] [Fact]
public void GetAll_Test() public async Task GetNotifications_Test()
{ {
var notifications = NotificationDefinitionManager.GetAll(); var notifications = await NotificationDefinitionManager.GetNotificationsAsync();
notifications.Count.ShouldBe(6); notifications.Count.ShouldBe(6);
} }
[Fact] [Fact]
public void GetOrNull_Test() public async Task GetOrNull_Test()
{ {
NotificationDefinitionManager.GetOrNull(NotificationsTestsNames.Test2).ShouldNotBeNull(); (await NotificationDefinitionManager.GetOrNullAsync(NotificationsTestsNames.Test2)).ShouldNotBeNull();
NotificationDefinitionManager.GetOrNull(NotificationsTestsNames.Test3).ShouldNotBeNull(); (await NotificationDefinitionManager.GetOrNullAsync(NotificationsTestsNames.Test3)).ShouldNotBeNull();
NotificationDefinitionManager.GetOrNull("NullOfNotification").ShouldBeNull(); (await NotificationDefinitionManager.GetOrNullAsync("NullOfNotification")).ShouldBeNull();
} }
[Theory] [Theory]
[InlineData(NotificationsTestsNames.Test1)] [InlineData(NotificationsTestsNames.Test1)]
public void Get_Test(string name) public async Task Get_Test(string name)
{ {
var notification = NotificationDefinitionManager.Get(name); var notification = await NotificationDefinitionManager.GetAsync(name);
notification.Name.ShouldBe(name); notification.Name.ShouldBe(name);
notification.DisplayName.ShouldBeOfType<FixedLocalizableString>(); notification.DisplayName.ShouldBeOfType<FixedLocalizableString>();
notification.Description.ShouldBeNull(); notification.Description.ShouldBeNull();

Loading…
Cancel
Save