Created
December 6, 2012 04:41
-
-
Save srsgores/4221814 to your computer and use it in GitHub Desktop.
sengtest
This file contains 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
<?xml version="1.0" encoding="utf-8" ?> | |
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> | |
<CodeSnippet Format="1.0.0"> | |
<Header> | |
<Title>C# Unit Test Method</Title> | |
<Shortcut>testmethod</Shortcut> | |
<Description>Code snippet for creating an NUnit unit test in C#</Description> | |
<Author>Sean Goresht</Author> | |
<SnippetTypes> | |
<SnippetType>Expansion</SnippetType> | |
</SnippetTypes> | |
</Header> | |
<Snippet> | |
<Declarations> | |
<Literal> | |
<ID>summary</ID> | |
<ToolTip>Provide a description of what your test should reveal. This is important for documentation.</ToolTip> | |
<Default>Put a summary here</Default> | |
</Literal> | |
<Literal> | |
<ID>name</ID> | |
<ToolTip>Provide a test name to identify what the test will actually test.</ToolTip> | |
<Default>TestName</Default> | |
</Literal> | |
<Literal> | |
<ID>description</ID> | |
<ToolTip>Test Case</ToolTip> | |
<Default>Assumption_Does_Expectation</Default> | |
</Literal> | |
<Literal> | |
<ID> | |
exceptionType | |
</ID> | |
<ToolTip> | |
Provide the type of error expected when this test fails. | |
</ToolTip> | |
<Default> | |
ArgumentException | |
</Default> | |
</Literal> | |
<Literal> | |
<ID> | |
errorMessage | |
</ID> | |
<ToolTip> | |
Provide a message which will be displayed in the Console when the test fails. | |
</ToolTip> | |
<Default> | |
Invalid arguments. | |
</Default> | |
</Literal> | |
<Literal> | |
<ID> | |
testInitialization | |
</ID> | |
<ToolTip> | |
Usually the instantiation of a class. | |
</ToolTip> | |
<Default>System exampleSystem = new System();</Default> | |
</Literal> | |
<Literal> | |
<ID> | |
testActions | |
</ID> | |
<ToolTip> | |
Usually performing the actions on an object. | |
</ToolTip> | |
<Default>exampleSystem.performAction();</Default> | |
</Literal> | |
<Literal> | |
<ID> | |
testAssert | |
</ID> | |
<ToolTip> | |
Set up the expected values for the test. | |
</ToolTip> | |
<Default>Assert.AreEqual(true, success);</Default> | |
</Literal> | |
</Declarations> | |
<Code Language="csharp"><![CDATA[ ///<summary> | |
/// $summary$ | |
///</summary> | |
[Test] | |
[ExpectedException(typeof ($exceptionType$), "$errorMessage$")] | |
public void $name$_When_$description$() | |
{ | |
// Arrange | |
$testInitialization$ | |
// Perform actions | |
$testActions$ | |
// Assert | |
$testAssert$ | |
} | |
$end$]]> | |
</Code> | |
</Snippet> | |
</CodeSnippet> | |
</CodeSnippets> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment