-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactored summary service and added tests #GCPActive
- Loading branch information
Showing
4 changed files
with
75 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
....Notifications.Tests/Notifications.Core/TestingServices/NotificationSummaryServicTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System; | ||
|
||
using Altinn.Notifications.Core.Enums; | ||
using Altinn.Notifications.Core.Services; | ||
|
||
using Xunit; | ||
|
||
namespace Altinn.Notifications.Tests.Notifications.Core.TestingServices | ||
{ | ||
public class NotificationSummaryServicTests | ||
{ | ||
[Theory] | ||
[InlineData(EmailNotificationResultType.New, false)] | ||
[InlineData(EmailNotificationResultType.Sending, false)] | ||
[InlineData(EmailNotificationResultType.Succeeded, true)] | ||
[InlineData(EmailNotificationResultType.Delivered, true)] | ||
[InlineData(EmailNotificationResultType.Failed_RecipientNotIdentified, false)] | ||
public void IsSuccessResult_CheckResultForAllEnums(EmailNotificationResultType result, bool expectedIsSuccess) | ||
{ | ||
bool actualIsSuccess = NotificationSummaryService.IsSuccessResult(result); | ||
Assert.Equal(expectedIsSuccess, actualIsSuccess); | ||
} | ||
|
||
[Theory] | ||
[InlineData(EmailNotificationResultType.New, "The email has been created, but has not been picked up for processing yet.")] | ||
[InlineData(EmailNotificationResultType.Sending, "The email is being processed and will be attempted sent shortly.")] | ||
[InlineData(EmailNotificationResultType.Succeeded, "The email has been accepted by the third party email service and will be sent shortly.")] | ||
[InlineData(EmailNotificationResultType.Delivered, "The email was delivered to the recipient. No errors reported, making it likely it was received by the recipient.")] | ||
[InlineData(EmailNotificationResultType.Failed_RecipientNotIdentified, "Email was not sent because the recipient's email address was not found.")] | ||
public void GetResultDescription_ExpectedDescription(EmailNotificationResultType result, string expected) | ||
{ | ||
string actual = NotificationSummaryService.GetResultDescription(result); | ||
Assert.Equal(expected, actual); | ||
} | ||
|
||
[Fact] | ||
public void GetResultDescription_AllResultTypesHaveDescriptions() | ||
{ | ||
foreach (EmailNotificationResultType resultType in Enum.GetValues(typeof(EmailNotificationResultType))) | ||
{ | ||
string resultDescrption = NotificationSummaryService.GetResultDescription(resultType); | ||
Assert.NotEmpty(resultDescrption); | ||
} | ||
} | ||
} | ||
} |