Having recently discovered this method of development, I'm finding it a rather nice methodology. So, for my first project, I have a small DLL's worth of code (in C#.NET, for what it's worth), and I want to make a set of tests for this code, but I am a bit lost as to how and where to start.
I'm using NUnit, and VS 2008, any tips on what ...
I have been asked to write a testing application that needs to test a new stored procedure on multiple rows in a database, in essence I want to do something like this:
[Test]
public void TestSelect()
{
foreach(id in ids)
{
DataTable old = Database.call("old_stored_proc",id);
DataTable new_ = Database.call("new_...
When you guys are unit testing an application that relies on values from an app.config file? How do you test that those values are read in correctly and how your program reacts to incorrect values entered into a config file?
It would be ridiculous to have to modify the config file for the NUnit app, but I can't read in the values from ...
I am interested in seeing if I can improve the way we use NUnit in a Visual Studio solution containing 30+ projects.
First, would you have one assembly of tests for every assembly in the solution, or would you try to keep the number of test assemblies down? I started off creating many test assemblies, but I think this is costing us a lo...
I've used NUnit before, but not in a while, and never on this machine. I unzipped version 2.4.8 under Program Files, and I keep getting this error when trying to load my tests.
Could not load file or assembly 'nunit.framework, Version=2.4.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' or one of its dependencies. The system cann...
In this asp.net I'm cleaning up it's possible for deadlocks to occur. I want to make sure that the code deals with them properly, so I'm trying to write NUnit tests which trigger a deadlock.....
The DAO is split by entity. Each entity has a set of tests which are surrounded by Startup() and Teardown() methods which create a transactio...
I have a class which is designed to spin up a background thread, from which calls will be made into a manager. This manager will be mocked for the purposes of unit test. The relevant fragment of code is:
MockRepository mocks = new MockRepository();
ICacheManager manager = mocks.CreateMock<ICacheManager>();
Expect.On(manager).Call(mana...
Trying to create a user account in a test. But getting a Object reference is not set to an instanve of an object error when running it.
Here's my MemberShip provider class, it's in a class library MyCompany.MyApp.Domain.dll:
using System;
using System.Collections.Generic;
using System.Web.Security;
namespace MyCompany.MyApp.Domain
{
...
I am currently using NUnit and testing a class library. Up until now, I have used a list of constants at the top of the test class to hold some static test variables. Is this the best way to do this, or is there a more fluent way to handle it?
...
I have some assembly that references NUnit and creates a single test class with a single test method. I am able to get the file system path to this assembly (e.g. "C:...\test.dll"). I would like to programmatically use NUnit to run against this assembly.
So far I have:
var runner = new SimpleTestRunner();
runner.Load(path);
var result ...
I need to write test cases for my application. I go for Nunit. Please let me know how to add Nunit to my Visual studio IDE. where can i download them.
Thanks.
...
I am on Vista 64 bits and I have a project built with x86 configuration. All work fine. Now, we are at the time to create test. We have NUnit 2.4.8 but we have a lot of problem.
The test are loading trough the Nunit.exe (gui) when we select the .dll directly but when executing we have a system.badimageformatexception.
I have read by se...
The NUnit documentation doesn't tell me when to use a method with a testfixturesetup en when to do the setup in the constructor
public class MyTest
{
private MyClass myClass;
public MyTest()
{
myClass = new MyClass();
}
[TestFixtureSetUp]
public void Init()
{
myClass = new MyClass();
}
...
I wrote a savefile method to save an object to xml. But I am not sure how to test the method in NUnit. Do I need create a sample file manually and compare the string between the files? Are there any better ways to test the method?
Thanks for your answer.
...
I had a winforms C# class that internally was looking up a file.. to help unit test, i changed it to pass in a file from the outside such as:
string file = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location + "TestXML.xml");
Foo = new Foo(file);
the problem is that the code works fine normally but when run in Nunit it come...
So after installing NUnit, the assemblies (nunit.framework, etc.) now appear in the References > Add Reference dialog, but they're not in the %WINDIR%\Microsoft.NET\Framework\v2.0.50727 dir and there is no NUnit registry entry for the Assembly Path (i.e. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramewokr\AssemblyFolder). There's also no...
During .NET v1 days, I have tried without much success to convince colleagues to develop test-driven and automated-build work habits using the additional tools of NUnit and NAnt. When .NET Framework 2.0 and Visual Studio 2005 Team Suite came into picture, I was able to "force" my team into writing tests and provide themselves with visual...
Is this possible? I am looking forward to a tutorial which explains the steps to achieve this.
...
When using NUnit and the test project, we haven't been able to find a way to step into the class we are testing in a web application. We are using TestDriven.NET add-in for Visual Studio 2008. We are able to hit a breakpoint in the test project, but not step into the web app class that is being tested.
...
This answer to a question about C++ unit test frameworks suggests a possibility that had not occurred to me before: using C++/CLI and NUnit to create unit tests for native C++ code.
We use NUnit for our C# tests, so the possibility of using it for C++ as well seems enticing.
I've never used managed C++, so my concern is are there any p...