Hi all,
I need some advice on how to use Moq in a unit test to make sure that my class under test is behaving how I want. That is the class under test publishes an Event Aggregator (from Prism) event and I need some way of asserting that this event has been raised in my test.
I don't have a lot of resource at work and am finding it dif...
Is there a way to mock out Curb's Easy.perform method for unit testing? I use this to hit Facebook's graph API, and none of the http mock libs seem to support Curb.
What's the best approach here?
...
I have defined the following Unit-Test:
[TestMethod] //@Test for the Java crowd
public void In_The_Beginning_All_The_Board_Is_Black()
{
IBoard board = new Board(new Size(10, 22));
BoardEngine boardEngine = new BoardEngine(board);
for (int y = 0; y < boardEngine.Size.Width; ++y)
{
for (int x = 0; x < boardEngine....
Hi guys,
one of my repository class (say PersonRepo) has a delegate as its property something like this
private readonly Func<INameRepo> _nameRepo;
and apart from this it is inherited by a class which itself expects one more object (say the session).
Thus when i intialize this in my test I do something like
var funcNameRepo=autoMock...
Since python normally takes care of instantiating these objects I'm not entirely sure how get a standalone instance of this so I can test the do_GET, do_POST, etc. methods. Any suggestions are welcome.
...
How to understand this line?
>>> smtplib.SMTP.mock_returns = Mock('smtp_connection')?
What is smtp_connection? It
seems I can modify it to any name.
following is from minimock
Here's an example of something we might test, a simple email sender:: ...
If I try this, I just get an exception:
System.TypeLoadException : Access is denied: 'Namespace.IInternalInterface'.
Making the interface public is not an acceptable solution. I don't want to change the visiblity of my API in order to test it.
...
I'm implementing a WCF web service based on WF. This web service consumes other web services which I'm not in charge of. So basically my service workflow contains several Send activities.
I'm following the TDD approach, so the service implementation is to be covered by unit tests. I want to test proper invocation of 3rd party services.
...
n the .net world, my specs would follow the Arrange, Act, Assert pattern. I'm having trouble replicating that in rspec, because there doesn't appear to be an ability to selectively verify your mocks after the SUT has taken it's action. That, coupled with the fact that EVERY expectation is evaluated at the end of each 'It' block, is cau...
I am very new to Google Mock and to StackOverflow, sorry in advance if my question is not well posed.
I am trying to mock a templated method.
Here is the class containing the method to mock :
class myClass
{
public:
virtual ~myClass() {}
template<typename T>
void myMethod(T param);
}
How can I mock the method myMethod u...
Hi, I am using Moq as my mocking framework. As per the code below, I have two mocks setup and I would like to setup the second to return the first mock. Is this possible and if so how would I go about doing it? At the moment it says the mock being returned is an invalid candidate.
[SetUp]
private void SetupMarketRow()
{
var marketTot...
Is it possible to use Machinist to create blueprints for non-activerecord models? Seems to generate an error no matter what I try!
If this is impossible with Machinist, is there another fixture generating gem that can do it? I've also read that Factory Girl has issues with this.
...
When attempting to follow the article on mocking the htmlhelper with Moq I ran in to the following problem. The exception is thrown on creation of the htmlhelper. I am only guessing that castle windsor is being used (by seeing the error message).
The exception:
MissingMethodException occurred
Constructor on type 'Castle.Prox...
I'm still in the learning stages regarding unit-testing and in particular regarding mocking (I'm using the PascalMock and DUnit frameworks). One thing I now stumbled over was that I couldn't find a way around hard-coding implementation details of the tested class/interface into my unit test and that just feels wrong...
For example: I wa...
So as apart of my workflow I need to make a call to an external WCF Service to retrieve some objects. The problem is I can't see how to mock out the WCF Service that will be called by the send activity. Does anyone know how I can do this?
Thanks,
John
...
I am attempting to get a handle on Unit testing a very simple ASP.NET MVC test app I've built using the Code First approach in the latest EF4 CTP. I'm not very experience with Unit testing / mocking etc.
This is my Repository class:
public class WeightTrackerRepository
{
public WeightTrackerRepository()
{
_context = ne...
I'm trying to stub a call to db. The basic idea is for a line of code like this:
Person person = (from p in this.Entities.FindPerson("Smith") select p).FirstOrDefault();
to return an object the way I want it without going of to db. FindPerson(string) represents a stored proc (just in case).
I tried to overwrite FindPerson but I need ...
Hi guys,
I am generating a webservice stubusing this statement in java
new TPFServiceStub(webserviceUrl);
I have created a mock service in soap UI at 8088.
The same URL I am passing in the webserviceUrl variable.
All the dependent jars are placed in axis_home.
I am getting this following error.
Exception in thread "main" java.lang.N...
Hello,
I want to make an application for iPhone, as an introduction to programming in ObjC and Cocoa. I'm .net developer, so programming on Mac is a whole new world to discover for me :)
My application will be talking with web service. I want to use iCuke as a testing framework, and I don't want to connect to that webservice every ti...
I have a method of a mocked object that can be called multiple times (think recursion). The method is defined like this:
public void doCommit() { }
In order to tell it to fail I use this convention:
doThrow(new RuntimeException()).when(mMockedObject).doCommit();
This though, makes the method throw this exception EVERY time it is ca...