Skip to content

Commit

Permalink
#50
Browse files Browse the repository at this point in the history
* email test
  • Loading branch information
Yaroslav Husynin committed Mar 24, 2020
1 parent 3d3d9bd commit 64539a8
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 1 deletion.
60 changes: 60 additions & 0 deletions Elfo.Wardein.Core.Tests/GetEmailFromWatchers.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using Elfo.Wardein.Abstractions.Configuration.Models;
using Elfo.Wardein.Abstractions.Services;
using Elfo.Wardein.Abstractions.Watchers;
using Elfo.Wardein.Core.Helpers;
using Elfo.Wardein.Integrations.Oracle.Integration;
using Microsoft.Extensions.Configuration;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Threading.Tasks;

namespace Elfo.Wardein.Core.Tests
{
[TestClass]
public class GetEmailFromWatchers
{
private string connectionString = string.Empty;
OracleConnectionConfiguration OracleConnectionConfiguration;
private OracleIntegration oracleIntegration;
private IAmWatcherPersistenceService watcherPersistenceService;
private IAmNotificationService notificationService;

[TestInitialize]
public void Initialize()
{
var configuration = new ConfigurationBuilder()
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.Build();

connectionString = configuration["StorageConnectionString"];
WardeinBaseConfiguration wbc = new WardeinBaseConfiguration();

configuration.Bind(wbc);
ServicesContainer.Initialize(wbc);

OracleConnectionConfiguration = new OracleConnectionConfiguration.Builder(connectionString)
.WithClientId(configuration["OracleAdditionalParams:ClientId"])
.WithClientInfo(configuration["OracleAdditionalParams:ClientInfo"])
.WithModuleName(configuration["OracleAdditionalParams:ModuleName"])
.WithDateLanguage(configuration["OracleAdditionalParams:DateLanguage"])
.Build();
oracleIntegration = new OracleIntegration(OracleConnectionConfiguration);
watcherPersistenceService = ServicesContainer.WatcherPersistenceService();
notificationService = ServicesContainer.NotificationService(Abstractions.NotificationType.Mail);
}

[TestMethod]
[TestCategory("ManualTest")]
public async Task IsEmailWasSent()
{
Task result = null;
var svc = await watcherPersistenceService.UpsertCurrentStatus(1, 2, "SRVWEB07", false);
if (svc.PreviousStatus == false)
{
result = notificationService.SendNotificationAsync("[email protected];", "Restore was Successful test Message",
$"Attention");
}

Assert.IsNotNull(result);
}
}
}
2 changes: 1 addition & 1 deletion Elfo.Wardein.Integrations.Tests/GetDataFromSourceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public async Task UpdateIsOk()
{
var updateDateParameter = new Dictionary<string, object>
{
["JSON_CNFG"] = new OracleParameter("JSON_CNFG", OracleDbType.Clob).Value = "{}",
["JSON_CNFG"] = new OracleParameter("JSON_CNFG", OracleDbType.Clob).Value = "{\"services\": [{\n\"serviceName\": \"SQLWriter\",\n\"maxRetryCount\": \"2\", \n\"serviceManagerType\": \"0\" }\n]}",
["WTCHR_CNFG_ID"] = new OracleParameter("WTCHR_CNFG_ID", OracleDbType.Int32).Value = 1
};

Expand Down

0 comments on commit 64539a8

Please sign in to comment.