7

I'm trying to use Mspec's ShouldBeOfType<T>() assertion extension method, but intellisense says that it can't find it. I'm using MSpec v0.7.0. I tried reinstalling using Nuget but didn't work.

[Subject("Prop Manager")]
public class When_Replying_To_Prop_Which_Already_Had_Emailed_And_No_Overwrite
{
    Because of = () => _exception = Catch.Exception(() => _PropManager.ReplyToProp());

    It should_result_in_an_error = () => _exception.ShouldBeOfType<InvalidOperationException>();

    private static Exception _exception;
}
Anthony Mastrean
  • 21,850
  • 21
  • 110
  • 188
AllSpark
  • 425
  • 1
  • 4
  • 17

1 Answers1

11

As of version 0.7.0, Machine.Specifications does not include assertions any more (see Daniel Marbach's blog). You have to install Machine.Specifications.Should (or another assertions library).

Additionally, ShouldBeOfType() has been replaced with ShouldBeOfExactType() (or ShouldBeAssignableTo() respectively), so you should also change that in your code (see github issue.

Simon Hohenadl
  • 502
  • 3
  • 8
  • this breaking change has caught out a lot of people – MattDavey Mar 03 '14 at 09:43
  • Any idea why the assertions now exists in a separate library? Is it allow flexibility over what assertions library to use? – Ciaran Gallagher May 05 '15 at 16:09
  • 1
    @Ciaran, for two reasons, I believe: flexibility to choose an assertions library and separation of concerns - while MSpec changes versions the assertions can remain stable and vice versa. – Simon Hohenadl May 05 '15 at 19:52