-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
a394ea8
commit 6777a54
Showing
18 changed files
with
710 additions
and
4 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
45 changes: 45 additions & 0 deletions
45
...ppInstallerCLIE2ETests/TestData/WinGetUtil/InstallerMetadata/MergeSubmissionMismatch.json
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,45 @@ | ||
{ | ||
"version": "1.0", | ||
"metadatas": [ | ||
{ | ||
"version": "1.0", | ||
"productVersionMin": "1.0", | ||
"productVersionMax": "1.0", | ||
"metadata": [ | ||
{ | ||
"installerHash": "ABCD", | ||
"submissionIdentifier": "1", | ||
"AppsAndFeaturesEntries": [ | ||
{ | ||
"DisplayName": "Name", | ||
"Publisher": "Publisher", | ||
"DisplayVersion": "1.0", | ||
"ProductCode": "{46210E3D-EBB3-43D4-B9BB-48A7DB0F9B93}", | ||
"InstallerType": 3 | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"version": "1.0", | ||
"productVersionMin": "1.0", | ||
"productVersionMax": "1.0", | ||
"metadata": [ | ||
{ | ||
"installerHash": "EFGH", | ||
"submissionIdentifier": "2", | ||
"AppsAndFeaturesEntries": [ | ||
{ | ||
"DisplayName": "Name", | ||
"Publisher": "Publisher", | ||
"DisplayVersion": "1.0", | ||
"ProductCode": "{46210E3D-EBB3-43D4-B9BB-48A7DB0F9B93}", | ||
"InstallerType": 3 | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
45 changes: 45 additions & 0 deletions
45
src/AppInstallerCLIE2ETests/TestData/WinGetUtil/InstallerMetadata/MergeValid.json
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,45 @@ | ||
{ | ||
"version": "1.0", | ||
"metadatas": [ | ||
{ | ||
"version": "1.0", | ||
"productVersionMin": "1.0", | ||
"productVersionMax": "1.0", | ||
"metadata": [ | ||
{ | ||
"installerHash": "ABCD", | ||
"submissionIdentifier": "1", | ||
"AppsAndFeaturesEntries": [ | ||
{ | ||
"DisplayName": "Name", | ||
"Publisher": "Publisher", | ||
"DisplayVersion": "1.0", | ||
"ProductCode": "{46210E3D-EBB3-43D4-B9BB-48A7DB0F9B93}", | ||
"InstallerType": 3 | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"version": "1.0", | ||
"productVersionMin": "1.0", | ||
"productVersionMax": "1.0", | ||
"metadata": [ | ||
{ | ||
"installerHash": "EFGH", | ||
"submissionIdentifier": "1", | ||
"AppsAndFeaturesEntries": [ | ||
{ | ||
"DisplayName": "Name", | ||
"Publisher": "Publisher", | ||
"DisplayVersion": "1.0", | ||
"ProductCode": "{46210E3D-EBB3-43D4-B9BB-48A7DB0F9B93}", | ||
"InstallerType": 3 | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
15 changes: 15 additions & 0 deletions
15
src/AppInstallerCLIE2ETests/TestData/WinGetUtil/InstallerMetadata/Minimal.json
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,15 @@ | ||
{ | ||
"version": "1.0", | ||
"supportedMetadataVersion": "1.0", | ||
"submissionData": { | ||
"submissionIdentifier": "1" | ||
}, | ||
"packageData": { | ||
"installerHash": "ABCD", | ||
"DefaultLocale": { | ||
"PackageLocale": "en-us", | ||
"PackageName": "Name", | ||
"Publisher": "Publisher" | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
src/AppInstallerCLIE2ETests/TestData/WinGetUtil/Manifests/Merged/WinGetUtilTest.Add.yaml
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,16 @@ | ||
Installers: | ||
- Architecture: x86 | ||
InstallerSha256: 0000000000000000000000000000000000000000000000000000000000000000 | ||
InstallerType: exe | ||
InstallerUrl: https://localhost:5001/TestKit/AppInstallerTestExeInstaller/AppInstallerTestExeInstaller.exe | ||
License: Test | ||
ManifestType: merged | ||
ManifestVersion: 1.1.0 | ||
MinimumOSVersion: 10.0.0.0 | ||
PackageIdentifier: AppInstallerTest.WinGetUtilTest | ||
PackageLocale: en-US | ||
PackageName: AppInstallerTest | ||
PackageVersion: 1.0.0.0 | ||
Publisher: AppInstallerTest | ||
Tags: | ||
- add |
16 changes: 16 additions & 0 deletions
16
src/AppInstallerCLIE2ETests/TestData/WinGetUtil/Manifests/Merged/WinGetUtilTest.Update.yaml
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,16 @@ | ||
Installers: | ||
- Architecture: x86 | ||
InstallerSha256: 0000000000000000000000000000000000000000000000000000000000000000 | ||
InstallerType: exe | ||
InstallerUrl: https://localhost:5001/TestKit/AppInstallerTestExeInstaller/AppInstallerTestExeInstaller.exe | ||
License: Test | ||
ManifestType: merged | ||
ManifestVersion: 1.1.0 | ||
MinimumOSVersion: 10.0.0.0 | ||
PackageIdentifier: AppInstallerTest.WinGetUtilTest | ||
PackageLocale: en-US | ||
PackageName: AppInstallerTest | ||
PackageVersion: 1.0.0.0 | ||
Publisher: AppInstallerTest | ||
Tags: | ||
- update |
10 changes: 10 additions & 0 deletions
10
...sts/TestData/WinGetUtil/Manifests/Unmerged/ValidateManifest/WinGetUtilTest.installer.yaml
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,10 @@ | ||
PackageIdentifier: AppInstallerTest.WinGetUtilTest | ||
PackageVersion: "1.0.0.0" | ||
MinimumOSVersion: 10.0.0.0 | ||
Installers: | ||
- Architecture: x86 | ||
InstallerUrl: https://localhost:5001/TestKit/AppInstallerTestExeInstaller/AppInstallerTestExeInstaller.exe | ||
InstallerType: nullsoft | ||
InstallerSha256: 0000000000000000000000000000000000000000000000000000000000000000 | ||
ManifestType: installer | ||
ManifestVersion: 1.1.0 |
9 changes: 9 additions & 0 deletions
9
.../TestData/WinGetUtil/Manifests/Unmerged/ValidateManifest/WinGetUtilTest.locale.en-US.yaml
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,9 @@ | ||
PackageIdentifier: AppInstallerTest.WinGetUtilTest | ||
PackageVersion: "1.0.0.0" | ||
PackageLocale: en-US | ||
Publisher: AppInstallerTest | ||
License: Test | ||
PackageName: AppInstallerTest | ||
ShortDescription: WinGetUtilTest | ||
ManifestType: defaultLocale | ||
ManifestVersion: 1.1.0 |
5 changes: 5 additions & 0 deletions
5
...erCLIE2ETests/TestData/WinGetUtil/Manifests/Unmerged/ValidateManifest/WinGetUtilTest.yaml
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 @@ | ||
PackageIdentifier: AppInstallerTest.WinGetUtilTest | ||
PackageVersion: "1.0.0.0" | ||
DefaultLocale: en-US | ||
ManifestType: version | ||
ManifestVersion: 1.1.0 |
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
33 changes: 33 additions & 0 deletions
33
src/AppInstallerCLIE2ETests/WinGetUtil/WinGetUtilCompareVersions.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,33 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
namespace AppInstallerCLIE2ETests.WinGetUtil | ||
{ | ||
using NUnit.Framework; | ||
|
||
public class WinGetUtilCompareVersions | ||
{ | ||
[Test] | ||
// V1 = V2 | ||
[TestCase("1.0.0.0", "1.0.0.0", 0)] | ||
[TestCase("1.0.0", "1.0.0.0", 0)] | ||
[TestCase("1.0", "1.0.0.0", 0)] | ||
[TestCase("1", "1.0.0.0", 0)] | ||
// V1 > V2 | ||
[TestCase("1.0.0.1", "1.0.0.0", 1)] | ||
[TestCase("1.0.1.0", "1.0.0.0", 1)] | ||
[TestCase("1.1.0.0", "1.0.0.0", 1)] | ||
[TestCase("2.0.0.0", "1.0.0.0", 1)] | ||
// V1 < V2 | ||
[TestCase("1.0.0.0", "1.0.0.1", -1)] | ||
[TestCase("1.0.0.0", "1.0.1.0", -1)] | ||
[TestCase("1.0.0.0", "1.1.0.0", -1)] | ||
[TestCase("1.0.0.0", "2.0.0.0", -1)] | ||
public void WinGetUtil_CompareVersions(string version1, string version2, int expectedResult) | ||
{ | ||
// Compare versions | ||
WinGetUtilWrapper.WinGetCompareVersions(version1, version2, out int result); | ||
Assert.AreEqual(expectedResult, result); | ||
} | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
src/AppInstallerCLIE2ETests/WinGetUtil/WinGetUtilDownload.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,27 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
namespace AppInstallerCLIE2ETests.WinGetUtil | ||
{ | ||
using System.IO; | ||
using System.Linq; | ||
using NUnit.Framework; | ||
|
||
public class WinGetUtilDownload | ||
{ | ||
[Test] | ||
public void WinGetUtil_Download() | ||
{ | ||
uint hashSize = 32; | ||
byte[] sha256Hash = new byte[hashSize]; | ||
string installerUrl = @"https://localhost:5001/TestKit/AppInstallerTestExeInstaller/AppInstallerTestExeInstaller.exe"; | ||
string filePath = TestCommon.GetRandomTestFile(".exe"); | ||
|
||
// Download | ||
WinGetUtilWrapper.WinGetDownload(installerUrl, filePath, sha256Hash, hashSize); | ||
|
||
Assert.True(File.Exists(filePath)); | ||
Assert.False(sha256Hash.All(byteVal => byteVal == 0)); | ||
} | ||
} | ||
} |
77 changes: 77 additions & 0 deletions
77
src/AppInstallerCLIE2ETests/WinGetUtil/WinGetUtilInstallerMetadataCollection.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,77 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
namespace AppInstallerCLIE2ETests.WinGetUtil | ||
{ | ||
using Newtonsoft.Json; | ||
using NUnit.Framework; | ||
using System; | ||
using System.IO; | ||
using System.Runtime.InteropServices; | ||
|
||
public class WinGetUtilInstallerMetadataCollection | ||
{ | ||
[Test] | ||
public void WinGetUtil_BeginCompleteInstallerMetadataCollection() | ||
{ | ||
string logFilePath = TestCommon.GetRandomTestFile(".log"); | ||
string inputJson = TestCommon.GetTestDataFile(@"WinGetUtil\InstallerMetadata\Minimal.json"); | ||
string outputFilePath = TestCommon.GetRandomTestFile(".json"); | ||
|
||
WinGetUtilWrapper.WinGetBeginInstallerMetadataCollection( | ||
inputJson, | ||
logFilePath, | ||
WinGetUtilWrapper.WinGetBeginInstallerMetadataCollectionOptions.WinGetBeginInstallerMetadataCollectionOption_InputIsFilePath, | ||
out IntPtr collectionHandle); | ||
|
||
Assert.AreNotEqual(IntPtr.Zero, collectionHandle); | ||
Assert.True(File.Exists(logFilePath)); | ||
|
||
WinGetUtilWrapper.WinGetCompleteInstallerMetadataCollection( | ||
collectionHandle, | ||
outputFilePath, | ||
WinGetUtilWrapper.WinGetCompleteInstallerMetadataCollectionOptions.WinGetCompleteInstallerMetadataCollectionOption_None); | ||
|
||
string outputJson = File.ReadAllText(outputFilePath); | ||
Assert.IsNotEmpty(JsonConvert.DeserializeObject(outputJson).ToString()); | ||
} | ||
|
||
[Test] | ||
public void WinGetUtil_MergeInstallerMetadata_Success() | ||
{ | ||
string logFilePath = TestCommon.GetRandomTestFile(".log"); | ||
string inputJsonPath = TestCommon.GetTestDataFile(@"WinGetUtil\InstallerMetadata\MergeValid.json"); | ||
string inputJson = File.ReadAllText(inputJsonPath); | ||
|
||
WinGetUtilWrapper.WinGetMergeInstallerMetadata( | ||
inputJson, | ||
out string outputJson, | ||
0, | ||
logFilePath, | ||
WinGetUtilWrapper.WinGetMergeInstallerMetadataOptions.WinGetMergeInstallerMetadataOptions_None); | ||
|
||
Assert.True(File.Exists(logFilePath)); | ||
Assert.IsNotEmpty(JsonConvert.DeserializeObject(outputJson).ToString()); | ||
} | ||
|
||
[Test] | ||
public void WinGetUtil_MergeInstallerMetadata_Fail_SubmissionMismatch() | ||
{ | ||
string logFilePath = TestCommon.GetRandomTestFile(".log"); | ||
string inputJsonPath = TestCommon.GetTestDataFile(@"WinGetUtil\InstallerMetadata\MergeSubmissionMismatch.json"); | ||
string inputJson = File.ReadAllText(inputJsonPath); | ||
|
||
Assert.Throws<COMException>(() => | ||
{ | ||
WinGetUtilWrapper.WinGetMergeInstallerMetadata( | ||
inputJson, | ||
out string outputJson, | ||
0, | ||
logFilePath, | ||
WinGetUtilWrapper.WinGetMergeInstallerMetadataOptions.WinGetMergeInstallerMetadataOptions_None); | ||
}); | ||
|
||
Assert.True(File.Exists(logFilePath)); | ||
} | ||
} | ||
} |
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,24 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
namespace AppInstallerCLIE2ETests.WinGetUtil | ||
{ | ||
using System.IO; | ||
using NUnit.Framework; | ||
|
||
public class WinGetUtilLog | ||
{ | ||
[Test] | ||
public void WinGetUtil_Logging() | ||
{ | ||
string filePath = TestCommon.GetRandomTestFile(".log"); | ||
|
||
// Init logging | ||
WinGetUtilWrapper.WinGetLoggingInit(filePath); | ||
Assert.True(File.Exists(filePath)); | ||
|
||
// Terminate logging | ||
WinGetUtilWrapper.WinGetLoggingTerm(filePath); | ||
} | ||
} | ||
} |
Oops, something went wrong.