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

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

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

Loading…
Cancel
Save