master
  1<?xml version="1.0"?>
  2<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  3  <CodeSnippet Format="1.0.0">
  4    <Header>
  5      <Title>Model</Title>
  6      <Author>MbUnit</Author>
  7      <Description>Expansion snippet for a Model</Description>
  8      <Shortcut>model</Shortcut>
  9      <SnippetTypes>
 10        <SnippetType>Expansion</SnippetType>
 11      </SnippetTypes>
 12    </Header>
 13    <Snippet>
 14      <Declarations>
 15        <Literal>
 16          <ID>namespace</ID>
 17          <ToolTip>Model namespace</ToolTip>
 18        </Literal>
 19        <Literal>
 20          <ID>type</ID>
 21          <ToolTip>Modelled type</ToolTip>
 22          <Default>Put the modelled type here</Default>
 23        </Literal>
 24        <Literal>
 25          <ID>basetype</ID>
 26          <ToolTip>Modelled Base Type</ToolTip>
 27          <Default>Object</Default>
 28        </Literal>
 29      </Declarations>
 30      <Code Language="csharp"><![CDATA[using System;
 31using TestFu;
 32using TestFu.Models;
 33
 34namespace $namespace$
 35{
 36    /// <summary>
 37    /// A <see cref="IModel"/> implementation for the 
 38    /// <see cref="$type$"/> type.
 39    /// </summary>
 40    [Model(typeof($type$))]
 41    // [State("Put a state name here")]
 42    // [SubModel("Put a submodel name here")]
 43    public class $type$Model : $basetype$Model
 44    {
 45        #region Constructors
 46        /// <summary>
 47        /// Initializes a new <see cref="$name$Model"/> instance.
 48        /// </summary>
 49        public $type$Model()
 50        :base()
 51        {}
 52    
 53        /// <summary>
 54        /// Initializes a new <see cref="$name$Model"/> instance
 55        /// to model the <paramref name="modelledType"/> type.
 56        /// </summary>
 57        /// <param name="modelledType">
 58        /// Target <see cref="Type"/> of the model
 59        /// </param>
 60        public $type$Model(Type modelledType)
 61        :base(modelledType)
 62        {
 63            if (!typeof($type$).IsAssignableFrom(modelledType))
 64                throw new ArgumentException("$type$ is not assignable from "+modelledType.FullName,"modelledType");            
 65        }    
 66        #endregion
 67    
 68        #region Transitions
 69        [Transition]
 70        public void SampleTransition($type$ target)
 71        {
 72            throw new NotImplemented();
 73        }
 74     
 75        /// <summary>
 76        /// Gets the active <see cref="ITransition"/> instance for
 77        /// current <paramref name="target"/>.
 78        /// </summary>
 79        /// <param name="transitions">
 80        /// Collection of active <see cref="ITransition"/> names
 81        /// </param>
 82        /// <param name="target">
 83        /// Current tested instance
 84        /// </param>
 85        protected override void GetActiveTransitions(
 86            ITransitionNameCollection transitions,
 87            Object target
 88            )
 89        {
 90            base.GetActiveTransitions(transitions,target);
 91            $type$ current = ($type$)target;
 92    
 93            $end$
 94        }   
 95        #endregion
 96    }
 97}
 98	]]></Code>
 99    </Snippet>
100  </CodeSnippet>
101</CodeSnippets>