PowerShell cmdlets can be written in C# by inheriting either form the Cmdlet
class or the PSCmdlet
class. In short, the difference between both classes are the level of dependence to the PowerShell runspace. The Cmdlet
-class is less tighly coupled to the PowerShell runspace, than the PSCmdlet
class. A more in-depth comparison between both classes can be found here.
One important difference between both classes are the requirements for automated testing. The Cmdlet
class can be easily invoked in C#, while the PSCmdlet
class requires to be run in a PowerShell runspace. A great description about the two testing variations can be found in the course by Nathan Honeycutt "PowerShell Cmdlet Development in C# - The Ins and Outs".
In general, I use for automated testing the XUnit framework.