mirror of
https://github.com/aphrody-labs/NuGet.Client.git
synced 2026-10-15 13:59:49 +00:00
Resolves NuGet/Home#5258. Added tests for basic scenarios per each project model supporting LSL mode: `packages.config`, `project.json`, `PackageRef`. Updated E2E test infrastructure to support test extension cmdlets and running "theories". Added ability to skip tests for specific VS version. Also added missing templates for unit-test project and native C++ console application. Addressed PR feedback
51 lines
1.4 KiB
C#
51 lines
1.4 KiB
C#
// Copyright (c) .NET Foundation. All rights reserved.
|
|
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
|
|
using System;
|
|
using System.Management.Automation;
|
|
using Microsoft;
|
|
using Microsoft.VisualStudio.Shell;
|
|
using Task = System.Threading.Tasks.Task;
|
|
|
|
namespace API.Test.Cmdlets
|
|
{
|
|
public abstract class TestExtensionCmdlet : Cmdlet
|
|
{
|
|
public string CmdletName { get; }
|
|
|
|
protected TestExtensionCmdlet()
|
|
{
|
|
var attribute = Attribute.GetCustomAttribute(GetType(), typeof(CmdletAttribute), inherit: true) as CmdletAttribute;
|
|
Assumes.NotNull(attribute);
|
|
CmdletName = $"{attribute.VerbName}-{attribute.NounName}";
|
|
}
|
|
|
|
protected override void ProcessRecord()
|
|
{
|
|
ThreadHelper.JoinableTaskFactory.Run(() => ProcessRecordAsync());
|
|
}
|
|
|
|
protected override void BeginProcessing()
|
|
{
|
|
WriteVerbose($"{CmdletName}: Begin");
|
|
|
|
base.BeginProcessing();
|
|
}
|
|
|
|
protected override void EndProcessing()
|
|
{
|
|
WriteVerbose($"{CmdletName}: End");
|
|
|
|
base.EndProcessing();
|
|
}
|
|
protected override void StopProcessing()
|
|
{
|
|
WriteVerbose($"{CmdletName}: Stop");
|
|
|
|
base.StopProcessing();
|
|
}
|
|
|
|
protected abstract Task ProcessRecordAsync();
|
|
}
|
|
}
|