diff --git a/src/WingetCreateCLI/Commands/UpdateCommand.cs b/src/WingetCreateCLI/Commands/UpdateCommand.cs index a182ad4..732f168 100644 --- a/src/WingetCreateCLI/Commands/UpdateCommand.cs +++ b/src/WingetCreateCLI/Commands/UpdateCommand.cs @@ -860,7 +860,8 @@ private async Task UpdateSingleInstallerInteractively(Installer installer) while (true) { - string url = Prompt.Input(Resources.NewInstallerUrl_Message, null, new[] { FieldValidation.ValidateProperty(newInstaller, nameof(Installer.InstallerUrl)) }).Trim(); + string url = Prompt.Input(Resources.NewInstallerUrl_Message, null, null, new[] { FieldValidation.ValidateProperty(newInstaller, nameof(Installer.InstallerUrl)) }); + string packageFile = await DownloadPackageFile(url); if (string.IsNullOrEmpty(packageFile)) diff --git a/src/WingetCreateCLI/Logger/Logger.cs b/src/WingetCreateCLI/Logger/Logger.cs index 273fb03..acc940d 100644 --- a/src/WingetCreateCLI/Logger/Logger.cs +++ b/src/WingetCreateCLI/Logger/Logger.cs @@ -39,24 +39,26 @@ public static class Logger public static void Initialize() { // Add rules to file log configuration - var loggerFileConfig = new LoggingConfiguration(); - loggerFileConfig.AddRule(LogLevel.Trace, LogLevel.Fatal, FileTarget); + var loggerFileFactory = new LogFactory().Setup().LoadConfiguration(builder => + { + builder.Configuration.AddRule(LogLevel.Trace, LogLevel.Fatal, FileTarget, "File"); + }); - // Apply file log config - var loggerFileFactory = new LogFactory(loggerFileConfig); + // Get logger for file loggerFile = loggerFileFactory.GetLogger("File"); // Add rules to console log configuration - var loggerConsoleConfig = new LoggingConfiguration(); - loggerConsoleConfig.AddRule(LogLevel.Debug, LogLevel.Fatal, ConsoleTarget); + var loggerConsoleFactory = new LogFactory().Setup().LoadConfiguration(builder => + { + builder.Configuration.AddRule(LogLevel.Debug, LogLevel.Fatal, ConsoleTarget, "Console"); + }); // Set color for specific log level SetColorForConsoleTarget(ConsoleTarget, LogLevel.Info, ConsoleOutputColor.Green); SetColorForConsoleTarget(ConsoleTarget, LogLevel.Warn, ConsoleOutputColor.Yellow); SetColorForConsoleTarget(ConsoleTarget, LogLevel.Error, ConsoleOutputColor.Red); - // Apply console log config - var loggerConsoleFactory = new LogFactory(loggerConsoleConfig); + // Get logger for console loggerConsole = loggerConsoleFactory.GetLogger("Console"); } diff --git a/src/WingetCreateCLI/Models/SettingsModel.cs b/src/WingetCreateCLI/Models/SettingsModel.cs index c07ebf3..47f7f25 100644 --- a/src/WingetCreateCLI/Models/SettingsModel.cs +++ b/src/WingetCreateCLI/Models/SettingsModel.cs @@ -1,116 +1,146 @@ //---------------------- // -// Generated using the NJsonSchema v10.4.3.0 (Newtonsoft.Json v11.0.0.0) (http://NJsonSchema.org) +// Generated using the NJsonSchema v11.0.0.0 (Newtonsoft.Json v13.0.0.0) (http://NJsonSchema.org) // //---------------------- + namespace Microsoft.WingetCreateCLI.Models.Settings { #pragma warning disable // Disable all warnings - /// Telemetry settings - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.3.0 (Newtonsoft.Json v11.0.0.0)")] - public partial class Telemetry + /// + /// Telemetry settings + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.0.0 (Newtonsoft.Json v13.0.0.0)")] + public partial class Telemetry { - /// Controls whether telemetry events are written + /// + /// Controls whether telemetry events are written + /// [Newtonsoft.Json.JsonProperty("disable", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool Disable { get; set; } = false; - - + + } - - /// Controls the clean up interval of installer cache and logs - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.3.0 (Newtonsoft.Json v11.0.0.0)")] - public partial class CleanUp + + /// + /// Controls the clean up interval of installer cache and logs + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.0.0 (Newtonsoft.Json v13.0.0.0)")] + public partial class CleanUp { - /// Controls the interval in days for clean up of old files and folders + /// + /// Controls the interval in days for clean up of old files and folders + /// [Newtonsoft.Json.JsonProperty("intervalInDays", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Range(1, int.MaxValue)] public int IntervalInDays { get; set; } = 7; - - /// Controls whether clean up is disabled + + /// + /// Controls whether clean up is disabled + /// [Newtonsoft.Json.JsonProperty("disable", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool Disable { get; set; } = false; - - + + } - - /// Windows Package Manager Repository settings - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.3.0 (Newtonsoft.Json v11.0.0.0)")] - public partial class WindowsPackageManagerRepository + + /// + /// Windows Package Manager Repository settings + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.0.0 (Newtonsoft.Json v13.0.0.0)")] + public partial class WindowsPackageManagerRepository { - /// Specifies the name of the Windows Package Manager Repository owner + /// + /// Specifies the name of the Windows Package Manager Repository owner + /// [Newtonsoft.Json.JsonProperty("owner", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Owner { get; set; } = "microsoft"; - - /// Specifies the name of the Windows Package Manager Repository + + /// + /// Specifies the name of the Windows Package Manager Repository + /// [Newtonsoft.Json.JsonProperty("name", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Name { get; set; } = "winget-pkgs"; - - + + } - - /// Output manifest settings - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.3.0 (Newtonsoft.Json v11.0.0.0)")] - public partial class Manifest + + /// + /// Output manifest settings + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.0.0 (Newtonsoft.Json v13.0.0.0)")] + public partial class Manifest { - /// Specifies the format of the manifest file + /// + /// Specifies the format of the manifest file + /// [Newtonsoft.Json.JsonProperty("format", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] public ManifestFormat Format { get; set; } = Microsoft.WingetCreateCLI.Models.Settings.ManifestFormat.Yaml; - - + + } - - /// Visual settings - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.3.0 (Newtonsoft.Json v11.0.0.0)")] - public partial class Visual + + /// + /// Visual settings + /// + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.0.0 (Newtonsoft.Json v13.0.0.0)")] + public partial class Visual { - /// Controls whether paths displayed on the console are substituted with environment variables + /// + /// Controls whether paths displayed on the console are substituted with environment variables + /// [Newtonsoft.Json.JsonProperty("anonymizePaths", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public bool AnonymizePaths { get; set; } = true; - - + + } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.3.0 (Newtonsoft.Json v11.0.0.0)")] - public partial class SettingsManifest + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.0.0 (Newtonsoft.Json v13.0.0.0)")] + public partial class SettingsManifest { - /// The settings json schema + /// + /// The settings json schema + /// [Newtonsoft.Json.JsonProperty("$schema", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] public string Schema { get; set; } = "https://aka.ms/wingetcreate-settings.schema.0.1.json"; - + [Newtonsoft.Json.JsonProperty("Telemetry", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public Telemetry Telemetry { get; set; } = new Telemetry(); - + [Newtonsoft.Json.JsonProperty("CleanUp", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public CleanUp CleanUp { get; set; } = new CleanUp(); - + [Newtonsoft.Json.JsonProperty("WindowsPackageManagerRepository", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public WindowsPackageManagerRepository WindowsPackageManagerRepository { get; set; } = new WindowsPackageManagerRepository(); - + [Newtonsoft.Json.JsonProperty("Manifest", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public Manifest Manifest { get; set; } = new Manifest(); - + [Newtonsoft.Json.JsonProperty("Visual", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)] [System.ComponentModel.DataAnnotations.Required] public Visual Visual { get; set; } = new Visual(); - - + + } - - [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "10.4.3.0 (Newtonsoft.Json v11.0.0.0)")] + + [System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "11.0.0.0 (Newtonsoft.Json v13.0.0.0)")] public enum ManifestFormat { + [System.Runtime.Serialization.EnumMember(Value = @"yaml")] Yaml = 0, - + + [System.Runtime.Serialization.EnumMember(Value = @"json")] Json = 1, - + + } } \ No newline at end of file diff --git a/src/WingetCreateCLI/PromptHelper.cs b/src/WingetCreateCLI/PromptHelper.cs index aa94595..40ebb5b 100644 --- a/src/WingetCreateCLI/PromptHelper.cs +++ b/src/WingetCreateCLI/PromptHelper.cs @@ -126,10 +126,7 @@ public static void PromptListOfClassType(object model, string memberName) { var property = model.GetType().GetProperty(memberName); List objectList = (List)property.GetValue(model); - if (objectList == null) - { - objectList = new List(); - } + objectList ??= new List(); string name = objectList.GetType().GetGenericArguments().Single().Name; @@ -298,7 +295,7 @@ public static void PromptValue(string message, object model, string memberNam if (instanceType == typeof(string)) { - string result = Prompt.Input(message, property.GetValue(model), new[] { FieldValidation.ValidateProperty(model, memberName, instance) }); + string result = Prompt.Input(message, property.GetValue(model), null, new[] { FieldValidation.ValidateProperty(model, memberName, instance) }); if (!string.IsNullOrEmpty(result)) { @@ -307,7 +304,8 @@ public static void PromptValue(string message, object model, string memberNam } else if (instanceType == typeof(long)) { - long result = Prompt.Input(message, property.GetValue(model), new[] { FieldValidation.ValidateProperty(model, memberName, instance) }); + long result = Prompt.Input(message, property.GetValue(model), null, new[] { FieldValidation.ValidateProperty(model, memberName, instance) }); + property.SetValue(model, result); } else if (instanceType.IsEnum) diff --git a/src/WingetCreateCLI/WingetCreateCLI.csproj b/src/WingetCreateCLI/WingetCreateCLI.csproj index 826ccf6..7883849 100644 --- a/src/WingetCreateCLI/WingetCreateCLI.csproj +++ b/src/WingetCreateCLI/WingetCreateCLI.csproj @@ -18,19 +18,19 @@ - - + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/WingetCreateCore/Models/Partials/InstallerPartials.cs b/src/WingetCreateCore/Models/Partials/InstallerPartials.cs index ccf46a7..5b30845 100644 --- a/src/WingetCreateCore/Models/Partials/InstallerPartials.cs +++ b/src/WingetCreateCore/Models/Partials/InstallerPartials.cs @@ -6,9 +6,7 @@ namespace Microsoft.WingetCreateCore.Models.Installer using System; using System.Collections.Generic; using System.Linq; - using System.Text.Json.Serialization; using Microsoft.WingetCreateCore.Models.CustomValidation; - using Newtonsoft.Json; using YamlDotNet.Serialization; /// diff --git a/src/WingetCreateCore/Models/Partials/LocalePartials.cs b/src/WingetCreateCore/Models/Partials/LocalePartials.cs index 732db29..7b6fdf1 100644 --- a/src/WingetCreateCore/Models/Partials/LocalePartials.cs +++ b/src/WingetCreateCore/Models/Partials/LocalePartials.cs @@ -4,7 +4,6 @@ namespace Microsoft.WingetCreateCore.Models.Locale { using Microsoft.WingetCreateCore.Models.DefaultLocale; - using Newtonsoft.Json; using YamlDotNet.Serialization; /// diff --git a/src/WingetCreateCore/Models/Partials/SingletonPartials.cs b/src/WingetCreateCore/Models/Partials/SingletonPartials.cs index 3ef8752..2fa063d 100644 --- a/src/WingetCreateCore/Models/Partials/SingletonPartials.cs +++ b/src/WingetCreateCore/Models/Partials/SingletonPartials.cs @@ -4,7 +4,6 @@ namespace Microsoft.WingetCreateCore.Models.Singleton { using System.Collections.Generic; - using System.ComponentModel.DataAnnotations; using Microsoft.WingetCreateCore.Models.CustomValidation; using YamlDotNet.Serialization; diff --git a/src/WingetCreateCore/WingetCreateCore.csproj b/src/WingetCreateCore/WingetCreateCore.csproj index a6ade17..bcf9cc5 100644 --- a/src/WingetCreateCore/WingetCreateCore.csproj +++ b/src/WingetCreateCore/WingetCreateCore.csproj @@ -15,27 +15,27 @@ - + - - - - + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - - + + diff --git a/src/WingetCreateTests/WingetCreateTests/E2ETests/E2ETests.cs b/src/WingetCreateTests/WingetCreateTests/E2ETests/E2ETests.cs index f75d58e..dce082c 100644 --- a/src/WingetCreateTests/WingetCreateTests/E2ETests/E2ETests.cs +++ b/src/WingetCreateTests/WingetCreateTests/E2ETests/E2ETests.cs @@ -14,6 +14,7 @@ namespace Microsoft.WingetCreateE2ETests using Microsoft.WingetCreateTests; using Microsoft.WingetCreateUnitTests; using NUnit.Framework; + using NUnit.Framework.Legacy; using Octokit; using Polly; @@ -84,7 +85,7 @@ private async Task RunSubmitAndUpdateFlow(string packageId, string manifestPath, Format = format, OpenPRInBrowser = false, }; - Assert.IsTrue(await submitCommand.Execute(), "Command should have succeeded"); + ClassicAssert.IsTrue(await submitCommand.Execute(), "Command should have succeeded"); var mergeRetryPolicy = Policy .Handle() @@ -111,12 +112,12 @@ await mergeRetryPolicy.ExecuteAsync(async () => OpenPRInBrowser = false, }; - Assert.IsTrue(await updateCommand.LoadGitHubClient(), "Failed to create GitHub client"); - Assert.IsTrue(await updateCommand.Execute(), "Command should execute successfully"); + ClassicAssert.IsTrue(await updateCommand.LoadGitHubClient(), "Failed to create GitHub client"); + ClassicAssert.IsTrue(await updateCommand.Execute(), "Command should execute successfully"); string pathToValidate = Path.Combine(Directory.GetCurrentDirectory(), Utils.GetAppManifestDirPath(packageId, PackageVersion)); (bool success, string message) = WinGetUtil.ValidateManifest(pathToValidate); - Assert.IsTrue(success, message); + ClassicAssert.IsTrue(success, message); await this.gitHub.ClosePullRequest(updateCommand.PullRequestNumber); } diff --git a/src/WingetCreateTests/WingetCreateTests/UnitTests/CacheCommandTests.cs b/src/WingetCreateTests/WingetCreateTests/UnitTests/CacheCommandTests.cs index 18ef683..405adee 100644 --- a/src/WingetCreateTests/WingetCreateTests/UnitTests/CacheCommandTests.cs +++ b/src/WingetCreateTests/WingetCreateTests/UnitTests/CacheCommandTests.cs @@ -12,6 +12,7 @@ namespace Microsoft.WingetCreateUnitTests using Microsoft.WingetCreateCore; using Microsoft.WingetCreateTests; using NUnit.Framework; + using NUnit.Framework.Legacy; /// /// Unit test class for the Settings Command. @@ -74,7 +75,7 @@ public async Task CleanCachedInstallers() CacheCommand command = new CacheCommand() { Clean = true }; await command.Execute(); var installerFiles = Directory.GetFiles(PackageParser.InstallerDownloadPath); - Assert.AreEqual(0, installerFiles.Length, "Cached installers were not deleted."); + ClassicAssert.AreEqual(0, installerFiles.Length, "Cached installers were not deleted."); } } } diff --git a/src/WingetCreateTests/WingetCreateTests/UnitTests/CharacterValidationTests.cs b/src/WingetCreateTests/WingetCreateTests/UnitTests/CharacterValidationTests.cs index dec4b2a..ba352b9 100644 --- a/src/WingetCreateTests/WingetCreateTests/UnitTests/CharacterValidationTests.cs +++ b/src/WingetCreateTests/WingetCreateTests/UnitTests/CharacterValidationTests.cs @@ -10,6 +10,7 @@ namespace Microsoft.WingetCreateUnitTests using Microsoft.WingetCreateCore.Models.Singleton; using Microsoft.WingetCreateCore.Serializers; using NUnit.Framework; + using NUnit.Framework.Legacy; /// /// Unit tests for verifying unicode text and directionality. @@ -46,7 +47,7 @@ public void VerifyTextSupport() File.WriteAllText(testManifestFilePath, serializer.ToManifestString(manifest)); SingletonManifest testManifest = Serialization.DeserializeFromPath(testManifestFilePath); - Assert.AreEqual( + ClassicAssert.AreEqual( testString, testManifest.Description, string.Format("Unicode string: {0} failed to display correctly.", testString)); @@ -85,11 +86,11 @@ public void VerifyNewLineSupport() { // we know that \r\n and \x85 characters are replaced with \n by YamlDotNet library. var writtenFixed = string.Join('\n', written.Description.Split(new string[] { "\n", "\r\n", "\x85" }, StringSplitOptions.None)); - Assert.AreEqual(writtenFixed, read.Description, $"String {read.Description} had the wrong number of newlines :(."); + ClassicAssert.AreEqual(writtenFixed, read.Description, $"String {read.Description} had the wrong number of newlines :(."); } else { - Assert.AreEqual(written.Description, read.Description, $"String {read.Description} had the wrong number of newlines :(."); + ClassicAssert.AreEqual(written.Description, read.Description, $"String {read.Description} had the wrong number of newlines :(."); } File.Delete(testManifestFilePath); diff --git a/src/WingetCreateTests/WingetCreateTests/UnitTests/CommonTests.cs b/src/WingetCreateTests/WingetCreateTests/UnitTests/CommonTests.cs index 1bb18a5..97d69c6 100644 --- a/src/WingetCreateTests/WingetCreateTests/UnitTests/CommonTests.cs +++ b/src/WingetCreateTests/WingetCreateTests/UnitTests/CommonTests.cs @@ -7,6 +7,7 @@ namespace Microsoft.WingetCreateUnitTests using System.IO; using Microsoft.WingetCreateCLI; using NUnit.Framework; + using NUnit.Framework.Legacy; /// /// Test cases for verifying common functions for the CLI. @@ -28,14 +29,14 @@ public void VerifyPathSubstitutions() string substitutedPath2 = "%LOCALAPPDATA%" + examplePath; string substitutedPath3 = "%TEMP%" + examplePath; - Assert.AreEqual(substitutedPath1, Common.GetPathForDisplay(path1, true), "The path does not contain the expected substitutions."); - Assert.AreEqual(path1, Common.GetPathForDisplay(path1, false), "The path should not contain any substitutions."); + ClassicAssert.AreEqual(substitutedPath1, Common.GetPathForDisplay(path1, true), "The path does not contain the expected substitutions."); + ClassicAssert.AreEqual(path1, Common.GetPathForDisplay(path1, false), "The path should not contain any substitutions."); - Assert.AreEqual(substitutedPath2, Common.GetPathForDisplay(path2, true), "The path does not contain the expected substitutions."); - Assert.AreEqual(path2, Common.GetPathForDisplay(path2, false), "The path should not contain any substitutions."); + ClassicAssert.AreEqual(substitutedPath2, Common.GetPathForDisplay(path2, true), "The path does not contain the expected substitutions."); + ClassicAssert.AreEqual(path2, Common.GetPathForDisplay(path2, false), "The path should not contain any substitutions."); - Assert.AreEqual(substitutedPath3, Common.GetPathForDisplay(path3, true), "The path does not contain the expected substitutions."); - Assert.AreEqual(path3, Common.GetPathForDisplay(path3, false), "The path should not contain any substitutions."); + ClassicAssert.AreEqual(substitutedPath3, Common.GetPathForDisplay(path3, true), "The path does not contain the expected substitutions."); + ClassicAssert.AreEqual(path3, Common.GetPathForDisplay(path3, false), "The path should not contain any substitutions."); } } } diff --git a/src/WingetCreateTests/WingetCreateTests/UnitTests/FieldValidationTests.cs b/src/WingetCreateTests/WingetCreateTests/UnitTests/FieldValidationTests.cs index 8fc2c88..da9aa7d 100644 --- a/src/WingetCreateTests/WingetCreateTests/UnitTests/FieldValidationTests.cs +++ b/src/WingetCreateTests/WingetCreateTests/UnitTests/FieldValidationTests.cs @@ -8,7 +8,7 @@ namespace Microsoft.WingetCreateUnitTests using Microsoft.WingetCreateCLI; using Microsoft.WingetCreateCore.Models.Singleton; using NUnit.Framework; - using Sharprompt; + using NUnit.Framework.Legacy; /// /// Unit tests for verifying that validation takes place for the field inputs. @@ -72,7 +72,7 @@ public void ValidatePackageIdentifier() var invalidInputResponse = TryValidator("MicrosoftPowerToys", property); Assert.That(invalidInputResponse.Result, Is.False, InvalidInputPassedValidationString); - Assert.AreEqual(InputDoesNotMatchRegularExpressionString, invalidInputResponse.Message, FailedToDisplayErrorMessageString); + ClassicAssert.AreEqual(InputDoesNotMatchRegularExpressionString, invalidInputResponse.Message, FailedToDisplayErrorMessageString); } /// @@ -87,7 +87,7 @@ public void ValidateVersion() var invalidInputResponse = TryValidator("/\\*:?", property); Assert.That(invalidInputResponse.Result, Is.False, InvalidInputPassedValidationString); - Assert.AreEqual(InputDoesNotMatchRegularExpressionString, invalidInputResponse.Message, FailedToDisplayErrorMessageString); + ClassicAssert.AreEqual(InputDoesNotMatchRegularExpressionString, invalidInputResponse.Message, FailedToDisplayErrorMessageString); } /// diff --git a/src/WingetCreateTests/WingetCreateTests/UnitTests/GitHubTests.cs b/src/WingetCreateTests/WingetCreateTests/UnitTests/GitHubTests.cs index 83addab..2fd99be 100644 --- a/src/WingetCreateTests/WingetCreateTests/UnitTests/GitHubTests.cs +++ b/src/WingetCreateTests/WingetCreateTests/UnitTests/GitHubTests.cs @@ -14,6 +14,7 @@ namespace Microsoft.WingetCreateUnitTests using Microsoft.WingetCreateCore.Serializers; using Microsoft.WingetCreateTests; using NUnit.Framework; + using NUnit.Framework.Legacy; using Octokit; /// diff --git a/src/WingetCreateTests/WingetCreateTests/UnitTests/LocaleCommandsTests.cs b/src/WingetCreateTests/WingetCreateTests/UnitTests/LocaleCommandsTests.cs index 5f46d6e..65049b0 100644 --- a/src/WingetCreateTests/WingetCreateTests/UnitTests/LocaleCommandsTests.cs +++ b/src/WingetCreateTests/WingetCreateTests/UnitTests/LocaleCommandsTests.cs @@ -11,6 +11,7 @@ namespace Microsoft.WingetCreateUnitTests using Microsoft.WingetCreateCore.Models.Locale; using Microsoft.WingetCreateTests; using NUnit.Framework; + using NUnit.Framework.Legacy; /// /// Test cases for commands that deal with creating/updating locales. @@ -27,20 +28,20 @@ public void VerifyLocaleValidations() Manifests manifests = Serialization.DeserializeManifestContents(initialManifestContent); // Verify with different casing. - Assert.AreEqual(LocaleHelper.GetMatchingLocaleManifest("en-us", manifests), manifests.DefaultLocaleManifest, "The locale manifest for en-US should be returned."); - Assert.IsTrue(LocaleHelper.DoesLocaleManifestExist("en-us", manifests), "Locale for en-US already exists in the manifest."); - Assert.AreEqual(LocaleHelper.GetMatchingLocaleManifest("en-USA", manifests), manifests.DefaultLocaleManifest, "The locale manifest for en-US should be returned."); - Assert.IsTrue(LocaleHelper.DoesLocaleManifestExist("en-USA", manifests), "Locale for en-US already exists in the manifest."); - Assert.AreEqual(LocaleHelper.GetMatchingLocaleManifest("en-GB", manifests), manifests.LocaleManifests[0], "The locale manifest for en-GB should be returned."); - Assert.IsTrue(LocaleHelper.DoesLocaleManifestExist("en-GB", manifests), "Locale for en-GB already exists in the manifest."); - Assert.AreEqual(LocaleHelper.GetMatchingLocaleManifest("en-gb", manifests), manifests.LocaleManifests[0], "Locale for en-GB already exists in the manifest."); - Assert.IsTrue(LocaleHelper.DoesLocaleManifestExist("en-gb", manifests), "Locale for en-GB already exists in the manifest."); + ClassicAssert.AreEqual(LocaleHelper.GetMatchingLocaleManifest("en-us", manifests), manifests.DefaultLocaleManifest, "The locale manifest for en-US should be returned."); + ClassicAssert.IsTrue(LocaleHelper.DoesLocaleManifestExist("en-us", manifests), "Locale for en-US already exists in the manifest."); + ClassicAssert.AreEqual(LocaleHelper.GetMatchingLocaleManifest("en-USA", manifests), manifests.DefaultLocaleManifest, "The locale manifest for en-US should be returned."); + ClassicAssert.IsTrue(LocaleHelper.DoesLocaleManifestExist("en-USA", manifests), "Locale for en-US already exists in the manifest."); + ClassicAssert.AreEqual(LocaleHelper.GetMatchingLocaleManifest("en-GB", manifests), manifests.LocaleManifests[0], "The locale manifest for en-GB should be returned."); + ClassicAssert.IsTrue(LocaleHelper.DoesLocaleManifestExist("en-GB", manifests), "Locale for en-GB already exists in the manifest."); + ClassicAssert.AreEqual(LocaleHelper.GetMatchingLocaleManifest("en-gb", manifests), manifests.LocaleManifests[0], "Locale for en-GB already exists in the manifest."); + ClassicAssert.IsTrue(LocaleHelper.DoesLocaleManifestExist("en-gb", manifests), "Locale for en-GB already exists in the manifest."); // Check for non-existent locales. - Assert.AreEqual(LocaleHelper.GetMatchingLocaleManifest("fr-FR", manifests), null, "Null should be returned as the locale manifest for fr-FR does not exist."); - Assert.IsFalse(LocaleHelper.DoesLocaleManifestExist("fr-FR", manifests), "Locale for fr-FR does not exist in the manifest."); - Assert.AreEqual(LocaleHelper.GetMatchingLocaleManifest("de-DE", manifests), null, "Null should be returned as the locale manifest for de-DE does not exist."); - Assert.IsFalse(LocaleHelper.DoesLocaleManifestExist("de-DE", manifests), "Locale for de-DE does not exist in the manifest."); + ClassicAssert.AreEqual(LocaleHelper.GetMatchingLocaleManifest("fr-FR", manifests), null, "Null should be returned as the locale manifest for fr-FR does not exist."); + ClassicAssert.IsFalse(LocaleHelper.DoesLocaleManifestExist("fr-FR", manifests), "Locale for fr-FR does not exist in the manifest."); + ClassicAssert.AreEqual(LocaleHelper.GetMatchingLocaleManifest("de-DE", manifests), null, "Null should be returned as the locale manifest for de-DE does not exist."); + ClassicAssert.IsFalse(LocaleHelper.DoesLocaleManifestExist("de-DE", manifests), "Locale for de-DE does not exist in the manifest."); // Check for invalid locale formats. Assert.Throws(() => LocaleHelper.GetMatchingLocaleManifest("en", manifests), "Locale is not in the correct format."); @@ -61,46 +62,46 @@ public void VerifyDefaultLocaleToLocaleManifestTypeConversion() DefaultLocaleManifest defaultLocale = manifest.DefaultLocaleManifest; LocaleManifest localeManifest = defaultLocale.ToLocaleManifest(); - Assert.IsTrue(localeManifest.ManifestType == "locale", "The manifest type should be locale."); + ClassicAssert.IsTrue(localeManifest.ManifestType == "locale", "The manifest type should be locale."); - Assert.AreEqual(defaultLocale.PackageIdentifier, localeManifest.PackageIdentifier, "The package identifier should be the same."); - Assert.AreEqual(defaultLocale.PackageVersion, localeManifest.PackageVersion, "The package version should be the same."); - Assert.AreEqual(defaultLocale.PackageLocale, localeManifest.PackageLocale, "The package locale should be the same."); - Assert.AreEqual(defaultLocale.Publisher, localeManifest.Publisher, "The publisher should be the same."); - Assert.AreEqual(defaultLocale.PublisherUrl, localeManifest.PublisherUrl, "The publisher URL should be the same."); - Assert.AreEqual(defaultLocale.PublisherSupportUrl, localeManifest.PublisherSupportUrl, "The publisher support URL should be the same."); - Assert.AreEqual(defaultLocale.PrivacyUrl, localeManifest.PrivacyUrl, "The privacy URL should be the same."); - Assert.AreEqual(defaultLocale.Author, localeManifest.Author, "The author should be the same."); - Assert.AreEqual(defaultLocale.PackageName, localeManifest.PackageName, "The package name should be the same."); - Assert.AreEqual(defaultLocale.PackageUrl, localeManifest.PackageUrl, "The package URL should be the same."); - Assert.AreEqual(defaultLocale.License, localeManifest.License, "The license should be the same."); - Assert.AreEqual(defaultLocale.LicenseUrl, localeManifest.LicenseUrl, "The license URL should be the same."); - Assert.AreEqual(defaultLocale.Copyright, localeManifest.Copyright, "The copyright should be the same."); - Assert.AreEqual(defaultLocale.CopyrightUrl, localeManifest.CopyrightUrl, "The copyright URL should be the same."); - Assert.AreEqual(defaultLocale.ShortDescription, localeManifest.ShortDescription, "The short description should be the same."); - Assert.AreEqual(defaultLocale.Description, localeManifest.Description, "The description should be the same."); - Assert.AreEqual(defaultLocale.Tags, localeManifest.Tags, "The tags should be the same."); - Assert.AreEqual(defaultLocale.Icons[0].IconUrl, localeManifest.Icons[0].IconUrl, "First icon URL should be the same."); - Assert.AreEqual(defaultLocale.Icons[0].IconResolution, localeManifest.Icons[0].IconResolution, "First icon resolution should be the same."); - Assert.AreEqual(defaultLocale.Icons[0].IconSha256, localeManifest.Icons[0].IconSha256, "First icon SHA256 should be the same."); - Assert.AreEqual(defaultLocale.Icons[0].IconFileType.ToString(), localeManifest.Icons[0].IconFileType.ToString(), "First icon file type should be the same."); - Assert.AreEqual(defaultLocale.Icons[0].IconTheme, localeManifest.Icons[0].IconTheme, "First icon theme should be the same."); - Assert.AreEqual(defaultLocale.Icons[1].IconUrl, localeManifest.Icons[1].IconUrl, "Second icon URL should be the same."); - Assert.AreEqual(defaultLocale.Icons[1].IconResolution, localeManifest.Icons[1].IconResolution, "Second icon resolution should be the same."); - Assert.AreEqual(defaultLocale.Icons[1].IconSha256, localeManifest.Icons[1].IconSha256, "Second icon SHA256 should be the same."); - Assert.AreEqual(defaultLocale.Icons[1].IconFileType.ToString(), localeManifest.Icons[1].IconFileType.ToString(), "Second icon file type should be the same."); - Assert.AreEqual(defaultLocale.Icons[1].IconTheme, localeManifest.Icons[1].IconTheme, "Second icon theme should be the same."); - Assert.AreEqual(defaultLocale.ReleaseNotes, localeManifest.ReleaseNotes, "The release notes should be the same."); - Assert.AreEqual(defaultLocale.ReleaseNotesUrl, localeManifest.ReleaseNotesUrl, "The release notes URL should be the same."); - Assert.AreEqual(defaultLocale.InstallationNotes, localeManifest.InstallationNotes, "The installation notes should be the same."); - Assert.AreEqual(defaultLocale.Documentations[0].DocumentUrl, localeManifest.Documentations[0].DocumentUrl, "First document url should be the same."); - Assert.AreEqual(defaultLocale.Documentations[0].DocumentLabel, localeManifest.Documentations[0].DocumentLabel, "First document label should be the same."); - Assert.AreEqual(defaultLocale.Documentations[1].DocumentUrl, localeManifest.Documentations[1].DocumentUrl, "Second document url should be the same."); - Assert.AreEqual(defaultLocale.Documentations[1].DocumentLabel, localeManifest.Documentations[1].DocumentLabel, "Second document url should be the same."); - Assert.AreEqual(defaultLocale.ManifestVersion, localeManifest.ManifestVersion, "The manifest version should be the same."); + ClassicAssert.AreEqual(defaultLocale.PackageIdentifier, localeManifest.PackageIdentifier, "The package identifier should be the same."); + ClassicAssert.AreEqual(defaultLocale.PackageVersion, localeManifest.PackageVersion, "The package version should be the same."); + ClassicAssert.AreEqual(defaultLocale.PackageLocale, localeManifest.PackageLocale, "The package locale should be the same."); + ClassicAssert.AreEqual(defaultLocale.Publisher, localeManifest.Publisher, "The publisher should be the same."); + ClassicAssert.AreEqual(defaultLocale.PublisherUrl, localeManifest.PublisherUrl, "The publisher URL should be the same."); + ClassicAssert.AreEqual(defaultLocale.PublisherSupportUrl, localeManifest.PublisherSupportUrl, "The publisher support URL should be the same."); + ClassicAssert.AreEqual(defaultLocale.PrivacyUrl, localeManifest.PrivacyUrl, "The privacy URL should be the same."); + ClassicAssert.AreEqual(defaultLocale.Author, localeManifest.Author, "The author should be the same."); + ClassicAssert.AreEqual(defaultLocale.PackageName, localeManifest.PackageName, "The package name should be the same."); + ClassicAssert.AreEqual(defaultLocale.PackageUrl, localeManifest.PackageUrl, "The package URL should be the same."); + ClassicAssert.AreEqual(defaultLocale.License, localeManifest.License, "The license should be the same."); + ClassicAssert.AreEqual(defaultLocale.LicenseUrl, localeManifest.LicenseUrl, "The license URL should be the same."); + ClassicAssert.AreEqual(defaultLocale.Copyright, localeManifest.Copyright, "The copyright should be the same."); + ClassicAssert.AreEqual(defaultLocale.CopyrightUrl, localeManifest.CopyrightUrl, "The copyright URL should be the same."); + ClassicAssert.AreEqual(defaultLocale.ShortDescription, localeManifest.ShortDescription, "The short description should be the same."); + ClassicAssert.AreEqual(defaultLocale.Description, localeManifest.Description, "The description should be the same."); + ClassicAssert.AreEqual(defaultLocale.Tags, localeManifest.Tags, "The tags should be the same."); + ClassicAssert.AreEqual(defaultLocale.Icons[0].IconUrl, localeManifest.Icons[0].IconUrl, "First icon URL should be the same."); + ClassicAssert.AreEqual(defaultLocale.Icons[0].IconResolution, localeManifest.Icons[0].IconResolution, "First icon resolution should be the same."); + ClassicAssert.AreEqual(defaultLocale.Icons[0].IconSha256, localeManifest.Icons[0].IconSha256, "First icon SHA256 should be the same."); + ClassicAssert.AreEqual(defaultLocale.Icons[0].IconFileType.ToString(), localeManifest.Icons[0].IconFileType.ToString(), "First icon file type should be the same."); + ClassicAssert.AreEqual(defaultLocale.Icons[0].IconTheme, localeManifest.Icons[0].IconTheme, "First icon theme should be the same."); + ClassicAssert.AreEqual(defaultLocale.Icons[1].IconUrl, localeManifest.Icons[1].IconUrl, "Second icon URL should be the same."); + ClassicAssert.AreEqual(defaultLocale.Icons[1].IconResolution, localeManifest.Icons[1].IconResolution, "Second icon resolution should be the same."); + ClassicAssert.AreEqual(defaultLocale.Icons[1].IconSha256, localeManifest.Icons[1].IconSha256, "Second icon SHA256 should be the same."); + ClassicAssert.AreEqual(defaultLocale.Icons[1].IconFileType.ToString(), localeManifest.Icons[1].IconFileType.ToString(), "Second icon file type should be the same."); + ClassicAssert.AreEqual(defaultLocale.Icons[1].IconTheme, localeManifest.Icons[1].IconTheme, "Second icon theme should be the same."); + ClassicAssert.AreEqual(defaultLocale.ReleaseNotes, localeManifest.ReleaseNotes, "The release notes should be the same."); + ClassicAssert.AreEqual(defaultLocale.ReleaseNotesUrl, localeManifest.ReleaseNotesUrl, "The release notes URL should be the same."); + ClassicAssert.AreEqual(defaultLocale.InstallationNotes, localeManifest.InstallationNotes, "The installation notes should be the same."); + ClassicAssert.AreEqual(defaultLocale.Documentations[0].DocumentUrl, localeManifest.Documentations[0].DocumentUrl, "First document url should be the same."); + ClassicAssert.AreEqual(defaultLocale.Documentations[0].DocumentLabel, localeManifest.Documentations[0].DocumentLabel, "First document label should be the same."); + ClassicAssert.AreEqual(defaultLocale.Documentations[1].DocumentUrl, localeManifest.Documentations[1].DocumentUrl, "Second document url should be the same."); + ClassicAssert.AreEqual(defaultLocale.Documentations[1].DocumentLabel, localeManifest.Documentations[1].DocumentLabel, "Second document url should be the same."); + ClassicAssert.AreEqual(defaultLocale.ManifestVersion, localeManifest.ManifestVersion, "The manifest version should be the same."); // Skipped due to bad conversion model from schema. - // Assert.AreEqual(defaultLocale.Agreements, localeManifest.Agreements, "The agreements should be the same."); + // ClassicAssert.AreEqual(defaultLocale.Agreements, localeManifest.Agreements, "The agreements should be the same."); } } } diff --git a/src/WingetCreateTests/WingetCreateTests/UnitTests/NewCommandTests.cs b/src/WingetCreateTests/WingetCreateTests/UnitTests/NewCommandTests.cs index 8e552be..0fa9c10 100644 --- a/src/WingetCreateTests/WingetCreateTests/UnitTests/NewCommandTests.cs +++ b/src/WingetCreateTests/WingetCreateTests/UnitTests/NewCommandTests.cs @@ -10,6 +10,7 @@ namespace Microsoft.WingetCreateUnitTests using Microsoft.WingetCreateCLI.Logging; using Microsoft.WingetCreateCLI.Properties; using NUnit.Framework; + using NUnit.Framework.Legacy; /// /// Test cases for verifying that the "new" command is working as expected. @@ -28,7 +29,7 @@ public async Task InvalidUrl() Logger.Initialize(); NewCommand command = new NewCommand { InstallerUrls = new[] { "invalidUrl" } }; - Assert.IsFalse(await command.Execute(), "Command should have failed"); + ClassicAssert.IsFalse(await command.Execute(), "Command should have failed"); string actual = sw.ToString(); Assert.That(actual, Does.Contain(Resources.DownloadFile_Error), "Failed to catch invalid URL"); } diff --git a/src/WingetCreateTests/WingetCreateTests/UnitTests/OAuthTests.cs b/src/WingetCreateTests/WingetCreateTests/UnitTests/OAuthTests.cs index 9c741ff..7b69c23 100644 --- a/src/WingetCreateTests/WingetCreateTests/UnitTests/OAuthTests.cs +++ b/src/WingetCreateTests/WingetCreateTests/UnitTests/OAuthTests.cs @@ -25,7 +25,7 @@ public class OAuthTests public void GetTokenAsyncMockTest() { Mock mockClient = new Mock(); - mockClient.Setup(x => x.ExecutePostAsync(It.IsAny(), default)) + mockClient.Setup(x => x.ExecuteAsync(It.IsAny(), default)) .ReturnsAsync(GenerateTokenResponse()); var response = GitHubOAuth.GetTokenAsync(mockClient.Object, new GitHubOAuth.DeviceAuthorizationResponse()).Result; @@ -33,7 +33,7 @@ public void GetTokenAsyncMockTest() Assert.That(response.AccessToken, Is.Not.Null.And.Not.Empty, FailedToObtainAccessTokenString); } - private static IRestResponse GenerateTokenResponse() + private static RestResponse GenerateTokenResponse() { GitHubOAuth.TokenResponse tokenResponse = new GitHubOAuth.TokenResponse(); tokenResponse.AccessToken = "A_FAKE_TOKEN"; @@ -42,7 +42,7 @@ private static IRestResponse GenerateTokenResponse() return SerializeToRestResponse(tokenResponse); } - private static IRestResponse SerializeToRestResponse(object model) + private static RestResponse SerializeToRestResponse(object model) { var responseContent = JsonSerializer.Serialize(model); RestResponse restResponse = new RestResponse(); diff --git a/src/WingetCreateTests/WingetCreateTests/UnitTests/PackageParserTests.cs b/src/WingetCreateTests/WingetCreateTests/UnitTests/PackageParserTests.cs index 69e4115..7483b47 100644 --- a/src/WingetCreateTests/WingetCreateTests/UnitTests/PackageParserTests.cs +++ b/src/WingetCreateTests/WingetCreateTests/UnitTests/PackageParserTests.cs @@ -13,6 +13,7 @@ namespace Microsoft.WingetCreateUnitTests using Microsoft.WingetCreateCore.Models.Installer; using Microsoft.WingetCreateTests; using NUnit.Framework; + using NUnit.Framework.Legacy; /// /// Unit tests to verify downloading installers and parsing the package file. @@ -55,11 +56,11 @@ public void ParseExeInstallerFile() }; Assert.DoesNotThrow(() => PackageParser.ParsePackages(installerMetadataList, manifests)); - Assert.AreEqual("WingetCreateTestExeInstaller", manifests.DefaultLocaleManifest.PackageName); - Assert.AreEqual("Microsoft Corporation", manifests.DefaultLocaleManifest.Publisher); - Assert.AreEqual("MicrosoftCorporation.WingetCreateTestExeInstaller", manifests.VersionManifest.PackageIdentifier); - Assert.AreEqual("Microsoft Copyright", manifests.DefaultLocaleManifest.Copyright); - Assert.AreEqual(InstallerType.Exe, manifests.InstallerManifest.Installers.First().InstallerType); + ClassicAssert.AreEqual("WingetCreateTestExeInstaller", manifests.DefaultLocaleManifest.PackageName); + ClassicAssert.AreEqual("Microsoft Corporation", manifests.DefaultLocaleManifest.Publisher); + ClassicAssert.AreEqual("MicrosoftCorporation.WingetCreateTestExeInstaller", manifests.VersionManifest.PackageIdentifier); + ClassicAssert.AreEqual("Microsoft Copyright", manifests.DefaultLocaleManifest.Copyright); + ClassicAssert.AreEqual(InstallerType.Exe, manifests.InstallerManifest.Installers.First().InstallerType); } /// @@ -77,11 +78,11 @@ public void ParseMsiInstallerFile() }; Assert.DoesNotThrow(() => PackageParser.ParsePackages(installerMetadataList, manifests)); - Assert.AreEqual("WingetCreateTestMsiInstaller", manifests.DefaultLocaleManifest.PackageName); - Assert.AreEqual("Microsoft Corporation", manifests.DefaultLocaleManifest.Publisher); - Assert.AreEqual("MicrosoftCorporation.WingetCreateTestMsiInstaller", manifests.VersionManifest.PackageIdentifier); - Assert.AreEqual(InstallerType.Msi, manifests.InstallerManifest.Installers.First().InstallerType); - Assert.AreEqual("{E2650EFC-DCD3-4FAA-BBAC-FD1812B03A61}", manifests.InstallerManifest.Installers.First().ProductCode); + ClassicAssert.AreEqual("WingetCreateTestMsiInstaller", manifests.DefaultLocaleManifest.PackageName); + ClassicAssert.AreEqual("Microsoft Corporation", manifests.DefaultLocaleManifest.Publisher); + ClassicAssert.AreEqual("MicrosoftCorporation.WingetCreateTestMsiInstaller", manifests.VersionManifest.PackageIdentifier); + ClassicAssert.AreEqual(InstallerType.Msi, manifests.InstallerManifest.Installers.First().InstallerType); + ClassicAssert.AreEqual("{E2650EFC-DCD3-4FAA-BBAC-FD1812B03A61}", manifests.InstallerManifest.Installers.First().ProductCode); } /// @@ -99,12 +100,11 @@ public void ParseMsixInstallerFile() }; Assert.DoesNotThrow(() => PackageParser.ParsePackages(installerMetadataList, manifests)); - Assert.AreEqual("WingetCreateTestMsixInstaller", manifests.DefaultLocaleManifest.PackageName); - Assert.AreEqual("Microsoft Corporation", manifests.DefaultLocaleManifest.Publisher); - Assert.AreEqual("1.0.1.0", manifests.VersionManifest.PackageVersion); - Assert.AreEqual("MicrosoftCorporation.WingetCreateTestMsixInstaller", manifests.VersionManifest.PackageIdentifier); - Assert.AreEqual(InstallerType.Msix, manifests.InstallerManifest.Installers.First().InstallerType); - Assert.AreEqual(2, manifests.InstallerManifest.Installers.Count); + ClassicAssert.AreEqual("WingetCreateTestMsixInstaller", manifests.DefaultLocaleManifest.PackageName); + ClassicAssert.AreEqual("Microsoft Corporation", manifests.DefaultLocaleManifest.Publisher); + ClassicAssert.AreEqual("MicrosoftCorporation.WingetCreateTestMsixInstaller", manifests.VersionManifest.PackageIdentifier); + ClassicAssert.AreEqual(InstallerType.Msix, manifests.InstallerManifest.Installers.First().InstallerType); + ClassicAssert.AreEqual(2, manifests.InstallerManifest.Installers.Count); } /// @@ -131,16 +131,16 @@ public void ParseMultipleInstallers() Assert.DoesNotThrow(() => PackageParser.ParsePackages(installerMetadataList, manifests)); // Shared properties will be parsed from all installers, with priority given to the first-parsed value. - Assert.AreEqual("WingetCreateTestExeInstaller", manifests.DefaultLocaleManifest.PackageName); - Assert.AreEqual("Microsoft Corporation", manifests.DefaultLocaleManifest.Publisher); - Assert.AreEqual("1.2.3.4", manifests.VersionManifest.PackageVersion); - Assert.AreEqual("MicrosoftCorporation.WingetCreateTestExeInstaller", manifests.VersionManifest.PackageIdentifier); - - Assert.AreEqual(4, manifests.InstallerManifest.Installers.Count); - Assert.AreEqual(InstallerType.Exe, manifests.InstallerManifest.Installers.First().InstallerType); - Assert.AreEqual(InstallerType.Msi, manifests.InstallerManifest.Installers.Skip(1).First().InstallerType); - Assert.AreEqual(InstallerType.Msix, manifests.InstallerManifest.Installers.Skip(2).First().InstallerType); - Assert.AreEqual(InstallerType.Msix, manifests.InstallerManifest.Installers.Skip(3).First().InstallerType); + ClassicAssert.AreEqual("WingetCreateTestExeInstaller", manifests.DefaultLocaleManifest.PackageName); + ClassicAssert.AreEqual("Microsoft Corporation", manifests.DefaultLocaleManifest.Publisher); + ClassicAssert.AreEqual("1.2.3.4", manifests.VersionManifest.PackageVersion); + ClassicAssert.AreEqual("MicrosoftCorporation.WingetCreateTestExeInstaller", manifests.VersionManifest.PackageIdentifier); + + ClassicAssert.AreEqual(4, manifests.InstallerManifest.Installers.Count); + ClassicAssert.AreEqual(InstallerType.Exe, manifests.InstallerManifest.Installers.First().InstallerType); + ClassicAssert.AreEqual(InstallerType.Msi, manifests.InstallerManifest.Installers.Skip(1).First().InstallerType); + ClassicAssert.AreEqual(InstallerType.Msix, manifests.InstallerManifest.Installers.Skip(2).First().InstallerType); + ClassicAssert.AreEqual(InstallerType.Msix, manifests.InstallerManifest.Installers.Skip(3).First().InstallerType); } /// @@ -158,10 +158,10 @@ public void ParseAndUpdateInstaller() Installer installer = ConvertSingletonInstaller(initialInstaller); PackageParser.ParsePackageAndUpdateInstallerNode(installer, testMsiInstallerPath, installer.InstallerUrl); - Assert.AreEqual(InstallerType.Msi, installer.InstallerType, "InstallerType should be updated."); - Assert.AreEqual(initialInstaller.Architecture.ToEnumAttributeValue(), installer.Architecture.ToEnumAttributeValue(), "Architecture should not change."); - Assert.AreNotEqual(initialInstaller.InstallerSha256, installer.InstallerSha256, "InstallerSha256 should be updated."); - Assert.AreEqual("{E2650EFC-DCD3-4FAA-BBAC-FD1812B03A61}", installer.ProductCode, "ProductCode should be updated"); + ClassicAssert.AreEqual(InstallerType.Msi, installer.InstallerType, "InstallerType should be updated."); + ClassicAssert.AreEqual(initialInstaller.Architecture.ToEnumAttributeValue(), installer.Architecture.ToEnumAttributeValue(), "Architecture should not change."); + ClassicAssert.AreNotEqual(initialInstaller.InstallerSha256, installer.InstallerSha256, "InstallerSha256 should be updated."); + ClassicAssert.AreEqual("{E2650EFC-DCD3-4FAA-BBAC-FD1812B03A61}", installer.ProductCode, "ProductCode should be updated"); } /// diff --git a/src/WingetCreateTests/WingetCreateTests/UnitTests/SettingsCommandTests.cs b/src/WingetCreateTests/WingetCreateTests/UnitTests/SettingsCommandTests.cs index 422d96f..174ddbc 100644 --- a/src/WingetCreateTests/WingetCreateTests/UnitTests/SettingsCommandTests.cs +++ b/src/WingetCreateTests/WingetCreateTests/UnitTests/SettingsCommandTests.cs @@ -13,6 +13,7 @@ namespace Microsoft.WingetCreateUnitTests using Microsoft.WingetCreateCLI.Models.Settings; using Microsoft.WingetCreateCLI.Properties; using NUnit.Framework; + using NUnit.Framework.Legacy; /// /// Unit test class for the Settings Command. @@ -56,8 +57,8 @@ public void VerifySettingsFileGenerated() { SettingsCommand command = new SettingsCommand(); command.Execute(); - Assert.IsTrue(File.Exists(UserSettings.SettingsJsonPath), "Settings file was not created successfully."); - Assert.IsTrue(UserSettings.ParseJsonFile(UserSettings.SettingsJsonPath, out SettingsManifest manifest).IsValid, "Generated settings file was not valid."); + ClassicAssert.IsTrue(File.Exists(UserSettings.SettingsJsonPath), "Settings file was not created successfully."); + ClassicAssert.IsTrue(UserSettings.ParseJsonFile(UserSettings.SettingsJsonPath, out SettingsManifest manifest).IsValid, "Generated settings file was not valid."); } /// @@ -70,8 +71,8 @@ public void VerifyBackupSettingsFileGenerated() firstCommand.Execute(); SettingsCommand secondCommand = new SettingsCommand(); secondCommand.Execute(); - Assert.IsTrue(File.Exists(UserSettings.SettingsBackupJsonPath), "Backup settings file was not created successfully."); - Assert.IsTrue(UserSettings.ParseJsonFile(UserSettings.SettingsBackupJsonPath, out SettingsManifest manifest).IsValid, "Generated backup settings file was not valid."); + ClassicAssert.IsTrue(File.Exists(UserSettings.SettingsBackupJsonPath), "Backup settings file was not created successfully."); + ClassicAssert.IsTrue(UserSettings.ParseJsonFile(UserSettings.SettingsBackupJsonPath, out SettingsManifest manifest).IsValid, "Generated backup settings file was not valid."); } /// @@ -84,7 +85,7 @@ public void VerifyEmptySettingsFile() command.Execute(); File.WriteAllText(UserSettings.SettingsJsonPath, string.Empty); (bool isValid, List errors) = UserSettings.ParseJsonFile(UserSettings.SettingsJsonPath, out SettingsManifest manifest); - Assert.IsFalse(isValid, "Empty settings manifest should fail validation"); + ClassicAssert.IsFalse(isValid, "Empty settings manifest should fail validation"); StringAssert.Contains("Manifest cannot be empty", errors.First(), "Error message should be caught."); } @@ -109,13 +110,12 @@ public void VerifySavingSettings() UserSettings.WindowsPackageManagerRepositoryName = testRepoName; UserSettings.ManifestFormat = manifestFormat; UserSettings.ParseJsonFile(UserSettings.SettingsJsonPath, out SettingsManifest manifest); - Assert.IsTrue(manifest.Telemetry.Disable == !isTelemetryDisabled, "Changed Telemetry setting was not reflected in the settings file."); - Assert.IsTrue(manifest.CleanUp.Disable == !isCleanUpDisabled, "Changed CleanUp.Disable setting was not reflected in the settings file."); - Assert.IsTrue(manifest.Visual.AnonymizePaths == !arePathsAnonymized, "Changed Visual.AnonymizePaths setting was not reflected in the settings file."); - Assert.IsTrue(manifest.CleanUp.IntervalInDays == cleanUpDays, "Changed CleanUp.IntervalInDays setting was not reflected in the settings file."); - Assert.IsTrue(manifest.WindowsPackageManagerRepository.Owner == testRepoOwner, "Changed WindowsPackageManagerRepository.Owner setting was not reflected in the settings file."); - Assert.IsTrue(manifest.WindowsPackageManagerRepository.Name == testRepoName, "Changed WindowsPackageManagerRepository.Name setting was not reflected in the settings file."); - Assert.IsTrue(manifest.Manifest.Format == manifestFormat, "Changed Manifest.Format setting was not reflected in the settings file."); + ClassicAssert.IsTrue(manifest.Telemetry.Disable == !isTelemetryDisabled, "Changed Telemetry setting was not reflected in the settings file."); + ClassicAssert.IsTrue(manifest.CleanUp.Disable == !isCleanUpDisabled, "Changed CleanUp.Disable setting was not reflected in the settings file."); + ClassicAssert.IsTrue(manifest.Visual.AnonymizePaths == !arePathsAnonymized, "Changed Visual.AnonymizePaths setting was not reflected in the settings file."); + ClassicAssert.IsTrue(manifest.CleanUp.IntervalInDays == cleanUpDays, "Changed CleanUp.IntervalInDays setting was not reflected in the settings file."); + ClassicAssert.IsTrue(manifest.WindowsPackageManagerRepository.Owner == testRepoOwner, "Changed WindowsPackageManagerRepository.Owner setting was not reflected in the settings file."); + ClassicAssert.IsTrue(manifest.WindowsPackageManagerRepository.Name == testRepoName, "Changed WindowsPackageManagerRepository.Name setting was not reflected in the settings file."); } /// diff --git a/src/WingetCreateTests/WingetCreateTests/UnitTests/TokenCommandTests.cs b/src/WingetCreateTests/WingetCreateTests/UnitTests/TokenCommandTests.cs index eb3564e..5cc8a0a 100644 --- a/src/WingetCreateTests/WingetCreateTests/UnitTests/TokenCommandTests.cs +++ b/src/WingetCreateTests/WingetCreateTests/UnitTests/TokenCommandTests.cs @@ -9,6 +9,7 @@ namespace Microsoft.WingetCreateUnitTests using Microsoft.WingetCreateCLI.Commands; using Microsoft.WingetCreateCLI.Logging; using NUnit.Framework; + using NUnit.Framework.Legacy; /// /// Test cases for verifying that the "token" command is working as expected. @@ -26,16 +27,16 @@ public async Task TokenCommand() // Preemptively clear existing token var command = new TokenCommand { Clear = true }; - Assert.IsTrue(await command.Execute(), "Command should have succeeded"); + ClassicAssert.IsTrue(await command.Execute(), "Command should have succeeded"); string tokenCacheFile = Path.Combine(Common.LocalAppStatePath, "tokenCache.bin"); FileAssert.DoesNotExist(tokenCacheFile, "Token cache file shouldn't exist before running Token --store command"); command = new TokenCommand { Store = true, GitHubToken = this.GitHubApiKey }; - Assert.IsTrue(await command.Execute(), "Command should have succeeded"); + ClassicAssert.IsTrue(await command.Execute(), "Command should have succeeded"); FileAssert.Exists(tokenCacheFile, "Token cache file should exist after storing token"); command = new TokenCommand { Clear = true }; - Assert.IsTrue(await command.Execute(), "Command should have succeeded"); + ClassicAssert.IsTrue(await command.Execute(), "Command should have succeeded"); FileAssert.DoesNotExist(tokenCacheFile, "Token cache file shouldn't exist after running Token --clear command"); } } diff --git a/src/WingetCreateTests/WingetCreateTests/UnitTests/UpdateCommandTests.cs b/src/WingetCreateTests/WingetCreateTests/UnitTests/UpdateCommandTests.cs index 8e37579..3024d4e 100644 --- a/src/WingetCreateTests/WingetCreateTests/UnitTests/UpdateCommandTests.cs +++ b/src/WingetCreateTests/WingetCreateTests/UnitTests/UpdateCommandTests.cs @@ -20,6 +20,7 @@ namespace Microsoft.WingetCreateUnitTests using Microsoft.WingetCreateCore.Serializers; using Microsoft.WingetCreateTests; using NUnit.Framework; + using NUnit.Framework.Legacy; /// /// Test cases for verifying that the "update" command is working as expected. @@ -71,13 +72,13 @@ public async Task UpdateCommandGitHubManifestTest() string version = "1.2.3.4"; (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData(TestConstants.TestPackageIdentifier, version, this.tempPath, null); var updatedManifests = await command.ExecuteManifestUpdate(initialManifestContent, this.testCommandEvent); - Assert.IsTrue(updatedManifests, "Command should have succeeded"); + ClassicAssert.IsTrue(updatedManifests, "Command should have succeeded"); string manifestDir = Utils.GetAppManifestDirPath(TestConstants.TestPackageIdentifier, version); var updatedManifestContents = Directory.GetFiles(Path.Combine(this.tempPath, manifestDir)).Select(f => File.ReadAllText(f)); - Assert.IsTrue(updatedManifestContents.Any(), "Updated manifests were not created successfully"); + ClassicAssert.IsTrue(updatedManifestContents.Any(), "Updated manifests were not created successfully"); Manifests manifestsToValidate = Serialization.DeserializeManifestContents(updatedManifestContents); - Assert.AreEqual(version, manifestsToValidate.VersionManifest.PackageVersion, $"Failed to update version of {TestConstants.TestPackageIdentifier}"); + ClassicAssert.AreEqual(version, manifestsToValidate.VersionManifest.PackageVersion, $"Failed to update version of {TestConstants.TestPackageIdentifier}"); } /// @@ -94,11 +95,11 @@ public async Task UpdateAndVerifyUpdatedProperties() var initialManifests = Serialization.DeserializeManifestContents(initialManifestContent); var initialInstaller = initialManifests.SingletonManifest.Installers.First(); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); var updatedInstaller = updatedManifests.InstallerManifest.Installers.First(); - Assert.AreEqual(version, updatedManifests.VersionManifest.PackageVersion, "Version should be updated"); - Assert.AreNotEqual(initialInstaller.ProductCode, updatedManifests.InstallerManifest.ProductCode, "ProductCode should be updated"); - Assert.AreNotEqual(initialInstaller.InstallerSha256, updatedInstaller.InstallerSha256, "InstallerSha256 should be updated"); + ClassicAssert.AreEqual(version, updatedManifests.VersionManifest.PackageVersion, "Version should be updated"); + ClassicAssert.AreNotEqual(initialInstaller.ProductCode, updatedManifests.InstallerManifest.ProductCode, "ProductCode should be updated"); + ClassicAssert.AreNotEqual(initialInstaller.InstallerSha256, updatedInstaller.InstallerSha256, "InstallerSha256 should be updated"); } /// @@ -116,27 +117,27 @@ public async Task UpdateMultipleUrlManifests() var initialManifests = Serialization.DeserializeManifestContents(initialManifestContent); var initialInstaller = initialManifests.SingletonManifest.Installers.First(); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); - Assert.AreEqual(version, updatedManifests.VersionManifest.PackageVersion, "Version should be updated"); - Assert.AreEqual("en-US", updatedManifests.InstallerManifest.InstallerLocale, "InstallerLocale should be carried forward from existing installer root node"); + ClassicAssert.AreEqual(version, updatedManifests.VersionManifest.PackageVersion, "Version should be updated"); + ClassicAssert.AreEqual("en-US", updatedManifests.InstallerManifest.InstallerLocale, "InstallerLocale should be carried forward from existing installer root node"); foreach (var updatedInstaller in updatedManifests.InstallerManifest.Installers) { - Assert.AreNotEqual(initialInstaller.InstallerSha256, updatedInstaller.InstallerSha256, "InstallerSha256 should be updated"); + ClassicAssert.AreNotEqual(initialInstaller.InstallerSha256, updatedInstaller.InstallerSha256, "InstallerSha256 should be updated"); if (updatedInstaller.InstallerType == InstallerType.Msi || updatedInstaller.InstallerType == InstallerType.Msix) { if (updatedInstaller.InstallerType == InstallerType.Msi) { - Assert.AreNotEqual(initialInstaller.ProductCode, updatedInstaller.ProductCode, "ProductCode should be updated"); - Assert.AreEqual(Scope.Machine, updatedInstaller.Scope, "Scope should be carried forward from existing installer"); + ClassicAssert.AreNotEqual(initialInstaller.ProductCode, updatedInstaller.ProductCode, "ProductCode should be updated"); + ClassicAssert.AreEqual(Scope.Machine, updatedInstaller.Scope, "Scope should be carried forward from existing installer"); } else { - Assert.AreNotEqual(initialInstaller.MinimumOSVersion, updatedInstaller.MinimumOSVersion, "MinimumOSVersion should be updated"); - Assert.AreNotEqual(initialInstaller.PackageFamilyName, updatedInstaller.PackageFamilyName, "PackageFamilyName should be updated"); - Assert.AreNotEqual(initialInstaller.Platform, updatedInstaller.Platform, "Platform should be updated"); + ClassicAssert.AreNotEqual(initialInstaller.MinimumOSVersion, updatedInstaller.MinimumOSVersion, "MinimumOSVersion should be updated"); + ClassicAssert.AreNotEqual(initialInstaller.PackageFamilyName, updatedInstaller.PackageFamilyName, "PackageFamilyName should be updated"); + ClassicAssert.AreNotEqual(initialInstaller.Platform, updatedInstaller.Platform, "Platform should be updated"); } } } @@ -154,18 +155,18 @@ public async Task UpdateRemovesEmptyFields() TestUtils.InitializeMockDownloads(TestConstants.TestExeInstaller); (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData(packageId, version, this.tempPath, null); bool updateExecuted = await command.ExecuteManifestUpdate(initialManifestContent, this.testCommandEvent); - Assert.IsTrue(updateExecuted, "Command should have succeeded"); + ClassicAssert.IsTrue(updateExecuted, "Command should have succeeded"); string manifestDir = Utils.GetAppManifestDirPath(packageId, version); var updatedManifestContents = Directory.GetFiles(Path.Combine(this.tempPath, manifestDir)).Select(f => File.ReadAllText(f)); - Assert.IsTrue(updatedManifestContents.Any(), "Updated manifests were not created successfully"); + ClassicAssert.IsTrue(updatedManifestContents.Any(), "Updated manifests were not created successfully"); Manifests updatedManifests = Serialization.DeserializeManifestContents(updatedManifestContents); - Assert.IsNull(updatedManifests.DefaultLocaleManifest.PrivacyUrl, "PrivacyUrl should be null."); - Assert.IsNull(updatedManifests.DefaultLocaleManifest.Author, "Author should be null."); + ClassicAssert.IsNull(updatedManifests.DefaultLocaleManifest.PrivacyUrl, "PrivacyUrl should be null."); + ClassicAssert.IsNull(updatedManifests.DefaultLocaleManifest.Author, "Author should be null."); var firstInstaller = updatedManifests.InstallerManifest.Installers.First(); - Assert.IsNull(firstInstaller.ProductCode, "ProductCode should be null."); - Assert.IsNull(firstInstaller.PackageFamilyName, "ProductCode should be null."); + ClassicAssert.IsNull(firstInstaller.ProductCode, "ProductCode should be null."); + ClassicAssert.IsNull(firstInstaller.PackageFamilyName, "ProductCode should be null."); } /// @@ -178,7 +179,7 @@ public async Task UpdateFailsWithInstallerUrlCountDiscrepency() TestUtils.InitializeMockDownloads(TestConstants.TestMsixInstaller); (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData(TestConstants.TestMultipleInstallerPackageIdentifier, null, this.tempPath, new[] { "fakeurl" }); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNull(updatedManifests, "Command should have failed"); + ClassicAssert.IsNull(updatedManifests, "Command should have failed"); string result = this.sw.ToString(); Assert.That(result, Does.Contain(Resources.MultipleInstallerUpdateDiscrepancy_Error), "Installer discrepency error should be thrown"); } @@ -193,7 +194,7 @@ public async Task UpdateFailsWithPackageCountDiscrepency() TestUtils.InitializeMockDownloads(TestConstants.TestMsixInstaller); (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.SingleMsixInExistingBundle", null, this.tempPath, null); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNull(updatedManifests, "Command should have failed"); + ClassicAssert.IsNull(updatedManifests, "Command should have failed"); string result = this.sw.ToString(); Assert.That(result, Does.Contain(Resources.InstallerCountMustMatch_Error), "Installer count must match error should be thrown"); } @@ -207,9 +208,8 @@ public async Task UpdateFailsWithUnmatchedPackages() { TestUtils.InitializeMockDownloads(TestConstants.TestMsixInstaller); (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.MismatchedMsixInExistingBundle", null, this.tempPath, null); - var initialManifests = Serialization.DeserializeManifestContents(initialManifestContent); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNull(updatedManifests, "Command should have failed"); + ClassicAssert.IsNull(updatedManifests, "Command should have failed"); string result = this.sw.ToString(); Assert.That(result, Does.Contain(Resources.NewInstallerUrlMustMatchExisting_Message), "New installer must match error should be thrown"); } @@ -301,12 +301,12 @@ public async Task UpdateWithArchDetectedFromInstallerUrl() var initialManifests = Serialization.DeserializeManifestContents(initialManifestContent); var initialInstaller = initialManifests.SingletonManifest.Installers.First(); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); foreach (var item in expectedArchs.Zip(updatedManifests.InstallerManifest.Installers, (expectedArch, installer) => (expectedArch, installer))) { - Assert.AreEqual(item.expectedArch, item.installer.Architecture, "Architecture not parsed correctly from url string"); - Assert.AreNotEqual(initialInstaller.InstallerSha256, item.installer.InstallerSha256, "InstallerSha256 should be updated"); + ClassicAssert.AreEqual(item.expectedArch, item.installer.Architecture, "Architecture not parsed correctly from url string"); + ClassicAssert.AreNotEqual(initialInstaller.InstallerSha256, item.installer.InstallerSha256, "InstallerSha256 should be updated"); } } @@ -322,11 +322,11 @@ public async Task UpdateMsixIgnoresArchitectureFromUrl() var initialManifests = Serialization.DeserializeManifestContents(initialManifestContent); var initialInstaller = initialManifests.SingletonManifest.Installers.First(); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); foreach (var updatedInstaller in updatedManifests.InstallerManifest.Installers) { - Assert.AreNotEqual(Architecture.Arm64, updatedInstaller.Architecture, "Architecture should not be detected from string."); - Assert.AreNotEqual(initialInstaller.InstallerSha256, updatedInstaller.InstallerSha256, "InstallerSha256 should be updated"); + ClassicAssert.AreNotEqual(Architecture.Arm64, updatedInstaller.Architecture, "Architecture should not be detected from string."); + ClassicAssert.AreNotEqual(initialInstaller.InstallerSha256, updatedInstaller.InstallerSha256, "InstallerSha256 should be updated"); } } @@ -358,7 +358,7 @@ public async Task UpdateWithArchitectureOverrideFailsParsing() (UpdateCommand badCommand, var manifests) = GetUpdateCommandAndManifestData("TestPublisher.ArchitectureOverride", "1.2.3.4", this.tempPath, new[] { $"{installerUrl}|{invalidArch}" }); var failedUpdateManifests = await RunUpdateCommand(badCommand, manifests); - Assert.IsNull(failedUpdateManifests, "Command should have failed due to invalid architecture specified for override."); + ClassicAssert.IsNull(failedUpdateManifests, "Command should have failed due to invalid architecture specified for override."); string result = this.sw.ToString(); Assert.That(result, Does.Contain(string.Format(Resources.UnableToParseOverride_Error, invalidArch)), "Failed to show architecture override parsing error."); } @@ -374,7 +374,7 @@ public async Task UpdateFailsOverrideWithMultipleArchitectures() (UpdateCommand badCommand, var manifests) = GetUpdateCommandAndManifestData("TestPublisher.ArchitectureOverride", "1.2.3.4", this.tempPath, new[] { $"{installerUrl}|x86|ARM" }); var failedUpdateManifests = await RunUpdateCommand(badCommand, manifests); - Assert.IsNull(failedUpdateManifests, "Command should have failed due to multiple architecture overrides specified for a single installer."); + ClassicAssert.IsNull(failedUpdateManifests, "Command should have failed due to multiple architecture overrides specified for a single installer."); string result = this.sw.ToString(); Assert.That(result, Does.Contain(Resources.MultipleArchitectureOverride_Error), "Failed to show multiple architecture overrides error."); } @@ -390,7 +390,7 @@ public async Task UpdateFailsOverrideWithMultipleScopes() (UpdateCommand badCommand, var manifests) = GetUpdateCommandAndManifestData("TestPublisher.ScopeOverride", "1.2.3.4", this.tempPath, new[] { $"{installerUrl}|user|machine" }); var failedUpdateManifests = await RunUpdateCommand(badCommand, manifests); - Assert.IsNull(failedUpdateManifests, "Command should have failed due to multiple scope overrides specified for a single installer."); + ClassicAssert.IsNull(failedUpdateManifests, "Command should have failed due to multiple scope overrides specified for a single installer."); string result = this.sw.ToString(); Assert.That(result, Does.Contain(Resources.MultipleScopeOverride_Error), "Failed to show multiple scope overrides error."); } @@ -411,7 +411,7 @@ public async Task UpdateWithArchitectureOverrides() (UpdateCommand badCommand, var manifests) = GetUpdateCommandAndManifestData("TestPublisher.ArchitectureOverride", "1.2.3.4", this.tempPath, new[] { testInstallerUrl }); var failedUpdateManifests = await RunUpdateCommand(badCommand, manifests); - Assert.IsNull(failedUpdateManifests, "Command should have failed without architecture override as the installer is x64"); + ClassicAssert.IsNull(failedUpdateManifests, "Command should have failed without architecture override as the installer is x64"); // Test with architecture override should pass. (UpdateCommand goodCommand, var initialManifestContent) = @@ -419,11 +419,11 @@ public async Task UpdateWithArchitectureOverrides() var initialManifests = Serialization.DeserializeManifestContents(initialManifestContent); var initialInstaller = initialManifests.SingletonManifest.Installers.First(); var updatedManifests = await RunUpdateCommand(goodCommand, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded as installer should be overrided with ARM architecture."); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded as installer should be overrided with ARM architecture."); var updatedInstaller = updatedManifests.InstallerManifest.Installers.Single(); - Assert.AreEqual(expectedArch, updatedInstaller.Architecture, $"Architecture should be {expectedArch} from override."); - Assert.AreNotEqual(initialInstaller.InstallerSha256, updatedInstaller.InstallerSha256, "InstallerSha256 should be updated"); + ClassicAssert.AreEqual(expectedArch, updatedInstaller.Architecture, $"Architecture should be {expectedArch} from override."); + ClassicAssert.AreNotEqual(initialInstaller.InstallerSha256, updatedInstaller.InstallerSha256, "InstallerSha256 should be updated"); } /// @@ -441,14 +441,14 @@ public async Task UpdateWithScopeOverrides() (UpdateCommand badCommand, var manifests) = GetUpdateCommandAndManifestData("TestPublisher.ScopeOverride", "1.2.3.4", this.tempPath, new[] { testInstallerUrl, testInstallerUrl }); var failedUpdateManifests = await RunUpdateCommand(badCommand, manifests); - Assert.IsNull(failedUpdateManifests, "Command should have failed without scope override as there are multiple installers with the same architecture."); + ClassicAssert.IsNull(failedUpdateManifests, "Command should have failed without scope override as there are multiple installers with the same architecture."); // Test with scope override should pass. (UpdateCommand goodCommand, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.ScopeOverride", "1.2.3.4", this.tempPath, new[] { $"{testInstallerUrl}|user", $"{testInstallerUrl}|machine" }); var initialManifests = Serialization.DeserializeManifestContents(initialManifestContent); var updatedManifests = await RunUpdateCommand(goodCommand, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded as installers should be overrided with scope."); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded as installers should be overrided with scope."); var initialFirstInstaller = initialManifests.SingletonManifest.Installers[0]; var initialSecondInstaller = initialManifests.SingletonManifest.Installers[1]; @@ -456,11 +456,11 @@ public async Task UpdateWithScopeOverrides() var updatedFirstInstaller = updatedManifests.InstallerManifest.Installers[0]; var updatedSecondInstaller = updatedManifests.InstallerManifest.Installers[1]; - Assert.AreEqual(Scope.User, updatedFirstInstaller.Scope, $"Scope should be preserved."); - Assert.AreEqual(Scope.Machine, updatedSecondInstaller.Scope, $"Scope should be preserved."); + ClassicAssert.AreEqual(Scope.User, updatedFirstInstaller.Scope, $"Scope should be preserved."); + ClassicAssert.AreEqual(Scope.Machine, updatedSecondInstaller.Scope, $"Scope should be preserved."); - Assert.AreNotEqual(initialFirstInstaller.InstallerSha256, updatedFirstInstaller.InstallerSha256, "InstallerSha256 should be updated"); - Assert.AreNotEqual(initialSecondInstaller.InstallerSha256, updatedSecondInstaller.InstallerSha256, "InstallerSha256 should be updated"); + ClassicAssert.AreNotEqual(initialFirstInstaller.InstallerSha256, updatedFirstInstaller.InstallerSha256, "InstallerSha256 should be updated"); + ClassicAssert.AreNotEqual(initialSecondInstaller.InstallerSha256, updatedSecondInstaller.InstallerSha256, "InstallerSha256 should be updated"); } /// @@ -478,14 +478,14 @@ public async Task UpdateWithArchAndScopeOverrides() (UpdateCommand badCommand, var manifests) = GetUpdateCommandAndManifestData("TestPublisher.ArchAndScopeOverride", "1.2.3.4", this.tempPath, new[] { testInstallerUrl, testInstallerUrl }); var failedUpdateManifests = await RunUpdateCommand(badCommand, manifests); - Assert.IsNull(failedUpdateManifests, "Command should have failed without overrides"); + ClassicAssert.IsNull(failedUpdateManifests, "Command should have failed without overrides"); // Test with scope and architecture override should pass. (UpdateCommand goodCommand, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.ArchAndScopeOverride", "1.2.3.4", this.tempPath, new[] { $"{testInstallerUrl}|user|arm", $"{testInstallerUrl}|arm|machine" }); var initialManifests = Serialization.DeserializeManifestContents(initialManifestContent); var updatedManifests = await RunUpdateCommand(goodCommand, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded as installers should be overrided with architecture and scope."); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded as installers should be overrided with architecture and scope."); var initialFirstInstaller = initialManifests.SingletonManifest.Installers[0]; var initialSecondInstaller = initialManifests.SingletonManifest.Installers[1]; @@ -493,13 +493,13 @@ public async Task UpdateWithArchAndScopeOverrides() var updatedFirstInstaller = updatedManifests.InstallerManifest.Installers[0]; var updatedSecondInstaller = updatedManifests.InstallerManifest.Installers[1]; - Assert.AreEqual(Scope.User, updatedFirstInstaller.Scope, $"Scope should be preserved."); - Assert.AreEqual(Scope.Machine, updatedSecondInstaller.Scope, $"Scope should be preserved."); - Assert.AreEqual(Architecture.Arm, updatedFirstInstaller.Architecture, $"Architecture should be preserved."); - Assert.AreEqual(Architecture.Arm, updatedSecondInstaller.Architecture, $"Architecture should be preserved."); + ClassicAssert.AreEqual(Scope.User, updatedFirstInstaller.Scope, $"Scope should be preserved."); + ClassicAssert.AreEqual(Scope.Machine, updatedSecondInstaller.Scope, $"Scope should be preserved."); + ClassicAssert.AreEqual(Architecture.Arm, updatedFirstInstaller.Architecture, $"Architecture should be preserved."); + ClassicAssert.AreEqual(Architecture.Arm, updatedSecondInstaller.Architecture, $"Architecture should be preserved."); - Assert.AreNotEqual(initialFirstInstaller.InstallerSha256, updatedFirstInstaller.InstallerSha256, "InstallerSha256 should be updated"); - Assert.AreNotEqual(initialSecondInstaller.InstallerSha256, updatedSecondInstaller.InstallerSha256, "InstallerSha256 should be updated"); + ClassicAssert.AreNotEqual(initialFirstInstaller.InstallerSha256, updatedFirstInstaller.InstallerSha256, "InstallerSha256 should be updated"); + ClassicAssert.AreNotEqual(initialSecondInstaller.InstallerSha256, updatedSecondInstaller.InstallerSha256, "InstallerSha256 should be updated"); } /// @@ -516,7 +516,7 @@ public async Task UpdateSameInstallerWithDifferentArchitectures() GetUpdateCommandAndManifestData("TestPublisher.SameInstallerDiffArch", "1.2.3.4", this.tempPath, new[] { $"{installerUrl}|x64", $"{installerUrl}|x86" }); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); var initialManifests = Serialization.DeserializeManifestContents(initialManifestContent); var initialFirstInstaller = initialManifests.SingletonManifest.Installers[0]; @@ -525,11 +525,11 @@ public async Task UpdateSameInstallerWithDifferentArchitectures() var updatedFirstInstaller = updatedManifests.InstallerManifest.Installers[0]; var updatedSecondInstaller = updatedManifests.InstallerManifest.Installers[1]; - Assert.AreEqual(Architecture.X64, updatedFirstInstaller.Architecture, $"Architecture should be preserved."); - Assert.AreEqual(Architecture.X86, updatedSecondInstaller.Architecture, $"Architecture should be preserved."); + ClassicAssert.AreEqual(Architecture.X64, updatedFirstInstaller.Architecture, $"Architecture should be preserved."); + ClassicAssert.AreEqual(Architecture.X86, updatedSecondInstaller.Architecture, $"Architecture should be preserved."); - Assert.AreNotEqual(initialFirstInstaller.InstallerSha256, updatedFirstInstaller.InstallerSha256, $"InstallerSha256 should be updated."); - Assert.AreNotEqual(initialSecondInstaller.InstallerSha256, updatedSecondInstaller.InstallerSha256, $"InstallerSha256 should be updated."); + ClassicAssert.AreNotEqual(initialFirstInstaller.InstallerSha256, updatedFirstInstaller.InstallerSha256, $"InstallerSha256 should be updated."); + ClassicAssert.AreNotEqual(initialSecondInstaller.InstallerSha256, updatedSecondInstaller.InstallerSha256, $"InstallerSha256 should be updated."); } /// @@ -544,7 +544,7 @@ public async Task UpdateWithArchitectureOverrideFailsWithErrorMessage() (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.ArchitectureOverride", "1.2.3.4", this.tempPath, new[] { $"{installerUrl}|x64" }); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNull(updatedManifests, "Command should have failed"); + ClassicAssert.IsNull(updatedManifests, "Command should have failed"); string result = this.sw.ToString(); Assert.That(result, Does.Contain(Resources.ArchitectureOverride_Warning), "Failed to show warning for architecture override."); } @@ -562,7 +562,7 @@ public async Task NumberOfOverridesExceeded() (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.ArchitectureOverride", "1.2.3.4", this.tempPath, new[] { installerUrlOverride }); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNull(updatedManifests, "Command should have failed"); + ClassicAssert.IsNull(updatedManifests, "Command should have failed"); string result = this.sw.ToString(); Assert.That(result, Does.Contain(string.Format(Resources.OverrideLimitExceeded_Error, installerUrlOverride)), "Failed to show warning for override limit exceeded."); } @@ -579,8 +579,8 @@ public async Task UpdateWithUntrimmedInstallerUrl() (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.SingleExe", "1.2.3.4", this.tempPath, new[] { untrimmedInstallerUrl }); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); - Assert.AreNotEqual(untrimmedInstallerUrl, updatedManifests.InstallerManifest.Installers.First().InstallerUrl, "InstallerUrl was not trimmed prior to update."); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.AreNotEqual(untrimmedInstallerUrl, updatedManifests.InstallerManifest.Installers.First().InstallerUrl, "InstallerUrl was not trimmed prior to update."); } /// @@ -595,11 +595,11 @@ public async Task UpdatePreservesExistingValues() (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.SingleExe", "1.2.3.4", this.tempPath, new[] { $"{installerUrl}" }); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); var updatedInstallerManifest = updatedManifests.InstallerManifest; - Assert.AreEqual("FakeProductCode", updatedInstallerManifest.ProductCode, "Existing value for ProductCode was overwritten."); - Assert.AreEqual("FakePackageFamilyName", updatedInstallerManifest.PackageFamilyName, "Existing value for PackageFamilyName was overwritten."); - Assert.IsNotNull(updatedInstallerManifest.Platform, "Existing value for Platform was overwritten.;"); + ClassicAssert.AreEqual("FakeProductCode", updatedInstallerManifest.ProductCode, "Existing value for ProductCode was overwritten."); + ClassicAssert.AreEqual("FakePackageFamilyName", updatedInstallerManifest.PackageFamilyName, "Existing value for PackageFamilyName was overwritten."); + ClassicAssert.IsNotNull(updatedInstallerManifest.Platform, "Existing value for Platform was overwritten.;"); } /// @@ -612,10 +612,9 @@ public async Task UpdateWithCompatibleInstallerType() { TestUtils.InitializeMockDownloads(TestConstants.TestMsixInstaller); (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.MatchWithCompatibleInstallerType", null, this.tempPath, null); - var initialManifests = Serialization.DeserializeManifestContents(initialManifestContent); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); - Assert.AreEqual(InstallerType.Appx, updatedManifests.InstallerManifest.InstallerType, "Msix installerType should be matched with Appx"); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.AreEqual(InstallerType.Appx, updatedManifests.InstallerManifest.InstallerType, "Msix installerType should be matched with Appx"); } /// @@ -630,10 +629,10 @@ public async Task UpdatesToLatestManifestVersion() var initialManifests = Serialization.DeserializeManifestContents(initialManifestContent); string initialManifestVersion = initialManifests.SingletonManifest.ManifestVersion; var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); - Assert.AreNotEqual(initialManifestVersion, updatedManifests.InstallerManifest.ManifestVersion, "ManifestVersion should be updated to latest."); - Assert.AreNotEqual(initialManifestVersion, updatedManifests.VersionManifest.ManifestVersion, "ManifestVersion should be updated to latest."); - Assert.AreNotEqual(initialManifestVersion, updatedManifests.DefaultLocaleManifest.ManifestVersion, "ManifestVersion should be updated to latest."); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.AreNotEqual(initialManifestVersion, updatedManifests.InstallerManifest.ManifestVersion, "ManifestVersion should be updated to latest."); + ClassicAssert.AreNotEqual(initialManifestVersion, updatedManifests.VersionManifest.ManifestVersion, "ManifestVersion should be updated to latest."); + ClassicAssert.AreNotEqual(initialManifestVersion, updatedManifests.DefaultLocaleManifest.ManifestVersion, "ManifestVersion should be updated to latest."); } /// @@ -648,11 +647,11 @@ public async Task UpdateMultifileToLatestManifestVersion() var initialManifests = Serialization.DeserializeManifestContents(initialManifestContent); string initialManifestVersion = initialManifests.VersionManifest.ManifestVersion; var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); - Assert.AreNotEqual(initialManifestVersion, updatedManifests.InstallerManifest.ManifestVersion, "ManifestVersion should be updated to latest."); - Assert.AreNotEqual(initialManifestVersion, updatedManifests.VersionManifest.ManifestVersion, "ManifestVersion should be updated to latest."); - Assert.AreNotEqual(initialManifestVersion, updatedManifests.DefaultLocaleManifest.ManifestVersion, "ManifestVersion should be updated to latest."); - Assert.AreNotEqual(initialManifestVersion, updatedManifests.LocaleManifests[0].ManifestVersion, "ManifestVersion should be updated to latest."); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.AreNotEqual(initialManifestVersion, updatedManifests.InstallerManifest.ManifestVersion, "ManifestVersion should be updated to latest."); + ClassicAssert.AreNotEqual(initialManifestVersion, updatedManifests.VersionManifest.ManifestVersion, "ManifestVersion should be updated to latest."); + ClassicAssert.AreNotEqual(initialManifestVersion, updatedManifests.DefaultLocaleManifest.ManifestVersion, "ManifestVersion should be updated to latest."); + ClassicAssert.AreNotEqual(initialManifestVersion, updatedManifests.LocaleManifests[0].ManifestVersion, "ManifestVersion should be updated to latest."); } /// @@ -662,24 +661,23 @@ public async Task UpdateMultifileToLatestManifestVersion() public void UpdateDeserializesAliasDefinedFields() { TestUtils.InitializeMockDownloads(TestConstants.TestExeInstaller); - - (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.DeserializeAliasFields", null, this.tempPath, null); + (_, List initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.DeserializeAliasFields", null, this.tempPath, null); var initialManifests = Serialization.DeserializeManifestContents(initialManifestContent); var singletonManifest = initialManifests.SingletonManifest; var installer = singletonManifest.Installers.First(); var agreement = singletonManifest.Agreements.First(); // Verify that fields with an alias-defined counterpart are not deserialized. - Assert.IsNull(singletonManifest.ReleaseDate, "ReleaseDate should not be defined as it is a DateTimeOffset type."); - Assert.IsNull(installer.ReleaseDate, "The installer ReleaseDate should not be defined as it is a DateTimeOffset type."); - Assert.IsNull(singletonManifest.Agreements.First().Agreement1, "Agreement1 should not be defined since the property name is generated incorrectly."); + ClassicAssert.IsNull(singletonManifest.ReleaseDate, "ReleaseDate should not be defined as it is a DateTimeOffset type."); + ClassicAssert.IsNull(installer.ReleaseDate, "The installer ReleaseDate should not be defined as it is a DateTimeOffset type."); + ClassicAssert.IsNull(singletonManifest.Agreements.First().Agreement1, "Agreement1 should not be defined since the property name is generated incorrectly."); // Verify that the alias-defined fields are correctly deserialized. - Assert.AreEqual("1-1-2022", singletonManifest.ReleaseDateTime, "The value for releaseDate should be 1-1-2022"); - Assert.AreEqual("1-1-2022", installer.ReleaseDateTime, "The value for releaseDate should be 1-1-2022"); - Assert.AreEqual("Agreement text", agreement.AgreementContent, "The value for AgreementContent should be 'Agreement text'."); - Assert.AreEqual("Agreement label", agreement.AgreementLabel, "The value for AgreementLabel should be 'Agreement label'."); - Assert.AreEqual("https://fakeagreementurl.com", agreement.AgreementUrl, "The value for AgreementUrl should be 'https://fakeagreementurl.com'."); + ClassicAssert.AreEqual("1-1-2022", singletonManifest.ReleaseDateTime, "The value for releaseDate should be 1-1-2022"); + ClassicAssert.AreEqual("1-1-2022", installer.ReleaseDateTime, "The value for releaseDate should be 1-1-2022"); + ClassicAssert.AreEqual("Agreement text", agreement.AgreementContent, "The value for AgreementContent should be 'Agreement text'."); + ClassicAssert.AreEqual("Agreement label", agreement.AgreementLabel, "The value for AgreementLabel should be 'Agreement label'."); + ClassicAssert.AreEqual("https://fakeagreementurl.com", agreement.AgreementUrl, "The value for AgreementUrl should be 'https://fakeagreementurl.com'."); } /// @@ -692,7 +690,7 @@ public async Task UpdateFullYamlSingletonVersion1_1() TestUtils.InitializeMockDownloads(TestConstants.TestExeInstaller); (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.FullYamlSingleton1_1", null, this.tempPath, null); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); } /// @@ -705,7 +703,7 @@ public async Task UpdateFullYamlSingletonVersion1_2() TestUtils.InitializeMockDownloads(TestConstants.TestExeInstaller); (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.FullYamlSingleton1_2", null, this.tempPath, null); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); } /// @@ -718,7 +716,7 @@ public async Task UpdateFullYamlSingletonVersion1_4() TestUtils.InitializeMockDownloads(TestConstants.TestExeInstaller); (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.FullYamlSingleton1_4", null, this.tempPath, null); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); } /// @@ -731,7 +729,7 @@ public async Task UpdateFullYamlSingletonVersion1_5() TestUtils.InitializeMockDownloads(TestConstants.TestExeInstaller); (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.FullYamlSingleton1_5", null, this.tempPath, null); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); } /// @@ -744,7 +742,7 @@ public async Task UpdateFullJsonSingletonVersion1_1() TestUtils.InitializeMockDownloads(TestConstants.TestExeInstaller); (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.FullJsonSingleton1_1", null, this.tempPath, null, fileExtension: ".json"); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); } /// @@ -757,7 +755,7 @@ public async Task UpdateFullJsonSingletonVersion1_2() TestUtils.InitializeMockDownloads(TestConstants.TestExeInstaller); (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.FullJsonSingleton1_2", null, this.tempPath, null, fileExtension: ".json"); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); } /// @@ -770,7 +768,7 @@ public async Task UpdateFullJsonSingletonVersion1_4() TestUtils.InitializeMockDownloads(TestConstants.TestExeInstaller); (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.FullJsonSingleton1_4", null, this.tempPath, null, fileExtension: ".json"); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); } /// @@ -783,7 +781,7 @@ public async Task UpdateFullJsonSingletonVersion1_5() TestUtils.InitializeMockDownloads(TestConstants.TestExeInstaller); (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.FullJsonSingleton1_5", null, this.tempPath, null, fileExtension: ".json"); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); } /// @@ -796,16 +794,16 @@ public async Task UpdateResetsVersionSpecificFields() TestUtils.InitializeMockDownloads(TestConstants.TestExeInstaller); (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.FullYamlSingleton1_1", null, this.tempPath, null); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); InstallerManifest updatedInstallerManifest = updatedManifests.InstallerManifest; DefaultLocaleManifest updatedDefaultLocaleManifest = updatedManifests.DefaultLocaleManifest; var updatedInstaller = updatedInstallerManifest.Installers.First(); - Assert.IsNull(updatedInstaller.ReleaseDateTime, "ReleaseDate should be null."); - Assert.IsNull(updatedInstallerManifest.ReleaseDateTime, "ReleaseDate should be null."); - Assert.IsNull(updatedDefaultLocaleManifest.ReleaseNotes, "ReleaseNotes should be null."); - Assert.IsNull(updatedDefaultLocaleManifest.ReleaseNotesUrl, "ReleaseNotesUrl should be null."); + ClassicAssert.IsNull(updatedInstaller.ReleaseDateTime, "ReleaseDate should be null."); + ClassicAssert.IsNull(updatedInstallerManifest.ReleaseDateTime, "ReleaseDate should be null."); + ClassicAssert.IsNull(updatedDefaultLocaleManifest.ReleaseNotes, "ReleaseNotes should be null."); + ClassicAssert.IsNull(updatedDefaultLocaleManifest.ReleaseNotesUrl, "ReleaseNotesUrl should be null."); } /// @@ -818,13 +816,12 @@ public async Task UpdatePortable() TestUtils.InitializeMockDownloads(TestConstants.TestExeInstaller); (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.Portable", null, this.tempPath, null); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); InstallerManifest updatedInstallerManifest = updatedManifests.InstallerManifest; - var updatedInstaller = updatedInstallerManifest.Installers.First(); - Assert.IsTrue(updatedInstallerManifest.InstallerType == InstallerType.Portable, "InstallerType should be portable"); - Assert.IsTrue(updatedInstallerManifest.Commands[0] == "portableCommand", "Command value should be preserved."); + ClassicAssert.IsTrue(updatedInstallerManifest.InstallerType == InstallerType.Portable, "InstallerType should be portable"); + ClassicAssert.IsTrue(updatedInstallerManifest.Commands[0] == "portableCommand", "Command value should be preserved."); } /// @@ -837,21 +834,21 @@ public async Task UpdateZipWithExe() TestUtils.InitializeMockDownloads(TestConstants.TestZipInstaller); (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.ZipWithExe", null, this.tempPath, null); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); InstallerManifest updatedInstallerManifest = updatedManifests.InstallerManifest; var updatedInstaller = updatedInstallerManifest.Installers.First(); - Assert.IsTrue(updatedInstallerManifest.InstallerType == InstallerType.Zip, "InstallerType should be ZIP"); - Assert.IsTrue(updatedInstallerManifest.NestedInstallerType == NestedInstallerType.Exe, "NestedInstallerType should be EXE"); + ClassicAssert.IsTrue(updatedInstallerManifest.InstallerType == InstallerType.Zip, "InstallerType should be ZIP"); + ClassicAssert.IsTrue(updatedInstallerManifest.NestedInstallerType == NestedInstallerType.Exe, "NestedInstallerType should be EXE"); var initialManifests = Serialization.DeserializeManifestContents(initialManifestContent); var initialInstaller = initialManifests.SingletonManifest.Installers.First(); var initialNestedInstallerFile = initialInstaller.NestedInstallerFiles.First(); var updatedNestedInstallerFile = updatedInstallerManifest.NestedInstallerFiles.First(); - Assert.IsTrue(initialNestedInstallerFile.RelativeFilePath == updatedNestedInstallerFile.RelativeFilePath, "RelativeFilePath should be preserved."); - Assert.IsTrue(initialInstaller.InstallerSha256 != updatedInstaller.InstallerSha256, "InstallerSha256 should be updated"); + ClassicAssert.IsTrue(initialNestedInstallerFile.RelativeFilePath == updatedNestedInstallerFile.RelativeFilePath, "RelativeFilePath should be preserved."); + ClassicAssert.IsTrue(initialInstaller.InstallerSha256 != updatedInstaller.InstallerSha256, "InstallerSha256 should be updated"); } /// @@ -864,22 +861,22 @@ public async Task UpdateZipWithPortable() TestUtils.InitializeMockDownloads(TestConstants.TestZipInstaller); (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.ZipWithPortable", null, this.tempPath, null); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); InstallerManifest updatedInstallerManifest = updatedManifests.InstallerManifest; var updatedInstaller = updatedInstallerManifest.Installers.First(); - Assert.IsTrue(updatedInstallerManifest.InstallerType == InstallerType.Zip, "InstallerType should be ZIP"); - Assert.IsTrue(updatedInstallerManifest.NestedInstallerType == NestedInstallerType.Portable, "NestedInstallerType should be PORTABLE"); + ClassicAssert.IsTrue(updatedInstallerManifest.InstallerType == InstallerType.Zip, "InstallerType should be ZIP"); + ClassicAssert.IsTrue(updatedInstallerManifest.NestedInstallerType == NestedInstallerType.Portable, "NestedInstallerType should be PORTABLE"); var initialManifests = Serialization.DeserializeManifestContents(initialManifestContent); var initialInstaller = initialManifests.SingletonManifest.Installers.First(); var initialNestedInstallerFile = initialInstaller.NestedInstallerFiles.First(); var updatedNestedInstallerFile = updatedInstallerManifest.NestedInstallerFiles.First(); - Assert.IsTrue(initialNestedInstallerFile.RelativeFilePath == updatedNestedInstallerFile.RelativeFilePath, "RelativeFilePath should be preserved."); - Assert.IsTrue(initialNestedInstallerFile.PortableCommandAlias == updatedNestedInstallerFile.PortableCommandAlias, "PortableCommandAlias should be preserved."); - Assert.IsTrue(initialInstaller.InstallerSha256 != updatedInstaller.InstallerSha256, "InstallerSha256 should be updated"); + ClassicAssert.IsTrue(initialNestedInstallerFile.RelativeFilePath == updatedNestedInstallerFile.RelativeFilePath, "RelativeFilePath should be preserved."); + ClassicAssert.IsTrue(initialNestedInstallerFile.PortableCommandAlias == updatedNestedInstallerFile.PortableCommandAlias, "PortableCommandAlias should be preserved."); + ClassicAssert.IsTrue(initialInstaller.InstallerSha256 != updatedInstaller.InstallerSha256, "InstallerSha256 should be updated"); } /// @@ -892,20 +889,20 @@ public async Task UpdateZipWithMsi() TestUtils.InitializeMockDownloads(TestConstants.TestZipInstaller); (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.ZipWithMsi", null, this.tempPath, null); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); InstallerManifest updatedInstallerManifest = updatedManifests.InstallerManifest; var updatedInstaller = updatedInstallerManifest.Installers.First(); - Assert.IsTrue(updatedInstallerManifest.InstallerType == InstallerType.Zip, "InstallerType should be ZIP"); - Assert.IsTrue(updatedInstallerManifest.NestedInstallerType == NestedInstallerType.Msi, "NestedInstallerType should be MSI"); + ClassicAssert.IsTrue(updatedInstallerManifest.InstallerType == InstallerType.Zip, "InstallerType should be ZIP"); + ClassicAssert.IsTrue(updatedInstallerManifest.NestedInstallerType == NestedInstallerType.Msi, "NestedInstallerType should be MSI"); var initialManifests = Serialization.DeserializeManifestContents(initialManifestContent); var initialInstaller = initialManifests.SingletonManifest.Installers.First(); - Assert.IsTrue(initialInstaller.NestedInstallerFiles[0].RelativeFilePath == updatedInstallerManifest.NestedInstallerFiles[0].RelativeFilePath, "RelativeFilePath should be preserved."); - Assert.IsTrue(initialInstaller.InstallerSha256 != updatedInstaller.InstallerSha256, "InstallerSha256 should be updated"); - Assert.IsNotNull(updatedInstallerManifest.ProductCode, "ProductCode should be updated."); + ClassicAssert.IsTrue(initialInstaller.NestedInstallerFiles[0].RelativeFilePath == updatedInstallerManifest.NestedInstallerFiles[0].RelativeFilePath, "RelativeFilePath should be preserved."); + ClassicAssert.IsTrue(initialInstaller.InstallerSha256 != updatedInstaller.InstallerSha256, "InstallerSha256 should be updated"); + ClassicAssert.IsNotNull(updatedInstallerManifest.ProductCode, "ProductCode should be updated."); } /// @@ -918,27 +915,27 @@ public async Task UpdateZipWithMsix() TestUtils.InitializeMockDownloads(TestConstants.TestZipInstaller); (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.ZipWithMsix", null, this.tempPath, null); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); InstallerManifest updatedInstallerManifest = updatedManifests.InstallerManifest; var updatedFirstInstaller = updatedInstallerManifest.Installers[0]; var updatedSecondInstaller = updatedInstallerManifest.Installers[1]; - Assert.IsTrue(updatedInstallerManifest.InstallerType == InstallerType.Zip, "InstallerType should be ZIP"); - Assert.IsTrue(updatedInstallerManifest.NestedInstallerType == NestedInstallerType.Msix, "NestedInstallerType should be MSIX"); + ClassicAssert.IsTrue(updatedInstallerManifest.InstallerType == InstallerType.Zip, "InstallerType should be ZIP"); + ClassicAssert.IsTrue(updatedInstallerManifest.NestedInstallerType == NestedInstallerType.Msix, "NestedInstallerType should be MSIX"); var initialManifests = Serialization.DeserializeManifestContents(initialManifestContent); var initialInstallers = initialManifests.SingletonManifest.Installers; var initialFirstInstaller = initialInstallers[0]; var initialSecondInstaller = initialInstallers[1]; - Assert.IsTrue(initialFirstInstaller.NestedInstallerFiles[0].RelativeFilePath == updatedInstallerManifest.NestedInstallerFiles[0].RelativeFilePath, "RelativeFilePath should be preserved."); + ClassicAssert.IsTrue(initialFirstInstaller.NestedInstallerFiles[0].RelativeFilePath == updatedInstallerManifest.NestedInstallerFiles[0].RelativeFilePath, "RelativeFilePath should be preserved."); - Assert.IsNotNull(updatedFirstInstaller.SignatureSha256, "SignatureSha256 should be updated."); - Assert.IsNotNull(updatedSecondInstaller.SignatureSha256, "SignatureSha256 should be updated."); + ClassicAssert.IsNotNull(updatedFirstInstaller.SignatureSha256, "SignatureSha256 should be updated."); + ClassicAssert.IsNotNull(updatedSecondInstaller.SignatureSha256, "SignatureSha256 should be updated."); - Assert.IsTrue(initialFirstInstaller.InstallerSha256 != updatedFirstInstaller.InstallerSha256, "InstallerSha256 should be updated"); - Assert.IsTrue(initialSecondInstaller.InstallerSha256 != updatedSecondInstaller.InstallerSha256, "InstallerSha256 should be updated"); + ClassicAssert.IsTrue(initialFirstInstaller.InstallerSha256 != updatedFirstInstaller.InstallerSha256, "InstallerSha256 should be updated"); + ClassicAssert.IsTrue(initialSecondInstaller.InstallerSha256 != updatedSecondInstaller.InstallerSha256, "InstallerSha256 should be updated"); } /// @@ -954,7 +951,7 @@ public async Task UpdateMultipleZipInstallers() (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.ZipMultipleInstallers", null, this.tempPath, new[] { $"{installerUrl}|x64", $"{installerUrl}|x86", $"{installerUrl}|arm64" }); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); var initialManifests = Serialization.DeserializeManifestContents(initialManifestContent); var initialInstallers = initialManifests.SingletonManifest.Installers; @@ -967,16 +964,16 @@ public async Task UpdateMultipleZipInstallers() var updatedSecondInstaller = updatedInstallerManifest.Installers[1]; var updatedThirdInstaller = updatedInstallerManifest.Installers[2]; - Assert.IsTrue(updatedInstallerManifest.InstallerType == InstallerType.Zip, "InstallerType should be ZIP"); - Assert.IsTrue(updatedInstallerManifest.NestedInstallerType == NestedInstallerType.Exe, "NestedInstallerType should be EXE"); - Assert.IsTrue(updatedInstallerManifest.NestedInstallerFiles.Count == 1, "NestedInstallerFiles list should contain only one member"); + ClassicAssert.IsTrue(updatedInstallerManifest.InstallerType == InstallerType.Zip, "InstallerType should be ZIP"); + ClassicAssert.IsTrue(updatedInstallerManifest.NestedInstallerType == NestedInstallerType.Exe, "NestedInstallerType should be EXE"); + ClassicAssert.IsTrue(updatedInstallerManifest.NestedInstallerFiles.Count == 1, "NestedInstallerFiles list should contain only one member"); - Assert.IsTrue(initialFirstInstaller.NestedInstallerFiles[0].RelativeFilePath == updatedInstallerManifest.NestedInstallerFiles[0].RelativeFilePath, "RelativeFilePath should be preserved."); - Assert.IsTrue(initialFirstInstaller.NestedInstallerFiles[0].PortableCommandAlias == updatedInstallerManifest.NestedInstallerFiles[0].PortableCommandAlias, "PortableCommandAlias should be preserved."); + ClassicAssert.IsTrue(initialFirstInstaller.NestedInstallerFiles[0].RelativeFilePath == updatedInstallerManifest.NestedInstallerFiles[0].RelativeFilePath, "RelativeFilePath should be preserved."); + ClassicAssert.IsTrue(initialFirstInstaller.NestedInstallerFiles[0].PortableCommandAlias == updatedInstallerManifest.NestedInstallerFiles[0].PortableCommandAlias, "PortableCommandAlias should be preserved."); - Assert.IsTrue(initialFirstInstaller.InstallerSha256 != updatedFirstInstaller.InstallerSha256, "InstallerSha256 should be updated"); - Assert.IsTrue(initialSecondInstaller.InstallerSha256 != updatedSecondInstaller.InstallerSha256, "InstallerSha256 should be updated"); - Assert.IsTrue(initialThirdInstaller.InstallerSha256 != updatedThirdInstaller.InstallerSha256, "InstallerSha256 should be updated"); + ClassicAssert.IsTrue(initialFirstInstaller.InstallerSha256 != updatedFirstInstaller.InstallerSha256, "InstallerSha256 should be updated"); + ClassicAssert.IsTrue(initialSecondInstaller.InstallerSha256 != updatedSecondInstaller.InstallerSha256, "InstallerSha256 should be updated"); + ClassicAssert.IsTrue(initialThirdInstaller.InstallerSha256 != updatedThirdInstaller.InstallerSha256, "InstallerSha256 should be updated"); } /// @@ -990,66 +987,66 @@ public async Task MoveInstallerFieldsToRoot() string installerUrl = $"https://fakedomain.com/{TestConstants.TestZipInstaller}"; (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.MoveInstallerFieldsToRoot", null, this.tempPath, new[] { $"{installerUrl}|x64", $"{installerUrl}|x86", $"{installerUrl}|arm" }); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); InstallerManifest updatedInstallerManifest = updatedManifests.InstallerManifest; - Assert.IsTrue(updatedInstallerManifest.InstallerType == InstallerType.Zip, "InstallerType at the root level should be ZIP"); - Assert.IsTrue(updatedInstallerManifest.NestedInstallerType == NestedInstallerType.Exe, "NestedInstallerType at the root level should be EXE"); - Assert.IsTrue(updatedInstallerManifest.Scope == Scope.Machine, "Scope at the root level should be machine"); - Assert.IsTrue(updatedInstallerManifest.MinimumOSVersion == "10.0.22000.0", "MinimumOSVersion at the root level should be 10.0.22000.0"); - Assert.IsTrue(updatedInstallerManifest.PackageFamilyName == "TestPackageFamilyName", "PackageFamilyName at the root level should be TestPackageFamilyName"); - Assert.IsTrue(updatedInstallerManifest.UpgradeBehavior == UpgradeBehavior.Install, "UpgradeBehavior at the root level should be install"); - Assert.IsTrue(updatedInstallerManifest.ElevationRequirement == ElevationRequirement.ElevationRequired, "ElevationRequirement at the root level should be elevationRequired"); - Assert.IsTrue(updatedInstallerManifest.InstallerAbortsTerminal == true, "InstallerAbortsTerminal at the root level should be true"); - Assert.IsTrue(updatedInstallerManifest.InstallLocationRequired == true, "InstallLocation at the root level should be true"); - Assert.IsTrue(updatedInstallerManifest.RequireExplicitUpgrade == true, "RequireExplicitUpgrade at the root level should be true"); - Assert.IsTrue(updatedInstallerManifest.DisplayInstallWarnings == true, "DisplayInstallWarnings at the root level should be true"); - Assert.IsNotNull(updatedInstallerManifest.NestedInstallerFiles, "NestedInstallerFiles at the root level should not be null"); - Assert.IsNotNull(updatedInstallerManifest.InstallerSwitches, "InstallerSwitches at the root level should not be null"); - Assert.IsNotNull(updatedInstallerManifest.Dependencies, "Dependencies at the root level should not be null"); - Assert.IsNotNull(updatedInstallerManifest.AppsAndFeaturesEntries, "AppsAndFeaturesEntries at the root level should not be null"); - Assert.IsNotNull(updatedInstallerManifest.Platform, "Platform at the root level should not be null"); - Assert.IsNotNull(updatedInstallerManifest.ExpectedReturnCodes, "ExpectedReturnCodes at the root level should not be null"); - Assert.IsNotNull(updatedInstallerManifest.Commands, "Commands at the root level should not be null"); - Assert.IsNotNull(updatedInstallerManifest.Protocols, "Protocols at the root level should not be null"); - Assert.IsNotNull(updatedInstallerManifest.FileExtensions, "FileExtensions at the root level should not be null"); + ClassicAssert.IsTrue(updatedInstallerManifest.InstallerType == InstallerType.Zip, "InstallerType at the root level should be ZIP"); + ClassicAssert.IsTrue(updatedInstallerManifest.NestedInstallerType == NestedInstallerType.Exe, "NestedInstallerType at the root level should be EXE"); + ClassicAssert.IsTrue(updatedInstallerManifest.Scope == Scope.Machine, "Scope at the root level should be machine"); + ClassicAssert.IsTrue(updatedInstallerManifest.MinimumOSVersion == "10.0.22000.0", "MinimumOSVersion at the root level should be 10.0.22000.0"); + ClassicAssert.IsTrue(updatedInstallerManifest.PackageFamilyName == "TestPackageFamilyName", "PackageFamilyName at the root level should be TestPackageFamilyName"); + ClassicAssert.IsTrue(updatedInstallerManifest.UpgradeBehavior == UpgradeBehavior.Install, "UpgradeBehavior at the root level should be install"); + ClassicAssert.IsTrue(updatedInstallerManifest.ElevationRequirement == ElevationRequirement.ElevationRequired, "ElevationRequirement at the root level should be elevationRequired"); + ClassicAssert.IsTrue(updatedInstallerManifest.InstallerAbortsTerminal == true, "InstallerAbortsTerminal at the root level should be true"); + ClassicAssert.IsTrue(updatedInstallerManifest.InstallLocationRequired == true, "InstallLocation at the root level should be true"); + ClassicAssert.IsTrue(updatedInstallerManifest.RequireExplicitUpgrade == true, "RequireExplicitUpgrade at the root level should be true"); + ClassicAssert.IsTrue(updatedInstallerManifest.DisplayInstallWarnings == true, "DisplayInstallWarnings at the root level should be true"); + ClassicAssert.IsNotNull(updatedInstallerManifest.NestedInstallerFiles, "NestedInstallerFiles at the root level should not be null"); + ClassicAssert.IsNotNull(updatedInstallerManifest.InstallerSwitches, "InstallerSwitches at the root level should not be null"); + ClassicAssert.IsNotNull(updatedInstallerManifest.Dependencies, "Dependencies at the root level should not be null"); + ClassicAssert.IsNotNull(updatedInstallerManifest.AppsAndFeaturesEntries, "AppsAndFeaturesEntries at the root level should not be null"); + ClassicAssert.IsNotNull(updatedInstallerManifest.Platform, "Platform at the root level should not be null"); + ClassicAssert.IsNotNull(updatedInstallerManifest.ExpectedReturnCodes, "ExpectedReturnCodes at the root level should not be null"); + ClassicAssert.IsNotNull(updatedInstallerManifest.Commands, "Commands at the root level should not be null"); + ClassicAssert.IsNotNull(updatedInstallerManifest.Protocols, "Protocols at the root level should not be null"); + ClassicAssert.IsNotNull(updatedInstallerManifest.FileExtensions, "FileExtensions at the root level should not be null"); // TODO: Uncomment when installer model gets updated to support markets field. - // Assert.IsNotNull(updatedInstallerManifest.Markets, "Markets at the root level should not be null"); - Assert.IsNotNull(updatedInstallerManifest.UnsupportedOSArchitectures, "UnsupportedOSArchitectures at the root level should not be null"); - Assert.IsNotNull(updatedInstallerManifest.InstallerSuccessCodes, "InstallerSuccessCodes at the root level should not be null"); - Assert.IsNotNull(updatedInstallerManifest.UnsupportedArguments, "UnsupportedArguments at the root level should not be null"); - Assert.IsNotNull(updatedInstallerManifest.InstallationMetadata, "InstallationMetadata at the root level should not be null"); + // ClassicAssert.IsNotNull(updatedInstallerManifest.Markets, "Markets at the root level should not be null"); + ClassicAssert.IsNotNull(updatedInstallerManifest.UnsupportedOSArchitectures, "UnsupportedOSArchitectures at the root level should not be null"); + ClassicAssert.IsNotNull(updatedInstallerManifest.InstallerSuccessCodes, "InstallerSuccessCodes at the root level should not be null"); + ClassicAssert.IsNotNull(updatedInstallerManifest.UnsupportedArguments, "UnsupportedArguments at the root level should not be null"); + ClassicAssert.IsNotNull(updatedInstallerManifest.InstallationMetadata, "InstallationMetadata at the root level should not be null"); foreach (var installer in updatedInstallerManifest.Installers) { - Assert.IsNull(installer.InstallerType, "InstallerType at the installer level should be null"); - Assert.IsNull(installer.NestedInstallerType, "NestedInstallerType at the installer level should be null"); - Assert.IsNull(installer.Scope, "Scope at the installer level should be null"); - Assert.IsNull(installer.MinimumOSVersion, "MinimumOSVersion at the installer level should be null"); - Assert.IsNull(installer.PackageFamilyName, "PackageFamilyName at the installer level should be null"); - Assert.IsNull(installer.UpgradeBehavior, "UpgradeBehavior at the installer level should be null"); - Assert.IsNull(installer.ElevationRequirement, "ElevationRequirement at the installer level should be null"); - Assert.IsNull(installer.InstallerAbortsTerminal, "InstallerAbortsTerminal at the installer level should be null"); - Assert.IsNull(installer.InstallLocationRequired, "InstallLocation at the installer level should be null"); - Assert.IsNull(installer.RequireExplicitUpgrade, "RequireExplicitUpgrade at the installer level should be null"); - Assert.IsNull(installer.DisplayInstallWarnings, "DisplayInstallWarnings at the installer level should be null"); - Assert.IsNull(installer.NestedInstallerFiles, "NestedInstallerFiles at the installer level should be null"); - Assert.IsNull(installer.InstallerSwitches, "InstallerSwitches at the installer level should be null"); - Assert.IsNull(installer.Dependencies, "Dependencies at the installer level should be null"); - Assert.IsNull(installer.AppsAndFeaturesEntries, "AppsAndFeaturesEntries at the installer level should be null"); - Assert.IsNull(installer.Platform, "Platform at the installer level should be null"); - Assert.IsNull(installer.ExpectedReturnCodes, "ExpectedReturnCodes at the installer level should be null"); - Assert.IsNull(installer.Commands, "Commands at the installer level should be null"); - Assert.IsNull(installer.Protocols, "Protocols at the installer level should be null"); - Assert.IsNull(installer.FileExtensions, "FileExtensions at the installer level should be null"); + ClassicAssert.IsNull(installer.InstallerType, "InstallerType at the installer level should be null"); + ClassicAssert.IsNull(installer.NestedInstallerType, "NestedInstallerType at the installer level should be null"); + ClassicAssert.IsNull(installer.Scope, "Scope at the installer level should be null"); + ClassicAssert.IsNull(installer.MinimumOSVersion, "MinimumOSVersion at the installer level should be null"); + ClassicAssert.IsNull(installer.PackageFamilyName, "PackageFamilyName at the installer level should be null"); + ClassicAssert.IsNull(installer.UpgradeBehavior, "UpgradeBehavior at the installer level should be null"); + ClassicAssert.IsNull(installer.ElevationRequirement, "ElevationRequirement at the installer level should be null"); + ClassicAssert.IsNull(installer.InstallerAbortsTerminal, "InstallerAbortsTerminal at the installer level should be null"); + ClassicAssert.IsNull(installer.InstallLocationRequired, "InstallLocation at the installer level should be null"); + ClassicAssert.IsNull(installer.RequireExplicitUpgrade, "RequireExplicitUpgrade at the installer level should be null"); + ClassicAssert.IsNull(installer.DisplayInstallWarnings, "DisplayInstallWarnings at the installer level should be null"); + ClassicAssert.IsNull(installer.NestedInstallerFiles, "NestedInstallerFiles at the installer level should be null"); + ClassicAssert.IsNull(installer.InstallerSwitches, "InstallerSwitches at the installer level should be null"); + ClassicAssert.IsNull(installer.Dependencies, "Dependencies at the installer level should be null"); + ClassicAssert.IsNull(installer.AppsAndFeaturesEntries, "AppsAndFeaturesEntries at the installer level should be null"); + ClassicAssert.IsNull(installer.Platform, "Platform at the installer level should be null"); + ClassicAssert.IsNull(installer.ExpectedReturnCodes, "ExpectedReturnCodes at the installer level should be null"); + ClassicAssert.IsNull(installer.Commands, "Commands at the installer level should be null"); + ClassicAssert.IsNull(installer.Protocols, "Protocols at the installer level should be null"); + ClassicAssert.IsNull(installer.FileExtensions, "FileExtensions at the installer level should be null"); // TODO: Uncomment when installer model gets updated to support markets field. - // Assert.IsNull(installer.Markets, "Markets at the installer level should be null"); - Assert.IsNull(installer.UnsupportedOSArchitectures, "UnsupportedOSArchitectures at the installer level should be null"); - Assert.IsNull(installer.InstallerSuccessCodes, "InstallerSuccessCodes at the installer level should be null"); - Assert.IsNull(installer.UnsupportedArguments, "UnsupportedArguments at the installer level should be null"); - Assert.IsNull(installer.InstallationMetadata, "InstallationMetadata at the installer level should be null"); + // ClassicAssert.IsNull(installer.Markets, "Markets at the installer level should be null"); + ClassicAssert.IsNull(installer.UnsupportedOSArchitectures, "UnsupportedOSArchitectures at the installer level should be null"); + ClassicAssert.IsNull(installer.InstallerSuccessCodes, "InstallerSuccessCodes at the installer level should be null"); + ClassicAssert.IsNull(installer.UnsupportedArguments, "UnsupportedArguments at the installer level should be null"); + ClassicAssert.IsNull(installer.InstallationMetadata, "InstallationMetadata at the installer level should be null"); } } @@ -1065,67 +1062,67 @@ public async Task DontMoveInstallerFieldsToRoot() string installerUrlExe = $"https://fakedomain.com/{TestConstants.TestExeInstaller}"; (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.DontMoveInstallerFieldsToRoot", null, this.tempPath, new[] { $"{installerUrlExe}", $"{installerUrlZip}|x86", $"{installerUrlZip}|arm" }); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); InstallerManifest updatedInstallerManifest = updatedManifests.InstallerManifest; - Assert.IsNull(updatedInstallerManifest.InstallerType, "InstallerType at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.NestedInstallerType, "NestedInstallerType at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.Scope, "Scope at the root level should not be null"); - Assert.IsNull(updatedInstallerManifest.MinimumOSVersion, "MinimumOSVersion at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.PackageFamilyName, "PackageFamilyName at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.UpgradeBehavior, "UpgradeBehavior at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.ElevationRequirement, "ElevationRequirement at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.InstallerAbortsTerminal, "InstallerAbortsTerminal at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.InstallLocationRequired, "InstallLocation at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.RequireExplicitUpgrade, "RequireExplicitUpgrade at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.DisplayInstallWarnings, "DisplayInstallWarnings at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.NestedInstallerFiles, "NestedInstallerFiles at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.InstallerSwitches, "InstallerSwitches at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.Dependencies, "Dependencies at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.AppsAndFeaturesEntries, "AppsAndFeaturesEntries at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.Platform, "Platform at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.ExpectedReturnCodes, "ExpectedReturnCodes at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.Commands, "Commands at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.Protocols, "Protocols at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.FileExtensions, "FileExtensions at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.InstallerType, "InstallerType at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.NestedInstallerType, "NestedInstallerType at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.Scope, "Scope at the root level should not be null"); + ClassicAssert.IsNull(updatedInstallerManifest.MinimumOSVersion, "MinimumOSVersion at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.PackageFamilyName, "PackageFamilyName at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.UpgradeBehavior, "UpgradeBehavior at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.ElevationRequirement, "ElevationRequirement at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.InstallerAbortsTerminal, "InstallerAbortsTerminal at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.InstallLocationRequired, "InstallLocation at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.RequireExplicitUpgrade, "RequireExplicitUpgrade at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.DisplayInstallWarnings, "DisplayInstallWarnings at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.NestedInstallerFiles, "NestedInstallerFiles at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.InstallerSwitches, "InstallerSwitches at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.Dependencies, "Dependencies at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.AppsAndFeaturesEntries, "AppsAndFeaturesEntries at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.Platform, "Platform at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.ExpectedReturnCodes, "ExpectedReturnCodes at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.Commands, "Commands at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.Protocols, "Protocols at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.FileExtensions, "FileExtensions at the root level should be null"); // TODO: Uncomment when installer model gets updated to support markets field. - // Assert.IsNull(updatedInstallerManifest.Markets, "Markets at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.UnsupportedOSArchitectures, "UnsupportedOSArchitectures at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.InstallerSuccessCodes, "InstallerSuccessCodes at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.UnsupportedArguments, "UnsupportedArguments at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.InstallationMetadata, "InstallationMetadata at the root level should be null"); + // ClassicAssert.IsNull(updatedInstallerManifest.Markets, "Markets at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.UnsupportedOSArchitectures, "UnsupportedOSArchitectures at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.InstallerSuccessCodes, "InstallerSuccessCodes at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.UnsupportedArguments, "UnsupportedArguments at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.InstallationMetadata, "InstallationMetadata at the root level should be null"); foreach (var installer in updatedInstallerManifest.Installers) { - Assert.IsNotNull(installer.InstallerType, "InstallerType at the installer level should not be null"); - Assert.IsNotNull(installer.NestedInstallerType, "NestedInstallerType at the installer level should not be null"); - Assert.IsNotNull(installer.Scope, "Scope at the installer level should not be null"); - Assert.IsNotNull(installer.MinimumOSVersion, "MinimumOSVersion at the installer level should not be null"); - Assert.IsNotNull(installer.PackageFamilyName, "PackageFamilyName at the installer level should not be null"); - Assert.IsNotNull(installer.UpgradeBehavior, "UpgradeBehavior at the installer level should not be null"); - Assert.IsNotNull(installer.ElevationRequirement, "ElevationRequirement at the installer level should not be null"); - Assert.IsNotNull(installer.InstallerAbortsTerminal, "InstallerAbortsTerminal at the installer level should not be null"); - Assert.IsNotNull(installer.InstallLocationRequired, "InstallLocation at the installer level should not be null"); - Assert.IsNotNull(installer.RequireExplicitUpgrade, "RequireExplicitUpgrade at the installer level should not be null"); - Assert.IsNotNull(installer.DisplayInstallWarnings, "DisplayInstallWarnings at the installer level should not be null"); - Assert.IsNotNull(installer.NestedInstallerFiles, "NestedInstallerFiles at the installer level should not be null"); - Assert.IsNotNull(installer.InstallerSwitches, "InstallerSwitches at the installer level should not be null"); - Assert.IsNotNull(installer.Dependencies, "Dependencies at the installer level should not be null"); - Assert.IsNotNull(installer.AppsAndFeaturesEntries, "AppsAndFeaturesEntries at the installer level should not be null"); - Assert.IsNotNull(installer.Platform, "Platform at the installer level should not be null"); - Assert.IsNotNull(installer.ExpectedReturnCodes, "ExpectedReturnCodes at the installer level should not be null"); - Assert.IsNotNull(installer.Commands, "Commands at the installer level should not be null"); - Assert.IsNotNull(installer.Protocols, "Protocols at the installer level should not be null"); - Assert.IsNotNull(installer.FileExtensions, "FileExtensions at the installer level should not be null"); + ClassicAssert.IsNotNull(installer.InstallerType, "InstallerType at the installer level should not be null"); + ClassicAssert.IsNotNull(installer.NestedInstallerType, "NestedInstallerType at the installer level should not be null"); + ClassicAssert.IsNotNull(installer.Scope, "Scope at the installer level should not be null"); + ClassicAssert.IsNotNull(installer.MinimumOSVersion, "MinimumOSVersion at the installer level should not be null"); + ClassicAssert.IsNotNull(installer.PackageFamilyName, "PackageFamilyName at the installer level should not be null"); + ClassicAssert.IsNotNull(installer.UpgradeBehavior, "UpgradeBehavior at the installer level should not be null"); + ClassicAssert.IsNotNull(installer.ElevationRequirement, "ElevationRequirement at the installer level should not be null"); + ClassicAssert.IsNotNull(installer.InstallerAbortsTerminal, "InstallerAbortsTerminal at the installer level should not be null"); + ClassicAssert.IsNotNull(installer.InstallLocationRequired, "InstallLocation at the installer level should not be null"); + ClassicAssert.IsNotNull(installer.RequireExplicitUpgrade, "RequireExplicitUpgrade at the installer level should not be null"); + ClassicAssert.IsNotNull(installer.DisplayInstallWarnings, "DisplayInstallWarnings at the installer level should not be null"); + ClassicAssert.IsNotNull(installer.NestedInstallerFiles, "NestedInstallerFiles at the installer level should not be null"); + ClassicAssert.IsNotNull(installer.InstallerSwitches, "InstallerSwitches at the installer level should not be null"); + ClassicAssert.IsNotNull(installer.Dependencies, "Dependencies at the installer level should not be null"); + ClassicAssert.IsNotNull(installer.AppsAndFeaturesEntries, "AppsAndFeaturesEntries at the installer level should not be null"); + ClassicAssert.IsNotNull(installer.Platform, "Platform at the installer level should not be null"); + ClassicAssert.IsNotNull(installer.ExpectedReturnCodes, "ExpectedReturnCodes at the installer level should not be null"); + ClassicAssert.IsNotNull(installer.Commands, "Commands at the installer level should not be null"); + ClassicAssert.IsNotNull(installer.Protocols, "Protocols at the installer level should not be null"); + ClassicAssert.IsNotNull(installer.FileExtensions, "FileExtensions at the installer level should not be null"); // TODO: Uncomment when installer model gets updated to support markets field. - // Assert.IsNotNull(installer.Markets, "Markets at the installer level should not be null"); - Assert.IsNotNull(installer.UnsupportedOSArchitectures, "UnsupportedOSArchitectures at the installer level should not be null"); - Assert.IsNotNull(installer.InstallerSuccessCodes, "InstallerSuccessCodes at the installer level should not be null"); - Assert.IsNotNull(installer.UnsupportedArguments, "UnsupportedArguments at the installer level should not be null"); - Assert.IsNotNull(installer.InstallationMetadata, "InstallationMetadata at the installer level should not be null"); + // ClassicAssert.IsNotNull(installer.Markets, "Markets at the installer level should not be null"); + ClassicAssert.IsNotNull(installer.UnsupportedOSArchitectures, "UnsupportedOSArchitectures at the installer level should not be null"); + ClassicAssert.IsNotNull(installer.InstallerSuccessCodes, "InstallerSuccessCodes at the installer level should not be null"); + ClassicAssert.IsNotNull(installer.UnsupportedArguments, "UnsupportedArguments at the installer level should not be null"); + ClassicAssert.IsNotNull(installer.InstallationMetadata, "InstallationMetadata at the installer level should not be null"); } } @@ -1144,79 +1141,79 @@ public async Task UpdateOverwritesNullInstallerFields() string installerUrl = $"https://fakedomain.com/{TestConstants.TestZipInstaller}"; (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.OverwriteNullInstallerFields", null, this.tempPath, new[] { $"{installerUrl}|x64", $"{installerUrl}|x86" }); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); InstallerManifest updatedInstallerManifest = updatedManifests.InstallerManifest; - Assert.IsTrue(updatedInstallerManifest.InstallerType == InstallerType.Zip, "InstallerType at the root level should be ZIP"); - Assert.IsTrue(updatedInstallerManifest.NestedInstallerType == NestedInstallerType.Exe, "NestedInstallerType at the root level should be EXE"); - Assert.IsTrue(updatedInstallerManifest.Scope == Scope.Machine, "Scope at the root level should be machine"); - Assert.IsTrue(updatedInstallerManifest.MinimumOSVersion == "10.0.22000.0", "MinimumOSVersion at the root level should be 10.0.22000.0"); - Assert.IsTrue(updatedInstallerManifest.PackageFamilyName == "TestPackageFamilyName1", "PackageFamilyName at the root level should be TestPackageFamilyName"); - Assert.IsTrue(updatedInstallerManifest.UpgradeBehavior == UpgradeBehavior.Install, "UpgradeBehavior at the root level should be install"); - Assert.IsTrue(updatedInstallerManifest.ElevationRequirement == ElevationRequirement.ElevationRequired, "ElevationRequirement at the root level should be elevationRequired"); - Assert.IsTrue(updatedInstallerManifest.InstallerAbortsTerminal == true, "InstallerAbortsTerminal at the root level should be true"); - Assert.IsTrue(updatedInstallerManifest.InstallLocationRequired == true, "InstallLocation at the root level should be true"); - Assert.IsTrue(updatedInstallerManifest.RequireExplicitUpgrade == true, "RequireExplicitUpgrade at the root level should be true"); - Assert.IsTrue(updatedInstallerManifest.DisplayInstallWarnings == true, "DisplayInstallWarnings at the root level should be true"); - Assert.IsNotNull(updatedInstallerManifest.NestedInstallerFiles, "NestedInstallerFiles at the root level should not be null"); - Assert.IsTrue(updatedInstallerManifest.NestedInstallerFiles[0].PortableCommandAlias == "PortableCommandAlias1", "PortableCommandAlias at the root level should be PortableCommandAlias1"); - Assert.IsNotNull(updatedInstallerManifest.InstallerSwitches, "InstallerSwitches at the root level should not be null"); - Assert.IsTrue(updatedInstallerManifest.InstallerSwitches.Silent == "/silent1", "Silent installer switch at the root level should be /silent1"); - Assert.IsNotNull(updatedInstallerManifest.Dependencies, "Dependencies at the root level should not be null"); - Assert.IsTrue(updatedInstallerManifest.Dependencies.PackageDependencies[0].PackageIdentifier == "TestPackageDependency1", "PackageDependencies PackageIdentifier at the root level should be TestPackageDependency1"); - Assert.IsNotNull(updatedInstallerManifest.AppsAndFeaturesEntries, "AppsAndFeaturesEntries at the root level should not be null"); - Assert.IsTrue(updatedInstallerManifest.AppsAndFeaturesEntries[0].ProductCode == "TestProductCode1", "AppsAndFeaturesEntries ProductCode at the root level should be TestProduct1"); - Assert.IsNotNull(updatedInstallerManifest.Platform, "Platform at the root level should not be null"); - Assert.IsTrue(updatedInstallerManifest.Platform[0] == Platform.Windows_Desktop, "Platform at the root level should contain Windows.Desktop"); - Assert.IsNotNull(updatedInstallerManifest.ExpectedReturnCodes, "ExpectedReturnCodes at the root level should not be null"); - Assert.IsTrue(updatedInstallerManifest.ExpectedReturnCodes[0].InstallerReturnCode == 1001, "ExpectedReturnCodes InstallerReturnCode at the root level should be 1001"); - Assert.IsNotNull(updatedInstallerManifest.Commands, "Commands at the root level should not be null"); - Assert.IsTrue(updatedInstallerManifest.Commands[0] == "fakeCommand1", "Commands at the root level should contain fakeCommand1"); - Assert.IsNotNull(updatedInstallerManifest.Protocols, "Protocols at the root level should not be null"); - Assert.IsTrue(updatedInstallerManifest.Protocols[0] == "fakeProtocol1", "Protocols at the root level should contain fakeProtocol1"); - Assert.IsNotNull(updatedInstallerManifest.FileExtensions, "FileExtensions at the root level should not be null"); - Assert.IsTrue(updatedInstallerManifest.FileExtensions[0] == ".exe", "FileExtensions at the root level should contain .exe"); + ClassicAssert.IsTrue(updatedInstallerManifest.InstallerType == InstallerType.Zip, "InstallerType at the root level should be ZIP"); + ClassicAssert.IsTrue(updatedInstallerManifest.NestedInstallerType == NestedInstallerType.Exe, "NestedInstallerType at the root level should be EXE"); + ClassicAssert.IsTrue(updatedInstallerManifest.Scope == Scope.Machine, "Scope at the root level should be machine"); + ClassicAssert.IsTrue(updatedInstallerManifest.MinimumOSVersion == "10.0.22000.0", "MinimumOSVersion at the root level should be 10.0.22000.0"); + ClassicAssert.IsTrue(updatedInstallerManifest.PackageFamilyName == "TestPackageFamilyName1", "PackageFamilyName at the root level should be TestPackageFamilyName"); + ClassicAssert.IsTrue(updatedInstallerManifest.UpgradeBehavior == UpgradeBehavior.Install, "UpgradeBehavior at the root level should be install"); + ClassicAssert.IsTrue(updatedInstallerManifest.ElevationRequirement == ElevationRequirement.ElevationRequired, "ElevationRequirement at the root level should be elevationRequired"); + ClassicAssert.IsTrue(updatedInstallerManifest.InstallerAbortsTerminal == true, "InstallerAbortsTerminal at the root level should be true"); + ClassicAssert.IsTrue(updatedInstallerManifest.InstallLocationRequired == true, "InstallLocation at the root level should be true"); + ClassicAssert.IsTrue(updatedInstallerManifest.RequireExplicitUpgrade == true, "RequireExplicitUpgrade at the root level should be true"); + ClassicAssert.IsTrue(updatedInstallerManifest.DisplayInstallWarnings == true, "DisplayInstallWarnings at the root level should be true"); + ClassicAssert.IsNotNull(updatedInstallerManifest.NestedInstallerFiles, "NestedInstallerFiles at the root level should not be null"); + ClassicAssert.IsTrue(updatedInstallerManifest.NestedInstallerFiles[0].PortableCommandAlias == "PortableCommandAlias1", "PortableCommandAlias at the root level should be PortableCommandAlias1"); + ClassicAssert.IsNotNull(updatedInstallerManifest.InstallerSwitches, "InstallerSwitches at the root level should not be null"); + ClassicAssert.IsTrue(updatedInstallerManifest.InstallerSwitches.Silent == "/silent1", "Silent installer switch at the root level should be /silent1"); + ClassicAssert.IsNotNull(updatedInstallerManifest.Dependencies, "Dependencies at the root level should not be null"); + ClassicAssert.IsTrue(updatedInstallerManifest.Dependencies.PackageDependencies[0].PackageIdentifier == "TestPackageDependency1", "PackageDependencies PackageIdentifier at the root level should be TestPackageDependency1"); + ClassicAssert.IsNotNull(updatedInstallerManifest.AppsAndFeaturesEntries, "AppsAndFeaturesEntries at the root level should not be null"); + ClassicAssert.IsTrue(updatedInstallerManifest.AppsAndFeaturesEntries[0].ProductCode == "TestProductCode1", "AppsAndFeaturesEntries ProductCode at the root level should be TestProduct1"); + ClassicAssert.IsNotNull(updatedInstallerManifest.Platform, "Platform at the root level should not be null"); + ClassicAssert.IsTrue(updatedInstallerManifest.Platform[0] == Platform.Windows_Desktop, "Platform at the root level should contain Windows.Desktop"); + ClassicAssert.IsNotNull(updatedInstallerManifest.ExpectedReturnCodes, "ExpectedReturnCodes at the root level should not be null"); + ClassicAssert.IsTrue(updatedInstallerManifest.ExpectedReturnCodes[0].InstallerReturnCode == 1001, "ExpectedReturnCodes InstallerReturnCode at the root level should be 1001"); + ClassicAssert.IsNotNull(updatedInstallerManifest.Commands, "Commands at the root level should not be null"); + ClassicAssert.IsTrue(updatedInstallerManifest.Commands[0] == "fakeCommand1", "Commands at the root level should contain fakeCommand1"); + ClassicAssert.IsNotNull(updatedInstallerManifest.Protocols, "Protocols at the root level should not be null"); + ClassicAssert.IsTrue(updatedInstallerManifest.Protocols[0] == "fakeProtocol1", "Protocols at the root level should contain fakeProtocol1"); + ClassicAssert.IsNotNull(updatedInstallerManifest.FileExtensions, "FileExtensions at the root level should not be null"); + ClassicAssert.IsTrue(updatedInstallerManifest.FileExtensions[0] == ".exe", "FileExtensions at the root level should contain .exe"); // TODO: Uncomment when installer model gets updated to support markets field. - // Assert.IsNotNull(updatedInstallerManifest.Markets, "Markets at the root level should not be null"); - Assert.IsNotNull(updatedInstallerManifest.UnsupportedOSArchitectures, "UnsupportedOSArchitectures at the root level should not be null"); - Assert.IsTrue(updatedInstallerManifest.UnsupportedOSArchitectures[0] == UnsupportedOSArchitecture.Arm64, "UnsupportedOSArchitectures at the root level should contain arm64"); - Assert.IsNotNull(updatedInstallerManifest.InstallerSuccessCodes, "InstallerSuccessCodes at the root level should not be null"); - Assert.IsTrue(updatedInstallerManifest.InstallerSuccessCodes[0] == 1, "InstallerSuccessCodes at the root level should contain 1"); - Assert.IsNotNull(updatedInstallerManifest.UnsupportedArguments, "UnsupportedArguments at the root level should not be null"); - Assert.IsTrue(updatedInstallerManifest.UnsupportedArguments[1] == UnsupportedArgument.Location, "UnsupportedArguments at the root level should contain location"); - Assert.IsNotNull(updatedInstallerManifest.InstallationMetadata, "InstallationMetadata at the root level should not be null"); - Assert.IsTrue(updatedInstallerManifest.InstallationMetadata.DefaultInstallLocation == "%ProgramFiles%\\TestApp1", "DefaultInstallLocation at the root level should be ProgramFiles/TestApp1"); + // ClassicAssert.IsNotNull(updatedInstallerManifest.Markets, "Markets at the root level should not be null"); + ClassicAssert.IsNotNull(updatedInstallerManifest.UnsupportedOSArchitectures, "UnsupportedOSArchitectures at the root level should not be null"); + ClassicAssert.IsTrue(updatedInstallerManifest.UnsupportedOSArchitectures[0] == UnsupportedOSArchitecture.Arm64, "UnsupportedOSArchitectures at the root level should contain arm64"); + ClassicAssert.IsNotNull(updatedInstallerManifest.InstallerSuccessCodes, "InstallerSuccessCodes at the root level should not be null"); + ClassicAssert.IsTrue(updatedInstallerManifest.InstallerSuccessCodes[0] == 1, "InstallerSuccessCodes at the root level should contain 1"); + ClassicAssert.IsNotNull(updatedInstallerManifest.UnsupportedArguments, "UnsupportedArguments at the root level should not be null"); + ClassicAssert.IsTrue(updatedInstallerManifest.UnsupportedArguments[1] == UnsupportedArgument.Location, "UnsupportedArguments at the root level should contain location"); + ClassicAssert.IsNotNull(updatedInstallerManifest.InstallationMetadata, "InstallationMetadata at the root level should not be null"); + ClassicAssert.IsTrue(updatedInstallerManifest.InstallationMetadata.DefaultInstallLocation == "%ProgramFiles%\\TestApp1", "DefaultInstallLocation at the root level should be ProgramFiles/TestApp1"); foreach (var installer in updatedInstallerManifest.Installers) { - Assert.IsNull(installer.InstallerType, "InstallerType at the installer level should be null"); - Assert.IsNull(installer.NestedInstallerType, "NestedInstallerType at the installer level should be null"); - Assert.IsNull(installer.Scope, "Scope at the installer level should be null"); - Assert.IsNull(installer.MinimumOSVersion, "MinimumOSVersion at the installer level should be null"); - Assert.IsNull(installer.PackageFamilyName, "PackageFamilyName at the installer level should be null"); - Assert.IsNull(installer.UpgradeBehavior, "UpgradeBehavior at the installer level should be null"); - Assert.IsNull(installer.ElevationRequirement, "ElevationRequirement at the installer level should be null"); - Assert.IsNull(installer.InstallerAbortsTerminal, "InstallerAbortsTerminal at the installer level should be null"); - Assert.IsNull(installer.InstallLocationRequired, "InstallLocation at the installer level should be null"); - Assert.IsNull(installer.RequireExplicitUpgrade, "RequireExplicitUpgrade at the installer level should be null"); - Assert.IsNull(installer.DisplayInstallWarnings, "DisplayInstallWarnings at the installer level should be null"); - Assert.IsNull(installer.NestedInstallerFiles, "NestedInstallerFiles at the installer level should be null"); - Assert.IsNull(installer.InstallerSwitches, "InstallerSwitches at the installer level should be null"); - Assert.IsNull(installer.Dependencies, "Dependencies at the installer level should be null"); - Assert.IsNull(installer.AppsAndFeaturesEntries, "AppsAndFeaturesEntries at the installer level should be null"); - Assert.IsNull(installer.Platform, "Platform at the installer level should be null"); - Assert.IsNull(installer.ExpectedReturnCodes, "ExpectedReturnCodes at the installer level should be null"); - Assert.IsNull(installer.Commands, "Commands at the installer level should be null"); - Assert.IsNull(installer.Protocols, "Protocols at the installer level should be null"); - Assert.IsNull(installer.FileExtensions, "FileExtensions at the installer level should be null"); + ClassicAssert.IsNull(installer.InstallerType, "InstallerType at the installer level should be null"); + ClassicAssert.IsNull(installer.NestedInstallerType, "NestedInstallerType at the installer level should be null"); + ClassicAssert.IsNull(installer.Scope, "Scope at the installer level should be null"); + ClassicAssert.IsNull(installer.MinimumOSVersion, "MinimumOSVersion at the installer level should be null"); + ClassicAssert.IsNull(installer.PackageFamilyName, "PackageFamilyName at the installer level should be null"); + ClassicAssert.IsNull(installer.UpgradeBehavior, "UpgradeBehavior at the installer level should be null"); + ClassicAssert.IsNull(installer.ElevationRequirement, "ElevationRequirement at the installer level should be null"); + ClassicAssert.IsNull(installer.InstallerAbortsTerminal, "InstallerAbortsTerminal at the installer level should be null"); + ClassicAssert.IsNull(installer.InstallLocationRequired, "InstallLocation at the installer level should be null"); + ClassicAssert.IsNull(installer.RequireExplicitUpgrade, "RequireExplicitUpgrade at the installer level should be null"); + ClassicAssert.IsNull(installer.DisplayInstallWarnings, "DisplayInstallWarnings at the installer level should be null"); + ClassicAssert.IsNull(installer.NestedInstallerFiles, "NestedInstallerFiles at the installer level should be null"); + ClassicAssert.IsNull(installer.InstallerSwitches, "InstallerSwitches at the installer level should be null"); + ClassicAssert.IsNull(installer.Dependencies, "Dependencies at the installer level should be null"); + ClassicAssert.IsNull(installer.AppsAndFeaturesEntries, "AppsAndFeaturesEntries at the installer level should be null"); + ClassicAssert.IsNull(installer.Platform, "Platform at the installer level should be null"); + ClassicAssert.IsNull(installer.ExpectedReturnCodes, "ExpectedReturnCodes at the installer level should be null"); + ClassicAssert.IsNull(installer.Commands, "Commands at the installer level should be null"); + ClassicAssert.IsNull(installer.Protocols, "Protocols at the installer level should be null"); + ClassicAssert.IsNull(installer.FileExtensions, "FileExtensions at the installer level should be null"); // TODO: Uncomment when installer model gets updated to support markets field. - // Assert.IsNull(installer.Markets, "Markets at the installer level should be null"); - Assert.IsNull(installer.UnsupportedOSArchitectures, "UnsupportedOSArchitectures at the installer level should be null"); - Assert.IsNull(installer.InstallerSuccessCodes, "InstallerSuccessCodes at the installer level should be null"); - Assert.IsNull(installer.UnsupportedArguments, "UnsupportedArguments at the installer level should be null"); - Assert.IsNull(installer.InstallationMetadata, "InstallationMetadata at the installer level should be null"); + // ClassicAssert.IsNull(installer.Markets, "Markets at the installer level should be null"); + ClassicAssert.IsNull(installer.UnsupportedOSArchitectures, "UnsupportedOSArchitectures at the installer level should be null"); + ClassicAssert.IsNull(installer.InstallerSuccessCodes, "InstallerSuccessCodes at the installer level should be null"); + ClassicAssert.IsNull(installer.UnsupportedArguments, "UnsupportedArguments at the installer level should be null"); + ClassicAssert.IsNull(installer.InstallationMetadata, "InstallationMetadata at the installer level should be null"); } } @@ -1237,119 +1234,119 @@ public async Task UpdateRetainsNonNullInstallerFields() string installerUrl = $"https://fakedomain.com/{TestConstants.TestZipInstaller}"; (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.RetainInstallerFields", null, this.tempPath, new[] { $"{installerUrl}|x64", $"{installerUrl}|x86" }); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNotNull(updatedManifests, "Command should have succeeded"); + ClassicAssert.IsNotNull(updatedManifests, "Command should have succeeded"); InstallerManifest updatedInstallerManifest = updatedManifests.InstallerManifest; Installer firstInstaller = updatedInstallerManifest.Installers[0]; Installer secondInstaller = updatedInstallerManifest.Installers[1]; // Fields for first installer should be copied over from root - Assert.IsTrue(firstInstaller.Scope == Scope.Machine, "Scope for the first installer should be copied over from root"); - Assert.IsTrue(firstInstaller.MinimumOSVersion == "10.0.22000.0", "MinimumOSVersion for the first installer should be copied over from root"); - Assert.IsTrue(firstInstaller.PackageFamilyName == "TestPackageFamilyName1", "PackageFamilyName for the first installer should be copied over from root"); - Assert.IsTrue(firstInstaller.UpgradeBehavior == UpgradeBehavior.Install, "UpgradeBehavior for the first installer should be copied over from root"); - Assert.IsTrue(firstInstaller.ElevationRequirement == ElevationRequirement.ElevationRequired, "ElevationRequirement for the first installer should be copied over from root"); - Assert.IsTrue(firstInstaller.InstallerAbortsTerminal == true, "InstallerAbortsTerminal for the first installer should be copied over from root"); - Assert.IsTrue(firstInstaller.InstallLocationRequired == true, "InstallLocation for the first installer should be copied over from root"); - Assert.IsTrue(firstInstaller.RequireExplicitUpgrade == true, "RequireExplicitUpgrade for the first installer should be copied over from root"); - Assert.IsTrue(firstInstaller.DisplayInstallWarnings == true, "DisplayInstallWarnings for the first installer should be copied over from root"); - Assert.IsNotNull(firstInstaller.InstallerSwitches, "InstallerSwitches for the first installer should not be null"); - Assert.IsTrue(firstInstaller.InstallerSwitches.Silent == "/silent1", "Silent installer switch for the first installer should be copied over from root"); - Assert.IsNotNull(firstInstaller.Dependencies, "Dependencies for the first installer should not be null"); - Assert.IsTrue(firstInstaller.Dependencies.PackageDependencies[0].PackageIdentifier == "TestPackageDependency1", "PackageDependencies PackageIdentifier for the first installer should be copied over from root"); - Assert.IsNotNull(firstInstaller.AppsAndFeaturesEntries, "AppsAndFeaturesEntries for the first installer should not be null"); - Assert.IsTrue(firstInstaller.AppsAndFeaturesEntries[0].ProductCode == "TestProductCode1", "AppsAndFeaturesEntries ProductCode for the first installer should be copied over from root"); - Assert.IsNotNull(firstInstaller.Platform, "Platform for the first installer should not be null"); - Assert.IsTrue(firstInstaller.Platform[0] == Platform.Windows_Desktop, "Platform for the first installer should be copied over from root"); - Assert.IsNotNull(firstInstaller.ExpectedReturnCodes, "ExpectedReturnCodes afor the first installer should not be null"); - Assert.IsTrue(firstInstaller.ExpectedReturnCodes[0].InstallerReturnCode == 1001, "ExpectedReturnCodes InstallerReturnCode for the first installer should be copied over from root"); - Assert.IsNotNull(firstInstaller.Commands, "Commands for the first installer should not be null"); - Assert.IsTrue(firstInstaller.Commands[0] == "fakeCommand1", "Commands for the first installer should be copied over from root"); - Assert.IsNotNull(firstInstaller.Protocols, "Protocols for the first installer should not be null"); - Assert.IsTrue(firstInstaller.Protocols[0] == "fakeProtocol1", "Protocols for the first installer should be copied over from root"); - Assert.IsNotNull(firstInstaller.FileExtensions, "FileExtensions for the first installer should not be null"); - Assert.IsTrue(firstInstaller.FileExtensions[0] == ".exe", "FileExtensions for the first installer should be copied over from root"); + ClassicAssert.IsTrue(firstInstaller.Scope == Scope.Machine, "Scope for the first installer should be copied over from root"); + ClassicAssert.IsTrue(firstInstaller.MinimumOSVersion == "10.0.22000.0", "MinimumOSVersion for the first installer should be copied over from root"); + ClassicAssert.IsTrue(firstInstaller.PackageFamilyName == "TestPackageFamilyName1", "PackageFamilyName for the first installer should be copied over from root"); + ClassicAssert.IsTrue(firstInstaller.UpgradeBehavior == UpgradeBehavior.Install, "UpgradeBehavior for the first installer should be copied over from root"); + ClassicAssert.IsTrue(firstInstaller.ElevationRequirement == ElevationRequirement.ElevationRequired, "ElevationRequirement for the first installer should be copied over from root"); + ClassicAssert.IsTrue(firstInstaller.InstallerAbortsTerminal == true, "InstallerAbortsTerminal for the first installer should be copied over from root"); + ClassicAssert.IsTrue(firstInstaller.InstallLocationRequired == true, "InstallLocation for the first installer should be copied over from root"); + ClassicAssert.IsTrue(firstInstaller.RequireExplicitUpgrade == true, "RequireExplicitUpgrade for the first installer should be copied over from root"); + ClassicAssert.IsTrue(firstInstaller.DisplayInstallWarnings == true, "DisplayInstallWarnings for the first installer should be copied over from root"); + ClassicAssert.IsNotNull(firstInstaller.InstallerSwitches, "InstallerSwitches for the first installer should not be null"); + ClassicAssert.IsTrue(firstInstaller.InstallerSwitches.Silent == "/silent1", "Silent installer switch for the first installer should be copied over from root"); + ClassicAssert.IsNotNull(firstInstaller.Dependencies, "Dependencies for the first installer should not be null"); + ClassicAssert.IsTrue(firstInstaller.Dependencies.PackageDependencies[0].PackageIdentifier == "TestPackageDependency1", "PackageDependencies PackageIdentifier for the first installer should be copied over from root"); + ClassicAssert.IsNotNull(firstInstaller.AppsAndFeaturesEntries, "AppsAndFeaturesEntries for the first installer should not be null"); + ClassicAssert.IsTrue(firstInstaller.AppsAndFeaturesEntries[0].ProductCode == "TestProductCode1", "AppsAndFeaturesEntries ProductCode for the first installer should be copied over from root"); + ClassicAssert.IsNotNull(firstInstaller.Platform, "Platform for the first installer should not be null"); + ClassicAssert.IsTrue(firstInstaller.Platform[0] == Platform.Windows_Desktop, "Platform for the first installer should be copied over from root"); + ClassicAssert.IsNotNull(firstInstaller.ExpectedReturnCodes, "ExpectedReturnCodes afor the first installer should not be null"); + ClassicAssert.IsTrue(firstInstaller.ExpectedReturnCodes[0].InstallerReturnCode == 1001, "ExpectedReturnCodes InstallerReturnCode for the first installer should be copied over from root"); + ClassicAssert.IsNotNull(firstInstaller.Commands, "Commands for the first installer should not be null"); + ClassicAssert.IsTrue(firstInstaller.Commands[0] == "fakeCommand1", "Commands for the first installer should be copied over from root"); + ClassicAssert.IsNotNull(firstInstaller.Protocols, "Protocols for the first installer should not be null"); + ClassicAssert.IsTrue(firstInstaller.Protocols[0] == "fakeProtocol1", "Protocols for the first installer should be copied over from root"); + ClassicAssert.IsNotNull(firstInstaller.FileExtensions, "FileExtensions for the first installer should not be null"); + ClassicAssert.IsTrue(firstInstaller.FileExtensions[0] == ".exe", "FileExtensions for the first installer should be copied over from root"); // TODO: Uncomment when installer model gets updated to support markets field. - // Assert.IsNotNull(firstInstaller.Markets, "Markets for the first installer should not be null"); - Assert.IsNotNull(firstInstaller.UnsupportedOSArchitectures, "UnsupportedOSArchitectures for the first installer should not be null"); - Assert.IsTrue(firstInstaller.UnsupportedOSArchitectures[0] == UnsupportedOSArchitecture.Arm64, "UnsupportedOSArchitectures for the first installer should be copied over from root"); - Assert.IsNotNull(firstInstaller.InstallerSuccessCodes, "InstallerSuccessCodes for the first installer should not be null"); - Assert.IsTrue(firstInstaller.InstallerSuccessCodes[0] == 1, "InstallerSuccessCodes for the first installer should contain be copied over from root"); - Assert.IsNotNull(firstInstaller.UnsupportedArguments, "UnsupportedArguments for the first installer should not be null"); - Assert.IsTrue(firstInstaller.UnsupportedArguments[1] == UnsupportedArgument.Location, "UnsupportedArguments for the first installer should be copied over from root"); - Assert.IsNotNull(firstInstaller.InstallationMetadata, "InstallationMetadata for the first installer should not be null"); - Assert.IsTrue(firstInstaller.InstallationMetadata.DefaultInstallLocation == "%ProgramFiles%\\TestApp1", "DefaultInstallLocation for the first installer should be copied over from root"); + // ClassicAssert.IsNotNull(firstInstaller.Markets, "Markets for the first installer should not be null"); + ClassicAssert.IsNotNull(firstInstaller.UnsupportedOSArchitectures, "UnsupportedOSArchitectures for the first installer should not be null"); + ClassicAssert.IsTrue(firstInstaller.UnsupportedOSArchitectures[0] == UnsupportedOSArchitecture.Arm64, "UnsupportedOSArchitectures for the first installer should be copied over from root"); + ClassicAssert.IsNotNull(firstInstaller.InstallerSuccessCodes, "InstallerSuccessCodes for the first installer should not be null"); + ClassicAssert.IsTrue(firstInstaller.InstallerSuccessCodes[0] == 1, "InstallerSuccessCodes for the first installer should contain be copied over from root"); + ClassicAssert.IsNotNull(firstInstaller.UnsupportedArguments, "UnsupportedArguments for the first installer should not be null"); + ClassicAssert.IsTrue(firstInstaller.UnsupportedArguments[1] == UnsupportedArgument.Location, "UnsupportedArguments for the first installer should be copied over from root"); + ClassicAssert.IsNotNull(firstInstaller.InstallationMetadata, "InstallationMetadata for the first installer should not be null"); + ClassicAssert.IsTrue(firstInstaller.InstallationMetadata.DefaultInstallLocation == "%ProgramFiles%\\TestApp1", "DefaultInstallLocation for the first installer should be copied over from root"); // Fields for second installer should be preserved - Assert.IsTrue(secondInstaller.Scope == Scope.User, "Scope for the second installer should be preserved"); - Assert.IsTrue(secondInstaller.MinimumOSVersion == "10.0.17763.0", "MinimumOSVersion for the second installer should be preserved"); - Assert.IsTrue(secondInstaller.PackageFamilyName == "TestPackageFamilyName2", "PackageFamilyName for the second installer should be preserved"); - Assert.IsTrue(secondInstaller.UpgradeBehavior == UpgradeBehavior.UninstallPrevious, "UpgradeBehavior for the second installer should be preserved"); - Assert.IsTrue(secondInstaller.ElevationRequirement == ElevationRequirement.ElevatesSelf, "ElevationRequirement for the second installer should be preserved"); - Assert.IsTrue(secondInstaller.InstallerAbortsTerminal == false, "InstallerAbortsTerminal for the second installer should be preserved"); - Assert.IsTrue(secondInstaller.InstallLocationRequired == false, "InstallLocation for the second installer should be preserved"); - Assert.IsTrue(secondInstaller.RequireExplicitUpgrade == false, "RequireExplicitUpgrade for the second installer should be preserved"); - Assert.IsTrue(secondInstaller.DisplayInstallWarnings == false, "DisplayInstallWarnings for the second installer should be preserved"); - Assert.IsNotNull(secondInstaller.InstallerSwitches, "InstallerSwitches for the second installer should not be null"); - Assert.IsTrue(secondInstaller.InstallerSwitches.Silent == "/silent2", "Silent installer switch for the second installer should be preserved"); - Assert.IsNotNull(secondInstaller.Dependencies, "Dependencies for the second installer should not be null"); - Assert.IsTrue(secondInstaller.Dependencies.PackageDependencies[0].PackageIdentifier == "TestPackageDependency2", "PackageDependencies PackageIdentifier for the second installer should be preserved"); - Assert.IsNotNull(secondInstaller.AppsAndFeaturesEntries, "AppsAndFeaturesEntries for the second installer should not be null"); - Assert.IsTrue(secondInstaller.AppsAndFeaturesEntries[0].ProductCode == "TestProductCode2", "AppsAndFeaturesEntries ProductCode for the second installer should be preserved"); - Assert.IsNotNull(secondInstaller.Platform, "Platform for the second installer should not be null"); - Assert.IsTrue(secondInstaller.Platform[0] == Platform.Windows_Universal, "Platform for the second installer should be preserved"); - Assert.IsNotNull(secondInstaller.ExpectedReturnCodes, "ExpectedReturnCodes for the second installer should not be null"); - Assert.IsTrue(secondInstaller.ExpectedReturnCodes[0].InstallerReturnCode == 1002, "ExpectedReturnCodes InstallerReturnCode for the second installer should be preserved"); - Assert.IsNotNull(secondInstaller.Commands, "Commands for the second installer should not be null"); - Assert.IsTrue(secondInstaller.Commands[0] == "fakeCommand2", "Commands for the second installer should be preserved"); - Assert.IsNotNull(secondInstaller.Protocols, "Protocols for the second installer should not be null"); - Assert.IsTrue(secondInstaller.Protocols[0] == "fakeProtocol2", "Protocols for the second installer should be preserved"); - Assert.IsNotNull(secondInstaller.FileExtensions, "FileExtensions for the second installer should not be null"); - Assert.IsTrue(secondInstaller.FileExtensions[0] == ".msi", "FileExtensions for the second installer should be preserved"); + ClassicAssert.IsTrue(secondInstaller.Scope == Scope.User, "Scope for the second installer should be preserved"); + ClassicAssert.IsTrue(secondInstaller.MinimumOSVersion == "10.0.17763.0", "MinimumOSVersion for the second installer should be preserved"); + ClassicAssert.IsTrue(secondInstaller.PackageFamilyName == "TestPackageFamilyName2", "PackageFamilyName for the second installer should be preserved"); + ClassicAssert.IsTrue(secondInstaller.UpgradeBehavior == UpgradeBehavior.UninstallPrevious, "UpgradeBehavior for the second installer should be preserved"); + ClassicAssert.IsTrue(secondInstaller.ElevationRequirement == ElevationRequirement.ElevatesSelf, "ElevationRequirement for the second installer should be preserved"); + ClassicAssert.IsTrue(secondInstaller.InstallerAbortsTerminal == false, "InstallerAbortsTerminal for the second installer should be preserved"); + ClassicAssert.IsTrue(secondInstaller.InstallLocationRequired == false, "InstallLocation for the second installer should be preserved"); + ClassicAssert.IsTrue(secondInstaller.RequireExplicitUpgrade == false, "RequireExplicitUpgrade for the second installer should be preserved"); + ClassicAssert.IsTrue(secondInstaller.DisplayInstallWarnings == false, "DisplayInstallWarnings for the second installer should be preserved"); + ClassicAssert.IsNotNull(secondInstaller.InstallerSwitches, "InstallerSwitches for the second installer should not be null"); + ClassicAssert.IsTrue(secondInstaller.InstallerSwitches.Silent == "/silent2", "Silent installer switch for the second installer should be preserved"); + ClassicAssert.IsNotNull(secondInstaller.Dependencies, "Dependencies for the second installer should not be null"); + ClassicAssert.IsTrue(secondInstaller.Dependencies.PackageDependencies[0].PackageIdentifier == "TestPackageDependency2", "PackageDependencies PackageIdentifier for the second installer should be preserved"); + ClassicAssert.IsNotNull(secondInstaller.AppsAndFeaturesEntries, "AppsAndFeaturesEntries for the second installer should not be null"); + ClassicAssert.IsTrue(secondInstaller.AppsAndFeaturesEntries[0].ProductCode == "TestProductCode2", "AppsAndFeaturesEntries ProductCode for the second installer should be preserved"); + ClassicAssert.IsNotNull(secondInstaller.Platform, "Platform for the second installer should not be null"); + ClassicAssert.IsTrue(secondInstaller.Platform[0] == Platform.Windows_Universal, "Platform for the second installer should be preserved"); + ClassicAssert.IsNotNull(secondInstaller.ExpectedReturnCodes, "ExpectedReturnCodes for the second installer should not be null"); + ClassicAssert.IsTrue(secondInstaller.ExpectedReturnCodes[0].InstallerReturnCode == 1002, "ExpectedReturnCodes InstallerReturnCode for the second installer should be preserved"); + ClassicAssert.IsNotNull(secondInstaller.Commands, "Commands for the second installer should not be null"); + ClassicAssert.IsTrue(secondInstaller.Commands[0] == "fakeCommand2", "Commands for the second installer should be preserved"); + ClassicAssert.IsNotNull(secondInstaller.Protocols, "Protocols for the second installer should not be null"); + ClassicAssert.IsTrue(secondInstaller.Protocols[0] == "fakeProtocol2", "Protocols for the second installer should be preserved"); + ClassicAssert.IsNotNull(secondInstaller.FileExtensions, "FileExtensions for the second installer should not be null"); + ClassicAssert.IsTrue(secondInstaller.FileExtensions[0] == ".msi", "FileExtensions for the second installer should be preserved"); // TODO: Uncomment when installer model gets updated to support markets field. - // Assert.IsNotNull(secondInstaller.Markets, "Markets for the first installer should not be null"); - Assert.IsNotNull(secondInstaller.UnsupportedOSArchitectures, "UnsupportedOSArchitectures for the second installer should not be null"); - Assert.IsTrue(secondInstaller.UnsupportedOSArchitectures[0] == UnsupportedOSArchitecture.Arm, "UnsupportedOSArchitectures for the second installer should be preserved"); - Assert.IsNotNull(secondInstaller.InstallerSuccessCodes, "InstallerSuccessCodes for the second installer should not be null"); - Assert.IsTrue(secondInstaller.InstallerSuccessCodes[0] == 2, "InstallerSuccessCodes for the second installer should be preserved"); - Assert.IsNotNull(secondInstaller.UnsupportedArguments, "UnsupportedArguments for the second installer should not be null"); - Assert.IsTrue(secondInstaller.UnsupportedArguments[0] == UnsupportedArgument.Log, "UnsupportedArguments for the second installer should be preserved"); - Assert.IsNotNull(secondInstaller.InstallationMetadata, "InstallationMetadata for the second installer should not be null"); - Assert.IsTrue(secondInstaller.InstallationMetadata.DefaultInstallLocation == "%ProgramFiles%\\TestApp2", "DefaultInstallLocation for the second installer should be preserved"); + // ClassicAssert.IsNotNull(secondInstaller.Markets, "Markets for the first installer should not be null"); + ClassicAssert.IsNotNull(secondInstaller.UnsupportedOSArchitectures, "UnsupportedOSArchitectures for the second installer should not be null"); + ClassicAssert.IsTrue(secondInstaller.UnsupportedOSArchitectures[0] == UnsupportedOSArchitecture.Arm, "UnsupportedOSArchitectures for the second installer should be preserved"); + ClassicAssert.IsNotNull(secondInstaller.InstallerSuccessCodes, "InstallerSuccessCodes for the second installer should not be null"); + ClassicAssert.IsTrue(secondInstaller.InstallerSuccessCodes[0] == 2, "InstallerSuccessCodes for the second installer should be preserved"); + ClassicAssert.IsNotNull(secondInstaller.UnsupportedArguments, "UnsupportedArguments for the second installer should not be null"); + ClassicAssert.IsTrue(secondInstaller.UnsupportedArguments[0] == UnsupportedArgument.Log, "UnsupportedArguments for the second installer should be preserved"); + ClassicAssert.IsNotNull(secondInstaller.InstallationMetadata, "InstallationMetadata for the second installer should not be null"); + ClassicAssert.IsTrue(secondInstaller.InstallationMetadata.DefaultInstallLocation == "%ProgramFiles%\\TestApp2", "DefaultInstallLocation for the second installer should be preserved"); // Root fields should be null - Assert.IsNull(updatedInstallerManifest.Scope, "Scope at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.MinimumOSVersion, "MinimumOSVersion at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.PackageFamilyName, "PackageFamilyName at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.UpgradeBehavior, "UpgradeBehavior at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.ElevationRequirement, "ElevationRequirement at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.InstallerAbortsTerminal, "InstallerAbortsTerminal at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.InstallLocationRequired, "InstallLocation at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.RequireExplicitUpgrade, "RequireExplicitUpgrade at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.DisplayInstallWarnings, "DisplayInstallWarnings at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.InstallerSwitches, "InstallerSwitches at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.Dependencies, "Dependencies at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.AppsAndFeaturesEntries, "AppsAndFeaturesEntries at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.Platform, "Platform at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.ExpectedReturnCodes, "ExpectedReturnCodes at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.Commands, "Commands at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.Protocols, "Protocols at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.FileExtensions, "FileExtensions at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.Scope, "Scope at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.MinimumOSVersion, "MinimumOSVersion at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.PackageFamilyName, "PackageFamilyName at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.UpgradeBehavior, "UpgradeBehavior at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.ElevationRequirement, "ElevationRequirement at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.InstallerAbortsTerminal, "InstallerAbortsTerminal at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.InstallLocationRequired, "InstallLocation at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.RequireExplicitUpgrade, "RequireExplicitUpgrade at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.DisplayInstallWarnings, "DisplayInstallWarnings at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.InstallerSwitches, "InstallerSwitches at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.Dependencies, "Dependencies at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.AppsAndFeaturesEntries, "AppsAndFeaturesEntries at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.Platform, "Platform at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.ExpectedReturnCodes, "ExpectedReturnCodes at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.Commands, "Commands at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.Protocols, "Protocols at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.FileExtensions, "FileExtensions at the root level should be null"); // TODO: Uncomment when installer model gets updated to support markets field. - // Assert.IsNull(updatedInstallerManifest.Markets, "Markets at the root level should be null"); - Assert.IsNull(updatedInstallerManifest.UnsupportedOSArchitectures, "UnsupportedOSArchitectures at the installer level should be null"); - Assert.IsNull(updatedInstallerManifest.InstallerSuccessCodes, "InstallerSuccessCodes at the installer level should be null"); - Assert.IsNull(updatedInstallerManifest.UnsupportedArguments, "UnsupportedArguments at the installer level should be null"); - Assert.IsNull(updatedInstallerManifest.InstallationMetadata, "InstallationMetadata at the installer level should be null"); + // ClassicAssert.IsNull(updatedInstallerManifest.Markets, "Markets at the root level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.UnsupportedOSArchitectures, "UnsupportedOSArchitectures at the installer level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.InstallerSuccessCodes, "InstallerSuccessCodes at the installer level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.UnsupportedArguments, "UnsupportedArguments at the installer level should be null"); + ClassicAssert.IsNull(updatedInstallerManifest.InstallationMetadata, "InstallationMetadata at the installer level should be null"); // Fields that should be moved to root - Assert.IsTrue(updatedInstallerManifest.InstallerType == InstallerType.Zip, "InstallerType at the root level should be ZIP"); - Assert.IsTrue(updatedInstallerManifest.NestedInstallerType == NestedInstallerType.Exe, "NestedInstallerType at the root level should be EXE"); - Assert.IsNotNull(updatedInstallerManifest.NestedInstallerFiles, "NestedInstallerFiles at the root level should not be null"); - Assert.IsTrue(updatedInstallerManifest.NestedInstallerFiles[0].PortableCommandAlias == "TestAlias", "PortableCommandAlias at the root level should be TestAlias"); + ClassicAssert.IsTrue(updatedInstallerManifest.InstallerType == InstallerType.Zip, "InstallerType at the root level should be ZIP"); + ClassicAssert.IsTrue(updatedInstallerManifest.NestedInstallerType == NestedInstallerType.Exe, "NestedInstallerType at the root level should be EXE"); + ClassicAssert.IsNotNull(updatedInstallerManifest.NestedInstallerFiles, "NestedInstallerFiles at the root level should not be null"); + ClassicAssert.IsTrue(updatedInstallerManifest.NestedInstallerFiles[0].PortableCommandAlias == "TestAlias", "PortableCommandAlias at the root level should be TestAlias"); } /// @@ -1362,7 +1359,7 @@ public async Task UpdateZipInvalidRelativeFilePath() TestUtils.InitializeMockDownloads(TestConstants.TestZipInstaller); (UpdateCommand command, var initialManifestContent) = GetUpdateCommandAndManifestData("TestPublisher.InvalidRelativeFilePath", null, this.tempPath, null); var updatedManifests = await RunUpdateCommand(command, initialManifestContent); - Assert.IsNull(updatedManifests, "Command should have failed"); + ClassicAssert.IsNull(updatedManifests, "Command should have failed"); string result = this.sw.ToString(); Assert.That(result, Does.Contain(string.Format(Resources.NestedInstallerFileNotFound_Error, "fakeRelativeFilePath.exe")), "Failed to show warning for invalid relative file path."); } diff --git a/src/WingetCreateTests/WingetCreateTests/WingetCreateTests.csproj b/src/WingetCreateTests/WingetCreateTests/WingetCreateTests.csproj index a84a2de..769080a 100644 --- a/src/WingetCreateTests/WingetCreateTests/WingetCreateTests.csproj +++ b/src/WingetCreateTests/WingetCreateTests/WingetCreateTests.csproj @@ -12,11 +12,11 @@ - - - - - + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive