Skip to content

Commit f069b64

Browse files
committed
Merge branch 'main' of https://github.com/microsoft/BCApps into features/579972-EDocumentDemodataForPA
2 parents f4d03d0 + b0895f4 commit f069b64

361 files changed

Lines changed: 38822 additions & 23643 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/AL-Go-Settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"runs-on": "windows-latest",
77
"cacheImageName": "",
88
"UsePsSession": false,
9-
"artifact": "bcinsider/Sandbox/28.0.43338.0//latest",
9+
"artifact": "bcinsider/Sandbox/28.0.43663.0//latest",
1010
"country": "base",
1111
"useProjectDependencies": true,
1212
"repoVersion": "28.0",

build/Packages.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"Microsoft.Dynamics.BusinessCentral.Translations": {
3-
"Version": "28.0.25338.2",
3+
"Version": "28.0.25349.4",
44
"Source": "NuGet.org"
55
},
66
"AppBaselines-BCArtifacts": {
7-
"Version": "27.3.43243.0",
7+
"Version": "27.3.43562.0",
88
"Source": "BCArtifacts",
99
"_comment": "Used to fetch app baselines from BC artifacts"
1010
}

build/projects/Apps (W1)/.AL-Go/RunTestsInBcContainer.ps1

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ Param(
22
[Hashtable]$parameters
33
)
44
Import-Module (Join-Path $PSScriptRoot "../../../scripts/EnlistmentHelperFunctions.psm1" -Resolve)
5+
6+
#TODO: Revert this when 616057 is fixed
7+
if ((Get-BuildMode -eq "CZ") -and ($parameters["appName"] -eq "Quality Management-Tests")) {
8+
Write-Host "Skipping tests for Quality Management in CZ build mode due to 616057"
9+
return $true
10+
}
11+
512
$testType = Get-ALGoSetting -Key "testType"
613

714
$parameters["returnTrueIfAllPassed"] = $true
@@ -10,8 +17,8 @@ $parameters["returnTrueIfAllPassed"] = $true
1017
$script = Join-Path $PSScriptRoot "../../../scripts/RunTestsInBcContainer.ps1" -Resolve
1118
$AllTestsPassed = (. $script -parameters $parameters -TestType $testType)
1219

13-
# TODO: For now only run disabled test isolation for unit tests
14-
if ($testType -ne "UnitTest") {
20+
# Uncategorized tests do not have RequiredTestIsolation set on the codeunits
21+
if ($testType -eq "Uncategorized") {
1522
return $AllTestsPassed
1623
}
1724

build/projects/Apps (W1)/.AL-Go/settings.json

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"doNotRunPageScriptingTests": true,
1818
"doNotRunBcptTests": true,
1919
"testType": "IntegrationTest",
20+
"companyName": "My Company",
2021
"buildModes": [
2122
"AT",
2223
"AU",
@@ -56,7 +57,8 @@
5657
"AU"
5758
],
5859
"settings": {
59-
"country": "au"
60+
"country": "au",
61+
"doNotRunTests": true
6062
}
6163
},
6264
{
@@ -88,8 +90,7 @@
8890
"CZ"
8991
],
9092
"settings": {
91-
"country": "cz",
92-
"doNotRunTests": true
93+
"country": "cz"
9394
}
9495
},
9596
{
@@ -227,15 +228,17 @@
227228
"UnitTests"
228229
],
229230
"settings": {
230-
"testType": "UnitTest"
231+
"testType": "UnitTest",
232+
"companyName": "Empty Company"
231233
}
232234
},
233235
{
234236
"buildModes": [
235237
"UncategorizedTests"
236238
],
237239
"settings": {
238-
"testType": "Uncategorized"
240+
"testType": "Uncategorized",
241+
"companyName": "CRONUS International Ltd."
239242
}
240243
},
241244
{

build/projects/Business Foundation Tests/.AL-Go/RunTestsInBcContainer.ps1

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@ Param(
22
[Hashtable]$parameters
33
)
44

5-
$parameters["testType"] = "UnitTest"
5+
Import-Module (Join-Path $PSScriptRoot "../../../scripts/EnlistmentHelperFunctions.psm1" -Resolve)
6+
$testType = Get-ALGoSetting -Key "testType"
67

8+
$parameters["returnTrueIfAllPassed"] = $true
9+
10+
# run test codeunits with specified TestType
711
$script = Join-Path $PSScriptRoot "../../../scripts/RunTestsInBcContainer.ps1" -Resolve
8-
. $script -parameters $parameters
12+
$AllTestsPassed = (. $script -parameters $parameters -TestType $testType)
13+
14+
# Run test codeunits with RequiredTestIsolation set to Disabled
15+
$AllTestsPassedIsolation = (. $script -parameters $parameters -DisableTestIsolation -TestType $testType)
16+
17+
return $AllTestsPassed -and $AllTestsPassedIsolation

build/projects/Business Foundation Tests/.AL-Go/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"testFolders": [
55
"../../../src/Business Foundation/Test"
66
],
7-
"installOnlyReferencedApps": false
7+
"installOnlyReferencedApps": false,
8+
"testType": "UnitTest"
89
}

build/scripts/ImportTestDataInBcContainer.ps1

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Import-Module $PSScriptRoot\EnlistmentHelperFunctions.psm1
88
function Invoke-ContosoDemoTool() {
99
param(
1010
[string]$ContainerName,
11-
[string]$CompanyName = (Get-NavDefaultCompanyName -ContainerName $ContainerName),
11+
[string]$CompanyName = (Get-TestCompanyName),
1212
[switch]$SetupData
1313
)
1414
Write-Host "Initializing company in container $ContainerName"
@@ -26,24 +26,13 @@ function Invoke-ContosoDemoTool() {
2626
Invoke-NavContainerCodeunit -CodeunitId 5691 -containerName $ContainerName -CompanyName $CompanyName
2727
}
2828

29-
function Get-NavDefaultCompanyName
30-
{
31-
param(
32-
[string]$ContainerName
33-
)
34-
# Log all companies in the container
35-
$companies = Get-CompanyInBcContainer -containerName $ContainerName
36-
$companies | Foreach-Object { Write-Host "Company: $($_.CompanyName)" }
37-
38-
# Look for the Cronus company
39-
$cronusCompany = $companies | Where-Object { $_.CompanyName -match "CRONUS" } | Select-Object -First 1
40-
if ($cronusCompany) {
41-
Write-Host "Using company $($cronusCompany.CompanyName) for demo data generation"
42-
return $cronusCompany.CompanyName
29+
function Get-TestCompanyName() {
30+
$companyName = Get-ALGoSetting -Key "companyName"
31+
if ([string]::IsNullOrEmpty($companyName)) {
32+
return "CRONUS International Ltd." # Fallback in case no company name is specified in settings
33+
} else {
34+
return $companyName
4335
}
44-
45-
# If no Cronus company is found, thow
46-
throw "No Cronus company found in container $ContainerName.."
4736
}
4837

4938
function Invoke-DemoDataGeneration
@@ -70,6 +59,27 @@ function Invoke-DemoDataGeneration
7059

7160
}
7261

62+
function New-TestCompany() {
63+
param(
64+
[Parameter(Mandatory=$true)]
65+
[string]$ContainerName,
66+
[Parameter(Mandatory=$true)]
67+
[string]$CompanyName,
68+
[Parameter(Mandatory=$false)]
69+
[switch]$EvaluationCompany
70+
)
71+
72+
# Delete existing companies in the container
73+
$existingCompanies = Get-CompanyInBcContainer -containerName $ContainerName
74+
foreach ($company in $existingCompanies) {
75+
Write-Host "Deleting company $($company.CompanyName) in container $ContainerName"
76+
Remove-CompanyInBcContainer -containerName $ContainerName -companyName $company.CompanyName
77+
}
78+
79+
Write-Host "Creating new test company in container $ContainerName"
80+
New-CompanyInBcContainer -containerName $ContainerName -companyName $CompanyName -evaluationCompany:$EvaluationCompany
81+
}
82+
7383
# Reinstall all the uninstalled apps in the container
7484
# This is needed to ensure that the various Demo Data apps are installed in the container when we generate demo data
7585
$allUninstalledApps = Get-BcContainerAppInfo -containerName $parameters.ContainerName -tenantSpecificProperties -sort DependenciesFirst | Where-Object { $_.IsInstalled -eq $false }
@@ -88,4 +98,13 @@ foreach ($app in (Get-BcContainerAppInfo -containerName $ContainerName -tenantSp
8898
Write-Host "App: $($app.Name) ($($app.Version)) - Scope: $($app.Scope) - $($app.IsInstalled) / $($app.IsPublished)"
8999
}
90100

101+
$testType = Get-ALGoSetting -Key "testType"
102+
if ($testType -eq "Uncategorized") {
103+
Write-Host "Creating evaluation test company"
104+
New-TestCompany -ContainerName $parameters.ContainerName -CompanyName (Get-TestCompanyName) -EvaluationCompany
105+
} else {
106+
Write-Host "Creating standard test company"
107+
New-TestCompany -ContainerName $parameters.ContainerName -CompanyName (Get-TestCompanyName)
108+
}
109+
91110
Invoke-DemoDataGeneration -ContainerName $parameters.ContainerName -TestType (Get-ALGoSetting -Key "testType")

build/scripts/RunTestsInBcContainer.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ if ($DisableTestIsolation)
6969
$parameters["testRunnerCodeunitId"] = "130451" # Test Runner with disabled test isolation
7070

7171
return Invoke-TestsWithReruns -parameters $parameters -maxReruns 1 # do not retry for Isolation Disabled tests, as they leave traces in the DB
72+
} else
73+
{ # this is neded to reset the parameters, in case of previous run with -DisableTestIsolation
74+
Write-Host "Using RequiredTestIsolation: None"
75+
$parameters["requiredTestIsolation"] = "None" # filtering on tests that don't require Test Isolation
76+
$parameters["testRunnerCodeunitId"] = "130450" # Test Runner with Codeunit test isolation
7277
}
7378

7479
return Invoke-TestsWithReruns -parameters $parameters

src/Apps/W1/EDocument/App/src/Document/EDocumentsSetup.Table.al

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ table 6107 "E-Documents Setup"
3838
var
3939
EnvironmentInformation: Codeunit "Environment Information";
4040
TenantId: Text;
41+
ListOfAvailableCountries: List of [Text];
4142
begin
4243
Clear(Rec);
4344
if Rec.FindFirst() then
@@ -59,7 +60,27 @@ table 6107 "E-Documents Setup"
5960
if EnvironmentInformation.GetEnvironmentSetting('EnableNewEDocumentExperience') <> '' then
6061
exit(true);
6162

62-
exit(EnvironmentInformation.GetApplicationFamily() in ['US', 'AU', 'NZ', 'GB', 'W1'])
63+
ListOfAvailableCountries := GetListOfNewExperienceCountries();
64+
ListOfAvailableCountries.Add('W1');
65+
66+
exit(ListOfAvailableCountries.Contains(EnvironmentInformation.GetApplicationFamily()));
67+
end;
68+
69+
internal procedure GetListOfNewExperienceCountries(): List of [Text]
70+
var
71+
CountryList: List of [Text];
72+
begin
73+
CountryList.Add('US');
74+
CountryList.Add('AU');
75+
CountryList.Add('NZ');
76+
CountryList.Add('GB');
77+
CountryList.Add('ES');
78+
CountryList.Add('FR');
79+
CountryList.Add('CA');
80+
CountryList.Add('IT');
81+
CountryList.Add('DE');
82+
CountryList.Add('DK');
83+
exit(CountryList);
6384
end;
6485

6586
[TryFunction]

src/Apps/W1/EDocument/App/src/Format/EDocPEPPOLBIS30.Codeunit.al

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ using Microsoft.Inventory.Transfer;
66
using Microsoft.Purchases.Document;
77
using Microsoft.Sales.Document;
88
using Microsoft.Sales.FinanceCharge;
9-
using Microsoft.Service.Document;
109
using Microsoft.Sales.History;
1110
using Microsoft.Sales.Peppol;
1211
using Microsoft.Sales.Reminder;
12+
using Microsoft.Service.Document;
1313
using Microsoft.Service.History;
1414
using System.Utilities;
1515

0 commit comments

Comments
 (0)