Created
August 9, 2023 15:15
-
-
Save abrugsch/d0bc8e73743f3a44e1026c67ade2ac2c to your computer and use it in GitHub Desktop.
remove moq
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
replaces about 75% of moq calls with NSubstitute equivalents (taken from the moq issue thread discussing open source funding) | |
Replace "using Moq;" with "using NSubstitute;" (non-regex) | |
Replace "new Mock<(.*?)>()" with "Substitute.For<$1>()" (Regex) | |
Replace "Mock<(.*?)>" with "$1" (Regex) | |
Replace ".Setup(x => x." with "." (non-regex) | |
Replace ").ReturnsAsync(" with ".Returns(" (non-regex) | |
Replace "It.IsAny<" with "Arg.Any<" (non-regex) | |
Replace "It.IsAny<" with "Arg.Any<" (non-regex) | |
Replace "(\w+.)Verify(x => x.(\w+)((.*?)), Times.Once())" with "await $1Received(1).$2($3)" (Regex) | |
Replace "(\w+.)Verify(x => x.(\w+)((.*?)), Times.Never())" With "await $1Received(0).$2($3)" (Regex) | |
Replace ".Object," with "," (non-regex) | |
Replace ".Object);" with ");" (non-regex) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
source: https://github.com/moq/moq/issues/1374#issuecomment-1671241122