typemock

NMock2.0 - how to stub a non interface call?

Hello, I have a class API which has full code coverage and uses DI to mock out all the logic in the main class function (Job.Run) which does all the work. I found a bug in production where we werent doing some validation on one of the data input fields. So, I added a stub function called ValidateFoo()... Wrote a unit test against this...

How to assert a private method on concrete class is called (TypeMock/NMock/etc..)?

Hello, I am trying to write a unit test for the 'IsUnique' function in the class below that looks like this: class Foo { public bool IsUnique(params...) { ValidateStuffExists(params); return CheckUniqueness(params); } private void ValidateStuffExists(params) { //does some validation } p...

Any teams out there using TypeMock? Is it worth the hefty price tag?

Hi, I hope this question is not 'controversial' - I'm just basically asking - has anyone here purchased TypeMock and been happy (or unhappy) with the results? We are a small dev shop of only 12 developers including the 2 dev managers. We've been using NMock so far but there are limitations. I have done research and started playing with...

RhinoMocks and Heisenbugs

I've been using RhinoMocks lately but I keep running into an issue. If I break into the debugger and step over code while a mock is in Record mode, I end up getting an exception along the lines of: System.InvalidOperationException: Previous method 'SuchAndSuch.ToString();' requires a return value or an exception to throw. But if I ...

Moq - How to mock a function call on a concrete object?

Hello, How can I do this in Moq? Foo bar = new Foo(); Fake(bar.PrivateGetter).Return('whatever value') It seems I can only find how to mock an object that was created via the framework. I want to mock just a single method/property on a concrete object I've created... In TypeMock, I would just do Isolate.WhenCalled(bar.PrivateGetter...

Rhino mock vs Typemock vs JustMock vs...

I need to choose mock framework to new project. What are the pros and cons for those frameworks? Any comparison table? I know that JustMock is i beta stage but it's look very good right now (very similar to TypeMock) Edit: I'v What about MS Mole? ...

EF4 - possible to mock ObjectContext for unit testing?

Can it be done without using TypeMock Islolator? I've found a few suggestions online such as passing in a metadata only connection string, however nothing I've come across besides TypeMock seems to truly allow for a mock ObjectContext that can be injected into services for unit testing. Do I plunk down the $$ for TypeMock, or are there a...

Mocking Autofac's "Resolve" extension method with TypeMock

I'm trying to mock an Autofac resolve, such as using System; using Autofac; using TypeMock.ArrangeActAssert; class Program { static void Main(string[] args) { var inst = Isolate.Fake.Instance<IContainer>(); Isolate.Fake.StaticMethods(typeof(ResolutionExtensions), Members.ReturnNulls); Isolate.WhenCalled(...

Silverlight Unit tests can't be run (using ReSharper or NUnit): dependency error appears

CThru.Silverlight can't find dependent libraries Typemock.Isolator.VisualBasic & Typemock.ArrangeActAssert of Version=6.0.2.0 but there are versions 6.0.3.0 of these libraries registered. Any workaround? Where to download Typemock 6.0.2.? TIA ...

Silverlight unit testing. Error while running tests.

I'm using VS2010. Silverlight 4, NUnit 2.5.5, and TypeMock TypemockIsolatorSetup6.0.3.619.msi In the test project MVVM is implemented, PeopleViewModel is a ViewModel which I want to test. Please advise if you use other products for unit testing of MVVM Silverlight. Or please help to win this TypeMock. TIA This is the code of the test:...

Typemock - Worth the money?

I know that this is a subjective question... Typemock is $799 per developer. Licences for 5 devs comes up to a pretty large sum. If someone here used Typemock and given that there are open source mocking frameworks, is it worth the money? Why? ...

How to write the following with the Typemock API?

Hi, In Typemock (the latest version), I want to write the following in code: My method will throw an exception (caused if a collection is empty) (if there is a collection which is not empty, it will be returned in that case btw). How can I do this? The method itself takes a func of (this is the SX API). This func seems to cause me pr...

How does "Typemock Isolator" mock static methods?

As some of you will know, it is generally not possible to mock a static method in .net. By mocking, I mean to replace a method in a class with another method with the same signature, usually for testing purposes. The two main methods used for mocking a method are to declare it virtual or define it in an interface. Neither of these two...

Swapping parameters with typemock

Hi, I am coding some unit tests and wondered, is it in the duty of Typemock to replace paremeters? For example, I have a method which relies on an object and in this object's constructor are some assemblies to analyze (a string array). Would I be on the right track to mock the class containing the method and then pass in my own parame...

JustMock vs. TypeMock vs. Other

With Telerik's JustMock product newly available, it has a lot of similarities to TypeMock, in the ability to mock concrete classes, not just abstract classes or interfaces. I was just curious your opinion on one or both of the products. What do you like or dislike? Seems like JustMock might be shy on some of the features (TypeMock has...

Setting up behavior on a method appears to be calling the method

I posted this on the TypeMock forums, but am too impatient to wait for a response there. This is a very n00b question. I'm trying to set up a fake IContainer. Here's what I have: var container = Isolate.Fake.Instance<IContainer>(); var program = Isolate.Fake.Instance<IProgram>(); Isolate.WhenCalled(() => container.Resolve<IProgram...

How to mock everything?

I understand how to mock interfaces or virtual method calls. But frameworks like TypeMock can mock everything in the framework. Which .NET mechanisms are used to provide such functions? ...