MSpec Live Templates

 

If you’re using MSpec (Machine.Specifications), you’ve no doubt run into the verbosity of it. Here’s a typical specification in MSpec

  1. [Subject("Registering as new a usergroup")]
  2. public class when_requesting_registration_page
  3. {
  4.     Establish context = () =>
  5.     {
  6.     };
  7.  
  8.     Because of = () =>
  9.     {
  10.     };
  11.  
  12.     It should_display_blank_registration_form = () =>
  13.     {
  14.     };
  15. }

 

The code is usually divided into three areas, the Establish that defines the context, Because which is defined as the action to take, and finally one or more benefits that are defined as It sections. Having this layout makes it easier to understand specifications and both the console runner as well as ReSharper’s MSpec runner remove underscores and provide a nice formatting.

Live Templates

However when it comes to typing all this in, well all those brackets and symbols become tiring. For that I normally use ReSharper Live Templates. If you’re not familiar with these, think of them as code snippets that allow interaction. Each template is uniquely identified by a shortcut, which is a series of characters. To invoke it, you simply type the characters and hit TAB. It then inserts some code. Up to this point it’s like a normal snippet. The twist however is that you can then TAB through placeholders and define values (I’ll cover  Live Templates and all the possibilities it allows in a future post).

image

What I’ve been using for a while are some Live Templates for MSpec that allow me to define specifications with a little less effort. The first one is for empty specifications, which is useful for defining scenarios for features and then later proceeding to implement them, named espec. The second one is for the specifications and implementation, named spec.

image

To install them, the easiest way is to just open up Live Templates (ReSharper menu) and Import the following file.

.

image

Obviously these are just two simple versions and can be expanded on. For instance, if you use Behaviors in MSpec, you could write an additional one for that. Feel free to use them for your own needs.


Posted 03-01-2010 4:07 PM by Hadi Hariri
Filed under: ,

[Advertisement]

Comments

cheap backlinks wrote re: MSpec Live Templates
on 01-18-2013 7:32 AM

N9qfsr Great article post.Really looking forward to read more. Much obliged.

discount imitrex wrote re: MSpec Live Templates
on 01-27-2013 1:28 AM

kK9vha Really enjoyed this post.Really looking forward to read more.

buy viagra online wrote re: MSpec Live Templates
on 02-02-2013 12:42 PM

6YAhHC Thanks for sharing, this is a fantastic article post.Thanks Again. Really Cool.

buy discount viagra wrote re: MSpec Live Templates
on 02-03-2013 3:57 AM

v7xn8l A round of applause for your article post.Much thanks again.

buy stendra wrote re: MSpec Live Templates
on 02-23-2013 10:17 PM

puaGCZ Thanks again for the blog article.Thanks Again. Really Cool.

http://clomidnoprescription.beep.com/ wrote re: MSpec Live Templates
on 02-24-2013 7:55 PM

9v8KTM Enjoyed every bit of your blog article.Much thanks again. Much obliged.

Clomiphene 50 mg wrote re: MSpec Live Templates
on 02-27-2013 7:50 PM

aS3qJn A big thank you for your blog post.Thanks Again. Really Great.

clomiphene 25 mg wrote re: MSpec Live Templates
on 02-28-2013 6:20 AM

ShUdgY I really love this post I will visit again to read your post in a very short time and I hope you will make more posts like this.

click here wrote re: MSpec Live Templates
on 03-02-2013 6:09 PM

r4qJ4J This is one awesome blog.Much thanks again. Really Great.

buy discount viagra online wrote re: MSpec Live Templates
on 03-03-2013 10:34 AM

rLdxo8 I am so grateful for your post.Really looking forward to read more. Cool.

bookmarks wrote re: MSpec Live Templates
on 03-13-2013 10:20 PM

vHfs0W A big thank you for your blog post.Really thank you! Really Great.

buy social bookmarks wrote re: MSpec Live Templates
on 03-23-2013 8:32 AM

Eiiqw4 Say, you got a nice blog article.Really looking forward to read more. Much obliged.

Social bookmarks wrote re: MSpec Live Templates
on 03-24-2013 2:31 PM

vRhkiM Appreciate you sharing, great post.Much thanks again. Great.

social bookmarking service wrote re: MSpec Live Templates
on 04-04-2013 2:11 AM

6HBKzz I cannot thank you enough for the blog post.Thanks Again. Great.

stoner wrote re: MSpec Live Templates
on 04-06-2013 2:23 AM

I really enjoy the article.Much thanks again. Great.

bears wrote re: MSpec Live Templates
on 04-06-2013 3:21 PM

Im thankful for the article.Much thanks again. Great.

buy social bookmarks wrote re: MSpec Live Templates
on 04-14-2013 6:22 AM

WIWjFZ Really informative article.Really thank you! Keep writing.

Social bookmarks wrote re: MSpec Live Templates
on 04-19-2013 6:28 PM

4HJpoU Fantastic blog article.Thanks Again. Keep writing.

Social bookmarks wrote re: MSpec Live Templates
on 04-23-2013 9:50 AM

sYTwoi Very good post.Really looking forward to read more. Will read on...

social bookmarking service wrote re: MSpec Live Templates
on 06-06-2013 5:40 AM

fmRB06 I cannot thank you enough for the blog article.Really looking forward to read more.

best social bookmarks wrote re: MSpec Live Templates
on 06-19-2013 1:08 PM

EsFCR3 Thanks so much for the article.Thanks Again. Want more.

cheap bookmarks wrote re: MSpec Live Templates
on 06-21-2013 12:10 AM

UMRQCh Thanks a lot for the blog post.Much thanks again. Will read on...

news wrote re: MSpec Live Templates
on 07-09-2013 8:29 AM

tOZdHx Wow, great blog.Really thank you! Really Great.

best news of them all wrote re: MSpec Live Templates
on 08-04-2013 2:46 PM

PfotIg Great, thanks for sharing this article post.Thanks Again. Really Cool.

awesome links for you wrote re: MSpec Live Templates
on 08-19-2013 12:59 PM

3sdsHL I appreciate you sharing this blog article.Much thanks again. Fantastic.

great link buildng wrote re: MSpec Live Templates
on 08-22-2013 6:31 AM

weC7O6 wow, awesome article.Thanks Again.

best link building wrote re: MSpec Live Templates
on 09-03-2013 7:45 PM

mQObvc Really informative post.

seo service wrote re: MSpec Live Templates
on 09-07-2013 11:08 PM

OizVci Thanks a lot for the post.Really thank you! Keep writing.

only for 5 dollars wrote re: MSpec Live Templates
on 09-12-2013 3:31 PM

BxflZR Enjoyed every bit of your article post.Really thank you! Will read on...

awesome linkbuilding site wrote re: MSpec Live Templates
on 09-30-2013 10:49 PM

QR0mc3 Thanks for the article.Really thank you! Much obliged.

best link build wrote re: MSpec Live Templates
on 10-15-2013 8:33 PM

nOQwP8 Thanks for the article post.Really looking forward to read more. Really Great.

take a look at it! wrote re: MSpec Live Templates
on 10-25-2013 10:43 AM

3ktbxV Thanks a lot for the post.Really thank you! Awesome.

watch this pls wrote re: MSpec Live Templates
on 11-18-2013 6:40 AM

1nlxvY This is one awesome blog post.

watch this wrote re: MSpec Live Templates
on 11-18-2013 8:20 AM

ztIhUr I really liked your article.Really thank you! Really Great.

nice seo guys wrote re: MSpec Live Templates
on 11-20-2013 7:37 PM

7lpw5v Really enjoyed this article post.Much thanks again. Really Cool.

you want this now wrote re: MSpec Live Templates
on 12-14-2013 7:48 PM

nQVSCy Major thanks for the blog.Really thank you! Want more.

awesome things! wrote re: MSpec Live Templates
on 01-09-2014 4:01 AM

88jAMB Very neat blog article. Keep writing.

awesome things! wrote re: MSpec Live Templates
on 01-09-2014 10:22 PM

iTjUaY I truly appreciate this blog.Thanks Again. Really Cool.

nice seo guys wrote re: MSpec Live Templates
on 01-16-2014 4:48 PM

xpWm6m Really informative blog.Really looking forward to read more. Want more.

stunning seo guys wrote re: MSpec Live Templates
on 01-30-2014 6:53 PM

Th8LsX Really informative post. Really Great.

awesome things! wrote re: MSpec Live Templates
on 02-07-2014 6:51 PM

fuoEJ7 I really like and appreciate your article post.Really looking forward to read more. Really Great.

check out this wrote re: MSpec Live Templates
on 03-12-2014 4:30 PM

rjaSih A round of applause for your blog post.Really thank you! Really Cool.

seo for cheap wrote re: MSpec Live Templates
on 03-22-2014 3:55 PM

gCPaq6 Im thankful for the blog article.Much thanks again. Much obliged.

seo for cheap wrote re: MSpec Live Templates
on 04-01-2014 11:16 AM

pdyUwn Im thankful for the post.Really looking forward to read more. Will read on...

check this out now wrote re: MSpec Live Templates
on 04-05-2014 8:37 AM

ql6G5k I really liked your article post.Really thank you! Want more.

Add a Comment

(required)  
(optional)
(required)  
Remember Me?

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)