Hello:
I'm planning to implement my own set of constraints, and am having some difficulty understanding how to implement the following methods of the Constraint class.
public abstract class Constraint
{
public abstract void WriteDescriptionTo( MessageWriter writer );
public virtual void WriteMessageTo( MessageWriter writer );
...
I'm using NUnit (but have also tried this with VS testing) and I'm having a problem getting TestDriven.Net to recognize and run different test fixtures in a single .cs file.
I'm trying to do a little BDD style testing. So what I have in one file is something like this:
[TestFixture]
public class when_view_is_ready : AAA
{
// setup,...
How do you do the equivalent of:
[Test, ExpectedException( typeof(ArgumentOutOfRangeException) )]
void Test_Something_That_Throws_Exception()
{
throw gcnew ArgumentOutOfRangeException("Some more detail");
}
...in C++ (the example there is C#)? As far as I can see, there's no typeof() function for the C++ implementation of NUnit.
...
I have a unit test that
creates a mock
calls my method to be tested (also injecting my mock)
asserts method results
verifies mock calls
When mock calls don't verify as expected I get an exception, thus failing a test.
How should I correctly call this verifies? Should I just be calling
// verify property get accessor call
m.VerifyGet...
Getting started with TDD and I want to ground up a Repository-driven Model. However, how can I use NUnit to effectively say:
SomeInterfaceExists()
I want to create tests for each domain model (E.g. ICarRepository, IDriverRepository), etc.)
Does this actually make sense?
Regards
...
Nunit works quite well with CruiseControl.NET, but there is one thing that irritates me a lot.
If there is a test that causes Nunit to crash, I would only get little information about the crash because the XML report of Nunit doesn't get a chance to be created and be merged into the CruiseControl report.
I need a way to report the progr...
How do people set up their projects for Visual Studio and how do you reference the testable application ?
Right now I've added a separate project creating a .dll to my solution which contains all the test cases and references nunit.framework , and it also references the main .exe file right from the Debug/ folder where VS generates the ...
We have loads of DLLs with tests. I'm looking for a test runner (GUI) that either allows me to load all DLLs in a folder or that can load all tests from Visual Studio solution files. Ideas?
(I would like to use it as a complement rather than a replacement to our nightly builds (that runs all tests)).
...
Recently something happened to my TD.Net environment. When running tests with TD.Net, its looking for nunit 2.4.6. This happens with any project that uses NUnit as my testing framework. No references to that version in any of my projects. Have un-installed / re-installed both the latest NUnit and TD.Net several times. TD.Net works fine ...
What is the best way to unit test a protected method in C++?
In Java, I'd either create the test class in the same package as the class under test or create an anonymous subclass that exposes the method I need in my test class. Because neither of those methods are available to me in C++, what are suggested approaches for testing pr...
My nant script fails when I run it under cruise-control on (Windows Server 2003), but works fine when run on the console.
nant script (relevant section):
<target name="compile" depends="init">
<echo message="Build Directory is ${build.dir}" />
<exec program="${framework::get-framework-directory(framework::get-target-framework()...
We have some NUnit tests that access the database. When one of them fails it can leave database in inconsistent state - which is not an issue, since we rebuild database for every test run - but it can cause other tests to fail in the same run.
Is it possible to detect that one of the tests failed and perform some sort of cleanup?
We do...
Hello,
I encountered the problem while trying to run unit testing with NUnit 2.5 in Vista 64bit, MS Visual Studio 2008 SP1, Projects framework 3.5.
I have 2 projects in solution, the first - main project and the second - project with tests. Both projects targeted "Any CPU" platform. In fact, I didn't changed anything concerning platform...
Is there an assertion built into Nunit that checks all properties between 2 objects are the same, without me having to override Equals?
I'm currently using reflection to Assert each individual property for a pair of objects.
...
I have set my Visual Studio to start Nunit as an external program to run all the tests written in a module.
It gives me this error: Could not load file or assembly 'nunit.uikit.XmlSerializers, Version=2.5.0.9122, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77
but if I run it from command-line:
nunit.exe Tests.dll
it launches just fi...
I have never written unit tests before, for various reasons. I have a chance to write tests now, comfortably, because I have a small app to make from scratch.
However, I'm a bit puzzled. The application is supposed to use a printer with a smart card reader to program data on a smart card. So here's the sequence of actions: Create device...
I have written a simple test application using asp.net mvc with C#. The application uses MySQL
by using dblinq to generate linq to MySQL files and the application is working both in windows and linux.
I have now started to use NUnit to test my code, mostly since I need to test if the code working under
windows also will work in linux.
M...
At my company we are writing a bunch of unit tests. What we'd like to have done is for the unit tests to execute and whenever one succeeds or fails at the end of the test we can write that somewhere but we don't want to put that logic in every test.
Any idea how we could just write tests without having to surround the content of the te...
I have a test , where i do not need to run the setup method (attributed with [SetUp] )
before running the test.I need the setup method to be run for other tests.
Is there any attribute/otherway of achieving this?Is this supported by Nunit?
...
In the following code, Test1 succeeds but Test2 fails:
protected Mock<IMyInterface> MyMock { get; set; }
[SetUp]
public virtual void Initialize()
{
MyMock = new Mock<IMyInterface>();
}
[Test]
void Test1()
{
// ... code that causes IMyIntervace.myMethod to be called once
MyMock.Verify(x=> x.myMethod(), Times.Once());
}
[...