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
3
votes
3 answers

How do I include specs for a base class in the specs for an inherited class?

I have an RSSDataSourceParser class which is fully covered by MSpec specifications. I also have an inherited class, MultimediaRSSDataSourceParser. It does all of the parent functionality plus recognition of iTunes RSS extensions. I covered the…
3
votes
2 answers

What Invokes and distinguishes "It", "Because" and "Establish"

I've started using MSpec recently, breaking classes into, Establish, Because and, It. Although I know how to use them, I'm not sure what goes into making them work. I know they are delegates Because of = () => { }; But when looking at how…
Kieran
  • 612
  • 6
  • 22
3
votes
1 answer

C# in my unit test i want to see if it is null or an empty string

I'm using Machine spec / Shouldly and testing a mapping profile (mundane work). The mapping expectations are sometimes inconsistent. Sometimes I am seeing an "" explicit empty string get returned and sometimes it's a null value. Since we're mapping…
mche
  • 616
  • 10
  • 16
3
votes
1 answer

Converting MSpec tests to plain NUnit

I am trying to get started with pure TDD and also consider the BDD flavor. I am trying to grasp, how writing unit tests with MSpec feels in contrast pure to NUnit. Consider a simple MSpec test like the following: [Subject("PersonRepository")] class…
bitbonk
  • 48,890
  • 37
  • 186
  • 278
3
votes
2 answers

How to develop input object with TDD / BDD?

I have a method called ProcessPayment() that I'm developing via BDD and mspec. I need help with a new challenge. My user story says: Given a payment processing context, When payment is processed with valid payment information, Then it should return…
Byron Sommardahl
  • 12,743
  • 15
  • 74
  • 131
3
votes
1 answer

Why does this simple MSpec test return inconclusive?

I am using Mspec with FakeItEasy and I keep getting inconclusive test results. I tried commenting out my fake setup code and even the actual invocation of the method under test. I'm also unable to debug the test. I also just tried a simple test like…
Adam
  • 4,590
  • 10
  • 51
  • 84
3
votes
0 answers

How to profile a MSpec test

I've run dotTrace and Visual Studio profiler against a MSpec test, but so far I haven't been able to get any information about the code that is being tested, only about the code of the test itself. Is there a way to do this? My guess is using…
Javier Holguera
  • 1,301
  • 2
  • 11
  • 27
3
votes
1 answer

Can MSpec Test Adapter in Visual Studio run behaviours?

I'm setting up continuous build in TFS 2013. The build has been configured to run MSpec tests by using the dlls in the MSpec Test Adapter. After much struggle it is working but the Test Adapter can't run MSpec behaviours. To be fair this isn't a TFS…
3
votes
2 answers

Is mspec better with or without nunit?

I've seen mspec used with nunit on some blogs and discussions. In fact, most of the examples on the web that I've seen demonstrate mspec with some kind of nunit dependancy or integration. My team is attempting to use mspec without nunit on a new…
Byron Sommardahl
  • 12,743
  • 15
  • 74
  • 131
3
votes
1 answer

When using a mocking framework and MSPEC where do you set your stubs

I am relatively new to using MSpec and as I write more and more tests it becomes obvious to reduce duplication you often have to use a base class for your setup as per Rob Conery's article I am happy with using the AssertWasCalled method to verify…
Kev Hunter
  • 2,565
  • 4
  • 25
  • 39
3
votes
1 answer

How do I configure Visual Studio Online to run a custom unit test framework?

I'm trying to make the Visual Studio Online build service run my nSpec tests. I've downloaded the nSpec test adapter (which works fine locally), unzipped the DLLs and uploaded those to a separate TFS repository. I've configured the hosted build…
EMB
  • 171
  • 1
  • 7
3
votes
1 answer

Machine.Specifications and Entity Framework Examples

I'm trying to find some best-practice examples (or any examples, actually) of using Machine.Specifications with the ASP.Net Entity Framework in an MVC project. Not having had much experience with Machine.Specifications, I'm keen to see what sort of…
Phil.Wheeler
  • 16,748
  • 10
  • 99
  • 155
3
votes
1 answer

How to implement BDD on very complex business rules?

I am learning the art of Unit Testing and BDD and in my company there is no one who follows this approach. I try a lot to learn it by myself but get stuck somewhere and give up after trying for a few days. After some time I get inspiration again…
Afraz Ali
  • 2,672
  • 2
  • 27
  • 47
3
votes
1 answer

Why am I getting a MissingMethodException for get_ConsoleOut() in MSpec?

I've created many MSpec classes before but running unit tests in a file I created recently gave the below error. Has anyone encountered this with their unit tests? System.MissingMethodException: Method not found: 'System.String…
Adam
  • 4,590
  • 10
  • 51
  • 84
3
votes
1 answer

How to run mspec with resharper runner in STAThread mode

I just updated to Visual Studio 2013, ReSharper 8.0.2 and mspec to the latest version. It was working fine running all the unit tests that some of the tests are creating UI controls that needs to be STAThread. Don't ask me why some of the tests are…
123 456 789 0
  • 10,565
  • 4
  • 43
  • 72