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
0
votes
2 answers

Running node script when starting .NET test suite

I'm looking for a way to connect a test neo4j db to my Mspec test suite. If found neodb. Is there a way that I can create a script that runs everytime the test suite is run?
Antarr Byrd
  • 24,863
  • 33
  • 100
  • 188
0
votes
1 answer

Why do I get a NullReferenceException in this MSpec test?

So I have these nuget packages installed: Culminating in these references: I use NCrunch. I have this spec: namespace GlobPatternMatching.Tests { using FluentAssertions; using Machine.Fakes; using Machine.Specifications; …
Callum Linington
  • 14,213
  • 12
  • 75
  • 154
0
votes
0 answers

How to test built in recursive manner class with mspec/rhino mocks

I have for example class public class Person { private Person Parent; private string Name; public Person(string Name, Person Parent) { if(Parent == null) { thrown new ArgumentNullException("Parent"); …
Inclouds
  • 1
  • 1
0
votes
1 answer

Unit test doesn't return result for joined tables

I encourage a problem when writing a unit tests which checks if function returns valid results while joining two tables. I have the following scenario: I have 2 tables, named they Folder and Item, Folder can has multiple items. Theirs DDL looks like…
MNie
  • 1,347
  • 1
  • 15
  • 35
0
votes
1 answer

Using Behaves_like on a Base Class

I would like to specify a Behaves_like on a base specification to ensure that a particular method is marked as virtual. Something like this: public abstract class command_handler_context :…
João Bragança
  • 1,353
  • 1
  • 13
  • 29
0
votes
2 answers

How do I write my first serious test with MSpec?

I am new to testing and have never used MSpec. I looked at tutorials and the only examples is "lite", like 1 + 1 should be 2. I need to test this real method and I don't know where to start. public ILineItem CreateLineItem(BaseVariationContent sku,…
Don Juan
  • 171
  • 2
  • 17
0
votes
0 answers

How do I write a spec for a DeleteWhere method?

I need to write a spec, for code coverage purposes, for one of our services. The method in question is: public void RemoveOpenMortgageLoanAccount(int accountNumber) { using (var db = this.dbFactory.NewDb().InAppContext()) { …
0
votes
0 answers

Why is OnAssemblyStart not being called with the latest MSpec/ReSharper?

We're using MSpec 0.9.3. After we upgraded to ReSharper 9.1, our tests started to fail. IAssemblyContext::OnAssemblyStart was no longer being called. This is a workaround: public class AllTests : IAssemblyContext { static AllTests() { …
Michael Blake
  • 2,068
  • 2
  • 18
  • 31
0
votes
1 answer

How do I get Intellisense inside Behavior classes using MSpec?

I´m using MSpec-Framework to implement BDD to our new project. I´m new to the concept of BDD and therefore MSpec as well and have problems to adress the object of interest (_obj2 in the example), at least Visual Studio intellisense doesn't propose…
krouch
  • 105
  • 9
0
votes
1 answer

NullReferenceException when testing DefaultModelBinder

I'm developing a project using BDD/TDD techniques and I'm trying my best to stay the course. A problem I just ran into is unit testing the DefaultModelBinder. I'm using mspec to write my tests. I have a class like this that I want to bind…
Byron Sommardahl
  • 12,743
  • 15
  • 74
  • 131
0
votes
1 answer

Reharper runner plugins for xunit and mspec simultaniously

I have successfully used the Resharper 4.5 runner for xunit tests in vs2008. Now I want to try out MSpec and I want to use the Resharper 4.5 runner for MSpec. But I have them both installed I get an error message when starting Visual Studio, that a…
asgerhallas
  • 16,890
  • 6
  • 50
  • 68
0
votes
1 answer

Machine Specifications - SerializationException after Because executes?

I'm having an issue writing a unit test with Machine.Specifications, also using Moq. When running the test either via Resharper 8 or with the mspec console running, I get a popup dialog from R# with the following error: [Window Title] Unit Test…
Andy
  • 8,432
  • 6
  • 38
  • 76
0
votes
1 answer

How does this MSpec/NSubstitute test pass when the Subject has no implementation?

I am trying to assert that a method was called in MSpec while using NSubstitute as the mocking framework. The Subject has an empty implementation of ExecuteAll(). It should fail, but it passes! public class…
4imble
  • 13,979
  • 15
  • 70
  • 125
0
votes
1 answer

Moq WCF service doesn't return value

My problem is mocked object doesn't return the value it return null instead My MSpec UnitTest as follows public class With_Fake_Data_Service { protected static Mock _fakeDataService; protected static FaultContract…
AllSpark
  • 425
  • 1
  • 4
  • 17
0
votes
1 answer

How do I configure log4net when unit testing with MSpec?

I am trying to retire my in-house logging utility in favour of something 'off the peg', specifically log4net. I have it all working, except that I can't get it to work when I'm running my tests (specifications) in the ReSharper test runner. I'm…
Tim Long
  • 13,508
  • 19
  • 79
  • 147
1 2 3
14
15