Questions tagged [mspec]

Machine.Specifications is a context/specification framework for C#. Not to be confused with the mspec Ruby framework (tag [mspec-ruby]) used in RubySpecs.

Machine.Specifications is a context/specification framework for C# geared towards removing language noise and simplifying tests.

215 questions
5
votes
4 answers

How to effectively test a fixed length flat file parser using MSpec?

I have this method signature: List Parse(string[] lines) ITMData has 35 properties. How would you effectively test such a parser? Questions: Should I load the whole file (May I use System.IO)? Should I put a line from the file into a…
Rookian
  • 19,841
  • 28
  • 110
  • 180
5
votes
2 answers

How do I integrate Machine.Specifications with ReSharper 6?

I'm using ReSharper 6 and I'm trying to get it to pick up my MSpec tests in the Resharper test runner. Unfortunately I can't seem to get this to work. I have copied the MSpec dll files (Machine.Specifications.dll and…
b3n
  • 3,805
  • 5
  • 31
  • 46
5
votes
1 answer

Rhino Mocks: stubbing value used in assertion?

First my question, and then some details: Q: Do I need to stub the value of a property when making sure its value is used in a subsequent assignment? Details: I'm using Rhino Mocks 3.5's AAA syntax in MSpec classes. I've trimmed the code below to…
lance
  • 16,092
  • 19
  • 77
  • 136
5
votes
2 answers

Comparing two lists with MSpec

Which method should I use to assert that two lists contains the same objects with MSpec?
W3Max
  • 3,328
  • 5
  • 35
  • 61
5
votes
2 answers

Why is this inherited Establish executed multiple times?

My understand is that each Establish should only be executed once, but the code below shows it executing multiple times. We're nesting the classes to provide some grouping while keeping the unit tests for a Subject in one file. This seems like it…
Andy
  • 8,432
  • 6
  • 38
  • 76
5
votes
1 answer

Testing ActionFilterAttributes with MSpec

I'm currently trying to grasp MSpec, mainly to learn new ways of (T/B)DD to be able to make an educated decision on which technology to use. Previously, I've mostly (read: only) used the built-in MSTest framework with Moq, so BDD is quite new for…
Tomas Aschan
  • 58,548
  • 56
  • 243
  • 402
5
votes
3 answers

DRY-ing very similar specs for ASP.NET MVC controller action with MSpec (BDD guidelines)

I have two very similar specs for two very similar controller actions: VoteUp(int id) and VoteDown(int id). These methods allow a user to vote a post up or down; kinda like the vote up/down functionality for StackOverflow questions. The specs…
Sergi Papaseit
  • 15,999
  • 16
  • 67
  • 101
5
votes
3 answers

Do I need NUnit now that I've migrated all my unit tests to MSpec?

I was doing TDD using NUnit. I was naming my NUnit tests in a behavioral style (like given, when, then). However I am now using MSpec for all my unit tests. I'm still writing tests first, using mocks, etc... so, they're still unit tests. But, I…
Martin
  • 23,844
  • 55
  • 201
  • 327
5
votes
2 answers

How do I break down a "full stack" feature into acceptance, integration, and unit tests?

I am new to Behavior Driven Development and I am trying to learn it. I am using MSpec & Watin for acceptance tests and MSpec for Unit tests with ASP.Net MVC 4. I have a simple scenario of user registration. When a user enters username, password,…
Afraz Ali
  • 2,672
  • 2
  • 27
  • 47
5
votes
0 answers

Why do I get MissingMethodException from MSpec on my TeamCity server?

Lately I've been having problems running my MSpec tests in the TeamCity build. This is happening on two different (unrelated) projects. Everything will work fine locally, but when the TeamCity build runs I get MissingMethodExceptions for some of the…
Tim Long
  • 13,508
  • 19
  • 79
  • 147
4
votes
0 answers

How do I integrate mSpec & ReSharper 7.0 in Visual Studio 11?

I've been trying to get these beta programs to work together. Resharper 7.0.3.261 runs just fine. After a nuget install of machine.specifications, I run the InstallResharperRunner.7.0 - VS2011.bat file which copies the mspec dll and…
Andy W
  • 41
  • 4
4
votes
2 answers

MSpec: How to make static variables thread-safe?

I'm using MSpec for my latest project, and overall I'm really happy with it. However, I do have an issue with concurrency when my tests run in paralel and I'm wondering if anybody has run into this issue or, even better, has a solution? MSpec…
user332133
  • 51
  • 1
  • 2
4
votes
2 answers

How do I get ReSharper to stop placing explicit access modifiers on my MSpec members?

I'm using Machine.Specifications and I'm really annoyed by how VS2010/Resharper keeps trying to format my code... for example: Establish context = () => the_cartoon_repository = DependencyOf>(); Gets turned…
chum of chance
  • 6,200
  • 10
  • 46
  • 74
4
votes
1 answer

How to write tests for ASP.NET MVC 3 AsyncControllers with MSpec

I want to write a TaskController for an ASP.NET MVC 3 application to some long running tasks, like sending a newsletter to the users of the site. I thought using an AsyncController would be appropriate as sending emails might take a while, and I…
Sergi Papaseit
  • 15,999
  • 16
  • 67
  • 101
4
votes
1 answer

BDD naming: when does it stop being about the user experience?

I'm drawn to MSpec with the hopes of one day sharing my test reports with non-developers*, but that is most valuable (right?) if I discuss the business (the user experience) in the test/scenario names (instead of the individual C# objects/members…
lance
  • 16,092
  • 19
  • 77
  • 136
1 2
3
14 15