Say I have a articles table, and I want to write a test for the method that returns all articles that are about to expire.
How would I go about writing a unit test for this? If I mock the collection of articles that the method returns, how is that a unit test?
I mean I want to make sure it returns the correct data range of articles?
...
I'm using Microsoft Visual Studio 2005 with Enterprise Library 3.1.
I have a data access layer which is a separate visual studio class library project. I wrote unit tests in a another class library and trying to call the data access method, but I keep getting
PSMCP.Dal.Tests.DataManagerTests.GetAAAReturnsDataReader:
System.NullReferen...
What is the best way to test web service using NUnit.
I want it to be automated, i.e, I don't want to have a separate process to host the web service for the testing code to consume.
...
I've a solution with 15 projects (14 class libraries and one web application). Each class library has corresponding test project (i.e. if I have MyApp.Services project there exists MyApp.Services.Tests -- using NUnit). Everything is written in VB.NET. The problem is that when VS tries to compile any of *.Tests project it stops responding...
Can anybody point me to some resources for Give-When-Then style of testing with NUnit?
...
NUnit 2.5.0
C# Class Library .NET 3.5
I have a strange error that just recently started to occur.
When trying to open a c# class library project in Nunit it immediately throws an exception:
System.NullReferenceException...
at NUnit.Util.VSProject.LoadMSBuildProject(String projectDirectory, XmlDocument doc)
at NUnit.Util....
Hello,
I'm trying to test a file (Account.cs) using testfile (AccountTest.cs). I run OSX 10.6 with Mono Framework (and nunit-console).
Below is Account.cs
namespace bank
{
using System;
public class InsufficientFundsException : ApplicationException
{
}
public class Account
{
private float balance;
...
I want a one liner, in NUnit, that asserts whether two dictionary are the same. i.e., I want a concise version of the below code:
public static void DictionaryAssert<T, U>(Dictionary<T, U> dictionaryResult, Dictionary<T, U> expectedResult)
{
Assert.AreEqual(dictionaryResult.Count, expectedResult.Count);
foreach (var aKey in expe...
Ive started working on a product that uses license files. These files need to be read (and verified) in order for the application to work. This causes some problems in the unit tests, without the proper license it throws exceptions.
We are using NUnit and what I need to do is either:
Copy the license file into the shadow copied direct...
I'm looking for a tool that I can run against my code base to determine which areas of my code are covered by NUnit tests I've written. I would appreciate any suggestions at all, and example usage if needed. Thanks!
...
I recently upgraded to Windows 7 from Vista and since switching, I can no longer use nunit-gui.exe to run my tests. Every time I do, I get the following error:
System.IO.FileLoadException: Could not load life or assembly 'nunit.framework. Version=2.4.1.0 Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' or one of its dependencies. The ...
Using NUnit and NMock2 I was not able to compare what I thought were the same SqlParameters:
SqlParameter param1 = new SqlParameter("@Id", 1);
SqlParameter param2 = new SqlParameter("@Id", 1);
Assert.IsTrue(param1.Equals(param2)); // This failed
I stumbled across this problem, when trying to test an execution of a method using NMock2...
I'm new to Rhino Mocks, so I may be missing something completely.
Lets say I have an interface with has a half dozen properties:
public interface IFoo {
string Foo1 { get; } // Required non-null or empty
string Foo2 { get; } // Required non-null or empty
string Foo3 { get; }
string Foo4 { get; }
int Foo5 { get; }
int Foo6 {...
So I'm fairly new to cc.net but like it so far. I have SVN getting latest, MSBuild building but when it comes to running my unit tests, kablooey.
I tried the fixes suggested about fixing references in the GAC, but that fixed nothing. I even uninstalled/reinstalled NUnit but still no luck. Also, my tests were initially referencing NUNit ...
I am new (as of today) to NUnit and TDD. However, I am very interested in the technique and I am trying to learn. I have a test case I would like to read from a file if it exists, otherwise I will grab from the registry. How do I test both conditions? Here is an example of the code I would like to write a test case for:
public s...
Hello,
I'm new to Nunit testing and I wanted to test the following constructor:
public class IngredientDAONHibernate : NutritionLibrary.DAO.IngredientDAO
{
private Configuration config;
private ISessionFactory factory;
public IngredientDAONHibernate()
{
try
{
...
Sorry for the repost.
I'm using Nhibernate for ORM and have this class I need to perform unit tests using Nunit:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;
using NHibernate.Cfg;
using NutritionLibrary.Entity;
using System.Data;
using System.Data.SqlClient;
using System.Collec...
To cut to the chase, can the TeamCity .NET NUnitLauncher process Microsoft csproj files?
I ask this question because of the following.
I have a NANT build script. In this script I have a number of tests which use nunit-console.exe (which ships with NUnit v2.5.2).
An example of a test in my Nant build file is:
<target name="x.Commons....
What is the equivalent of nUnits [SetUp] attribute for qUnit?
...
I have a class called "Session" which exposes several public methods. I'd like to Unit Test these, however in production I need to control instantiation of "Session" objects, so delegate construction to to a SessionManager class and have made the Session's constructor internal.
I'd ideally like to test the Session class in isolation fro...