Moq2NSubstitute 0.1.5

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global Moq2NSubstitute --version 0.1.5
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local Moq2NSubstitute --version 0.1.5
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=Moq2NSubstitute&version=0.1.5
nuke :add-package Moq2NSubstitute --version 0.1.5

moq-to-nsub

What is this?

Super simple tool for converting a test project from moq to nsubstitute

What's included

A command line tool with a single command, convert

Give it a path that contains test files, it'll perform some regex replaces to switch syntax to NSubstitute.

Many thanks to @AlbertoMonteiro for the RegEx work at https://gist.github.com/AlbertoMonteiro/daeab549df57727ddaa7

Usage

The root command is named moq2nsub, Only one sub-command is available at this time

moq2nsub convert --project-path C:\src\my-path-that-contains-unit-tests 

--project-path - should be the path where a csproj file exists that contains unit tests.

What does this do?

The tool will scan the path you provide for all *.cs files, and will then run a number of find and replace regular expressions to convert from Moq syntax to NSubstitute. After performing find and replace operations, it will run a dotnet command to uninstall moq and install nsubstitute.

Important - make sure your files are source controlled. The tool will overwrite files with the changes, so have a simple rollback plan if you don't like the output

Contributing

Any contributions welcome, especially any new Regex

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
0.1.6 305 8/26/2023
0.1.5 280 8/12/2023
0.1.4 196 8/11/2023
0.1.3 222 8/11/2023
0.1.2 281 8/11/2023
0.1.0 239 8/11/2023