summaryrefslogtreecommitdiff
path: root/tools/MbUnit/VSSnippets/MbUnitVBSnippets/model.snippet
blob: 354083cfe4407f5686194542f03f3e1874011cca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?xml version="1.0"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>Model</Title>
      <Description>Expansion snippet for a Model</Description>
      <Shortcut>model</Shortcut>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
    </Header>
    <Snippet>
      <Declarations>
        <Literal>
          <ID>namespace</ID>
          <ToolTip>Model namespace</ToolTip>
          <Default>MbUnitTests</Default>
        </Literal>
        <Literal>
          <ID>type</ID>
          <ToolTip>Modelled type</ToolTip>
          <Default>Put the modelled type here</Default>
        </Literal>
        <Literal>
          <ID>basetype</ID>
          <ToolTip>Modelled Base Type</ToolTip>
          <Default>Object</Default>
        </Literal>
      </Declarations>
      <Code Language="VB"><![CDATA[Imports System
Imports TestFu
Imports TestFu.Models

Namespace $namespace$
    ''' <summary>
    ''' A IModel implementation for the $type$ type.
    ''' </summary>
	' <State("Put a state name here")>
    ' <SubModel("Put a submodel name here")>
    <Model(GetType($type$))> _    
    Public Class $type$Model
		Inherits $basetype$Model

        #Region "Constructors"
        ''' <summary>
        ''' Initializes a new $type$Model instance.
        ''' </summary>
        Public Sub New()

		End Sub
    
        ''' <summary>
        ''' Initializes a new "$name$Model" instance to model the modelledType type.
        ''' </summary>
        ''' <param name="modelledType">
        ''' Target Type of the model
        ''' </param>
        Public Sub New(ByVal modelledType As Type)
			MyBase.New(modelledType)
            If Not GetType($type$).IsAssignableFrom(modelledType)
                Throw New ArgumentException("$type$ is not assignable from "+modelledType.FullName,"modelledType")
			End If
        End Sub   
        #End Region
    
        #Region "Transitions"
        <Transition()> _
        Public Sub SampleTransition(ByVal target As $type$)
            Throw New NotImplementedException()
        End Sub
     
        ''' <summary>
        ''' Gets the active ITransition instance for current target.
        ''' </summary>
        ''' <param name="transitions">
        ''' Collection of active ITransition names
        ''' </param>
        ''' <param name="target">
        ''' Current tested instance
        ''' </param>
        Protected Overrides Sub GetActiveTransitions( _
            ByVal transitions as ITransitionNameCollection , _
            ByVal target as Object)

            MyBase.GetActiveTransitions(transitions,target)
            Dim current As $type$ = DirectCast(target, $type$)

		End Sub
        #End Region
    End Class
End Namespace
	]]></Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>