I have an ASP.net Web Site Project (.net 3.5). Currently all of the non-code behind code files (including Linq2Sql stuff, data contexts, business logic, extension methods, etc) are located in the App_Code folder.
I am interested in introducing Unit Testing (using nunit) in at least some sections of the project moving forward. Any Unit T...
In my NUnit testfixtrues i have something along the lines of
[Test,Category("catA")]
public void test1
{
//
}
[Test,Category("catB")]
public void test2
{
//
}
[Test,Category("catA")]
[Test,Category("catB")]
public void test3
{
//
}
Now in the NUnit gui i want to be able to select catA and catB and run the tests where cat...
Is there a way to do a conditional TearDown in NUnit?
I have a TestFixture which has a need to run cleanup code for just a few tests, and I don't really want to:
Run the TearDown method on every test
Create a private helper method and call it from the tests requiring cleanup if I can avoid it
...
Suppose you have a method:
public void Save(Entity data)
{
this.repositoryIocInstance.EntitySave(data);
}
Would you write a unit test at all?
public void TestSave()
{
// arrange
Mock<EntityRepository> repo = new Mock<EntityRepository>();
repo.Setup(m => m.EntitySave(It.IsAny<Entity>());
// act
MyClass c = new...
On numerous unrelated, projects the CPU usage of NUnit has often ended up being about 50% even when I'm not running my tests. From other information I've read this is supposedly more to do with my code than Nunit.
Does anyone know how I can isolate the problems in my code that will be causing this and fix them?
Thanks
...
I want to invoke a method when my integration test fails (i.e., Assert.AreEqual fails), is there any event delegate that I can subscribe to in NUnit framework? Of course the event delegate must be fired when the tests fail.
This is because in my tests there are a lot of Assert statement, and I can't tell need to log the Assert, along w...
when i run this:
sh "#{MBUNIT_PATH}Gallio.Echo.exe /no-echo-results src/#{dll}/bin/Debug/#{dll}.dll"
in my rakefile, gallio runs my mbunit tests, and TC picks up the results :D
but this:
sh "#{NUNIT_PATH}nunit-console.exe /nologo src/#{dll}/bin/Debug/#{dll}.dll"
does run my tests, but TC doesnt pick up the result :(
I first tried...
In NUnit, I'm used to writing Trace statements in the test, and having them show up in the trace tab of the NUnit gui.
On a new project, I'm moving to the built in Unit Testing in Visual Studio Professional Addition, which I believe is an interface to mstest.exe.
Test Code:
<TestMethod()>
Public Sub TestPagesInheritFromBasePage()
...
I'm writing some unit tests for an ASP.NET MVC controller that's using SubSonic3 generated model objects (using ActiveRecord "mode" (not sure what else to call it), and am wondering how I can clear out the test data from the test database in my TestFixture's TearDown method. I don't have a direct reference to the model object in my test ...
Can somebody recommend a good (free) generator for NUnit Tests?
...
So, I'm using moq for testing, but I ran into a problem that prevents me from mocking correctly, at least I think so.
This is my repository class:
public interface IAccountsRepository
{
IQueryable<Account> Accounts { get; }
IQueryable<Account> AccountsPaged(int pageSize, int selectedPage);
}
This is one of the implem...
I'm trying to implement the GetHttpContext function from HtmlHelperTest.cs in VB.NET using Rhino Mocks, but I'm getting "Type 'HttpContextBase' is not defined." The compiler suggests changing it to HttpContext, but when I do that I get a run time error that a sealed class cannot be mocked.
My test project references System.Web and also ...
I'm using CruiseControl.NET with NUnit and NAnt. I'm trying to get CC.net to send out emails that contain the styled test results and build information. My config file looks like this:
<publishers>
<merge>
<files>
<file>C:\Tests\*Results*.xml</file>
<file>C:\Artifacts\*</file>
</files>
</merge>
<xmllogger logDir="C:\...
I have some NUnit test cases which need to be ran under STA model.
As discussed in many web sites or blogs (for example here), I added a configuration file ("app.conig") to my NUnit test assembly with the following contents.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="NUnit">
...
I am testing my routes in an mvc app. I have the following code:
using System.Web.Routing;
using MvcContrib.TestHelper;
using NUnit.Framework;
using web;
using web.Controllers;
namespace tests.web.Routes
{
[TestFixture]
public class routeTests
{
[Test]
public void Route_POSURL_MapsToPOSIndex()
{
...
I'm trying to mock out the System.net.Sockets.Socket class in C# - I tried using NUnit mocks but it can't mock concrete classes. I also tried using Rhino Mocks but it seemed to use a real version of the class because it threw a SocketException when Send(byte[]) was called. Has anyone successfully created and used a Socket mock using an...
I have a method which retrieves DataTable and iterates each DataRow and stores each row
in ArrayList.After the iteration is over it returns the ArrayList.How can i write test case to test the ArrayList ?
Example :
ArrayList =>0 ( {1,personName1,Designation} );
ArrayList =>1 ( {2,personName2,Designation} );
ArrayList =>2 ( {3,personNa...
Hello,
I am writing a winforms application and eventually I would like to write unit test for this application from the DAL, and Biz Objects layers etc.
Does someone know of a FREE tool that can recieve the path to an assembly and then output unit test stubs with matching signatures for the assembly.
Any configurable options like "pub...
A new project we began introduced a lot of new technologies we weren't so familiar with, and an architecture that we don't have a lot of practice in. In other words, the interfaces and interactions between service classes etc of what we're building are fairly volatile, even more so due to internal and customer feedback. Though I've alway...
Is it possible to define a custom filter so that NUnit will only run specific tests? I have many of my Nunit tests marked with a custom attribute "BugId". Is it possible to write a filter so that I can pass in a number and only run the tests with that attribute and number? If so show mockup or real code.
...