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...
I'd like to implement widget-ized Zend controllers in a test-driven way. By widget-ized I mean, for instance, a list controller that outputs elements, calling for each of them $this->action('element', …) view helper in its view script (list.phtml). Thus, the rendering of each element in the list is handled by a dedicated “element” contro...
Should I write unit tests for my associations?
I haven't found many good resources on how and whether to do the testing. I also see/hear some opinion that it is okay to not test your associations (belongs_to and has_many) as they are already tested in rails. And there is another view that says, if it code you write, it is code you test...
Hello, I would like to know what are the downsides of using random values in some of the Unit Testing.
I'm talking about a large scales system, with many servers and non deterministic input in high capacity. when i say non deterministic i'm talking about messages that are sent and you catch what you can and do the best you can.
There ...
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.
...
I've been reading a lot on TDD over the past few months and decided to jump in and try it out with an easy example, I'm just not sure I'm testing for the right things in practice. Here the tests for a custom Data Annotation for validating emails:
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using...
When i generated unit tests the Visual studio added some fictive class that mocks my class and added the "Shadowing" attribute.
What does it do?
...
Hi,
I am trying to find out in Visual Studio 2010 Unit Testing how to keep a transaction of the data I have either added, updated, or deleted during my tests so on my TestCleanup I can rollback their values.
What search terms should I be using to find more about this?
Cheers
Paul
...
Intro
Currently I have something of the form:
Tetris class ---> FallingPiece class ----> Piece class
A Piece can be a Square, a T, etc. It has info about its shape and the shapes of its rotations, its size, etc.
The FallingPiece class basically contains an attribute with a reference to a Piece (the currently falling piece in the Te...
Can I call a test method from within the test class in python? For example:
class Test(unittest.TestCase):
def setUp(self):
#do stuff
def test1(self):
self.test2()
def test2(self):
#do stuff
update: I forgot the other half of my question. Will setup or teardown be called only after the method t...
I'm looking for a good tutorial on Python unit testing in Eclipse, particularly using PyDev.
I am working on a fairly large project using Eclipse. I've built several test suites that are working nicely, but I'm intrigued by the large number of additional unit testing features in PyDev. I've tried to work with them some, but it's gon...
Maybe I'm using unit tests in the wrong way, but I have a very large database with a lot of data.
Each set of data presents a different scenario and the number of scenarios is too large to individually test. Therefore, I've decided the best way to get adequate coverage is to run the unit test against the data as many times as I could, a...
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...
Not ignore it completely, just have it not stop execution if it hits an Assert and it fails. I would like to see a summary of all the fails at the end.
...
I want to refactor a DLL to make it MEFable too. Should I unit test whether a class is decorated with [Export] or [Import] and other MEF attributes?
...
Hi,
Does anybody can get me started on using fixtures in doctrine 2? In doctrine 1 this was easy. But in the doctrine 2 documentation there's nothing I can find about fixtures.
Thanks.
...
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...
How can I run a doctrine 2 migration command without interaction?
Currently I have following command which runs on the setup of my Unit Tests. But It always prompt for a Yes/No user input, even when I use the --no-interaction option.
$input = new Symfony\Components\Console\Input\ArrayInput(
array(
'migrations:migrat...
I need to implement my own Profile properties and was going to inherit from System.Web.Profile.ProfileBase to achieve this.
What I don't understand is how to best unit test this Profile class in isolation without hitting the database.
...
I'm looking for sample solution(s) that demonstrate various kinds of unit tests in C# using best practices. Also I require the examples to use the Visual Studio test tools. I know that there are a number of books and web sources on unit testing, but they don’t use the Visual Studio tools for writing their unit tests. I don’t want really...