generated from microsoft/AL-Go-AppSource
-
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.
- Loading branch information
1 parent
e9e9756
commit b6b3336
Showing
12 changed files
with
159 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,25 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "BC23-dev", | ||
"type": "al", | ||
"request": "launch", | ||
"environmentType": "OnPrem", | ||
"server": "http://BC23-dev", | ||
"port": 7049, | ||
"serverInstance": "BC", | ||
"authentication": "UserPassword", | ||
"breakOnError": "All", | ||
"breakOnRecordWrite": "None", | ||
"launchBrowser": true, | ||
"enableSqlInformationDebugger": true, | ||
"enableLongRunningSqlStatements": true, | ||
"longRunningSqlStatementsThreshold": 500, | ||
"numberOfSqlStatements": 10, | ||
"tenant": "default", | ||
"usePublicURLFromServer": true, | ||
"schemaUpdateMode": "ForceSync" | ||
} | ||
] | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,53 @@ | ||
codeunit 50000 "TestBatchSend" | ||
{ | ||
Subtype = Test; | ||
|
||
var | ||
Assert: Codeunit "Library Assert"; | ||
|
||
[Test] | ||
procedure TestCreateBodyGetsCalled() | ||
var | ||
NtfyEntry: Record NtfyEntryNTSTM temporary; | ||
BatchSend: Codeunit BatchSendNtfysNTSTM; | ||
RestWrapper: Codeunit RestWrapperTestBodyNTSTM; | ||
begin | ||
NtfyEntry.Init(); | ||
NtfyEntry.NtfyMessage := 'Hello World'; | ||
if not NtfyEntry.Insert() then; | ||
asserterror BatchSend.SendRequests(NtfyEntry, RestWrapper); | ||
|
||
Assert.ExpectedError('CreateBody was called'); | ||
end; | ||
|
||
[Test] | ||
procedure TestPostGetsCalled() | ||
var | ||
NtfyEntry: Record NtfyEntryNTSTM temporary; | ||
BatchSend: Codeunit BatchSendNtfysNTSTM; | ||
RestWrapper: Codeunit RestWrapperTestPostNTSTM; | ||
begin | ||
NtfyEntry.Init(); | ||
NtfyEntry.NtfyMessage := 'Hello World'; | ||
if not NtfyEntry.Insert() then; | ||
asserterror BatchSend.SendRequests(NtfyEntry, RestWrapper); | ||
|
||
Assert.ExpectedError(StrSubstNo('Post was called with RequestUri: %1', StrSubstNo('https://ntfy.sh/%1', NtfyEntry.NtfyTopic))); | ||
end; | ||
|
||
[Test] | ||
procedure TestBodyGetsPassedToPostCorrectly() | ||
var | ||
NtfyEntry: Record NtfyEntryNTSTM temporary; | ||
BatchSend: Codeunit BatchSendNtfysNTSTM; | ||
RestWrapper: Codeunit RestWrapBodyPassNTSTM; | ||
begin | ||
NtfyEntry.Init(); | ||
NtfyEntry.NtfyMessage := 'Hello World'; | ||
if not NtfyEntry.Insert() then; | ||
BatchSend.SendRequests(NtfyEntry, RestWrapper); | ||
end; | ||
|
||
|
||
} | ||
|
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
18 changes: 18 additions & 0 deletions
18
MSDyn365BC.Ntfy.Test/doubles/RestWrapBodyPassNTSTM.Codeunit.al
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,18 @@ | ||
codeunit 50003 RestWrapBodyPassNTSTM implements IRestWrapperNTSTM | ||
{ | ||
var | ||
TempContentText: Text; | ||
|
||
procedure CreateBody(Content: Text) HttpContent: Codeunit System.RestClient."Http Content" | ||
begin | ||
TempContentText := Content; | ||
HttpContent.Create(Content); | ||
end; | ||
|
||
procedure Post(RequestUri: Text; Content: Codeunit System.RestClient."Http Content") HttpResponseMessage: Codeunit System.RestClient."Http Response Message" | ||
var | ||
Assert: Codeunit "Library Assert"; | ||
begin | ||
Assert.AreEqual(TempContentText, Content.AsText(), 'Content is not the same'); | ||
end; | ||
} |
11 changes: 11 additions & 0 deletions
11
MSDyn365BC.Ntfy.Test/doubles/RestWrapperTestBodyNTSTM.Codeunit.al
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,11 @@ | ||
codeunit 50001 RestWrapperTestBodyNTSTM implements IRestWrapperNTSTM | ||
{ | ||
procedure CreateBody(Content: Text) HttpContent: Codeunit System.RestClient."Http Content" | ||
begin | ||
Error('CreateBody was called'); | ||
end; | ||
|
||
procedure Post(RequestUri: Text; Content: Codeunit System.RestClient."Http Content") HttpResponseMessage: Codeunit System.RestClient."Http Response Message" | ||
begin | ||
end; | ||
} |
11 changes: 11 additions & 0 deletions
11
MSDyn365BC.Ntfy.Test/doubles/RestWrapperTestPostNTSTM.Codeunit.al
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,11 @@ | ||
codeunit 50002 RestWrapperTestPostNTSTM implements IRestWrapperNTSTM | ||
{ | ||
procedure CreateBody(Content: Text) HttpContent: Codeunit System.RestClient."Http Content" | ||
begin | ||
end; | ||
|
||
procedure Post(RequestUri: Text; Content: Codeunit System.RestClient."Http Content") HttpResponseMessage: Codeunit System.RestClient."Http Response Message" | ||
begin | ||
Error('Post was called with RequestUri: %1', RequestUri); | ||
end; | ||
} |
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
5 changes: 5 additions & 0 deletions
5
MSDyn365BC.Ntfy/src/helperInterfaces/IRestWrapper.Interface.al
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,5 @@ | ||
interface IRestWrapperNTSTM | ||
{ | ||
procedure CreateBody(Content: Text): Codeunit "Http Content" | ||
procedure Post(RequestUri: Text; Content: Codeunit "Http Content") HttpResponseMessage: Codeunit "Http Response Message" | ||
} |
14 changes: 14 additions & 0 deletions
14
MSDyn365BC.Ntfy/src/helperInterfaces/RestWrapper.Codeunit.al
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,14 @@ | ||
codeunit 71179880 RestWrapperNTSTM implements IRestWrapperNTSTM | ||
{ | ||
procedure CreateBody(Content: Text) HttpContent: Codeunit System.RestClient."Http Content" | ||
begin | ||
HttpContent.Create(Content); | ||
end; | ||
|
||
procedure Post(RequestUri: Text; Content: Codeunit System.RestClient."Http Content") HttpResponseMessage: Codeunit System.RestClient."Http Response Message" | ||
var | ||
RestClient: Codeunit "Rest Client"; | ||
begin | ||
exit(RestClient.Post(RequestUri, Content)); | ||
end; | ||
} |