Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Snippet for VS2017 to add mocking object properties faster.
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets
xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Add Mock</Title>
<Author>Hyston</Author>
<Description>Add mock property.</Description>
<Shortcut>mock</Shortcut>
</Header>
<Snippet>
<Imports>
<Import>
<Namespace>Moq</Namespace>
</Import>
</Imports>
<Declarations>
<Literal>
<ID>MockedClass</ID>
<ToolTip>Replace with a class name, that should be mocked.</ToolTip>
<Default>Foo</Default>
</Literal>
</Declarations>
<Code Language="CSharp">
<![CDATA[public Mock<$MockedClass$> $MockedClass$Mock = new Mock<$MockedClass$>();]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment