Closed lmalenfant closed 1 year ago
Using Visual Studio's "Replace in Files", I used the following replacements with and without regular expressions.
Replace "It.IsAny" with "Arg.Any"
Replace It.Is" with "Arg.Is"
Use regular expressions: Replace "new Mock(?<type>.+)(( |\r|\n)+)\{(( |\r|\n)*)CallBase = true(( |\r|\n)*)\};" with "Substitute.ForPartsOf${type};"
Replace "new Mock(?<type>.+)(( |\r|\n)+)\{(( |\r|\n)*)CallBase = true(( |\r|\n)*)\};" with "Substitute.ForPartsOf${type};"
Replace "new Mock" with "Substitute.For"
Use regular expressions: Replace "Mock<(?<type>.+)>" with "${type}"
Replace "Mock<(?<type>.+)>" with "${type}"
Use regular expressions: Replace "(?<start>.+)\.Setup\(x => x(?<middle>.+)\)(( |\r|\n)*)\.Returns(?<end>(( |\r|\n)*))" with "${start}${middle}.Returns${end}" Replace "(?<start>.+)\.SetupGet\(x => x(?<middle>.+)\)(( |\r|\n)*)\.Returns(?<end>(( |\r|\n)*))" with "${start}${middle}.Returns${end}"
Replace "(?<start>.+)\.Setup\(x => x(?<middle>.+)\)(( |\r|\n)*)\.Returns(?<end>(( |\r|\n)*))" with "${start}${middle}.Returns${end}"
Replace "(?<start>.+)\.SetupGet\(x => x(?<middle>.+)\)(( |\r|\n)*)\.Returns(?<end>(( |\r|\n)*))" with "${start}${middle}.Returns${end}"
Use regular expressions: Replace "(?<start>.+)\.Verify\(x => x(?<middle>((.|\r|\n)+))(( |\r|\n)*)\, Times.Once\)(?<end>.+)" with "${start}.Received(1)${middle}${end}" Replace "(?<start>.+)\.Verify\(x => x(?<middle>((.|\r|\n)+))(( |\r|\n)*)\, Times.Exactly\((?<times>.+)\)\)(?<end>.+)" with "${start}.Received(${times})${middle}${end}" Replace "(?<start>.+)\.Verify\(x => x(?<middle>((.|\r|\n)+))(( |\r|\n)*)\, Times.Never\)(?<end>.+)" with "${start}.DidNotReceive()${middle}${end}"
Replace "(?<start>.+)\.Verify\(x => x(?<middle>((.|\r|\n)+))(( |\r|\n)*)\, Times.Once\)(?<end>.+)" with "${start}.Received(1)${middle}${end}"
Replace "(?<start>.+)\.Verify\(x => x(?<middle>((.|\r|\n)+))(( |\r|\n)*)\, Times.Exactly\((?<times>.+)\)\)(?<end>.+)" with "${start}.Received(${times})${middle}${end}"
Replace "(?<start>.+)\.Verify\(x => x(?<middle>((.|\r|\n)+))(( |\r|\n)*)\, Times.Never\)(?<end>.+)" with "${start}.DidNotReceive()${middle}${end}"
Other useful regular expressions: Replace "\r\n *\." with "." - Removes line breaks
Replace "\r\n *\." with "." - Removes line breaks
Using Visual Studio's "Replace in Files", I used the following replacements with and without regular expressions.
Replace "It.IsAny" with "Arg.Any"
Replace It.Is" with "Arg.Is"
Use regular expressions:
Replace "new Mock(?<type>.+)(( |\r|\n)+)\{(( |\r|\n)*)CallBase = true(( |\r|\n)*)\};" with "Substitute.ForPartsOf${type};"
Replace "new Mock" with "Substitute.For"
Use regular expressions:
Replace "Mock<(?<type>.+)>" with "${type}"
Use regular expressions:
Replace "(?<start>.+)\.Setup\(x => x(?<middle>.+)\)(( |\r|\n)*)\.Returns(?<end>(( |\r|\n)*))" with "${start}${middle}.Returns${end}"
Replace "(?<start>.+)\.SetupGet\(x => x(?<middle>.+)\)(( |\r|\n)*)\.Returns(?<end>(( |\r|\n)*))" with "${start}${middle}.Returns${end}"
Use regular expressions:
Replace "(?<start>.+)\.Verify\(x => x(?<middle>((.|\r|\n)+))(( |\r|\n)*)\, Times.Once\)(?<end>.+)" with "${start}.Received(1)${middle}${end}"
Replace "(?<start>.+)\.Verify\(x => x(?<middle>((.|\r|\n)+))(( |\r|\n)*)\, Times.Exactly\((?<times>.+)\)\)(?<end>.+)" with "${start}.Received(${times})${middle}${end}"
Replace "(?<start>.+)\.Verify\(x => x(?<middle>((.|\r|\n)+))(( |\r|\n)*)\, Times.Never\)(?<end>.+)" with "${start}.DidNotReceive()${middle}${end}"
Other useful regular expressions:
Replace "\r\n *\." with "." - Removes line breaks