nunit

Counterpart for NUnit attribute [SetUp()] in Visual Studio

I am "translating" a NUnit test to Visual Studios unit testing and I am wondering if the attribute [ClassInitialize()] in VS is equivalent to [SetUp()] in NUnit? ...

Is this a good way to setup Moq to return a particular value only a certain number of times?

Using NUnit and Moq, I am trying to wrap some tests around legacy code before I do too much more refactoring. I need to test that a method keeps looping until told to stop. Here is my idea how to do it: [TestCase] public void KeepsCallingDoSomethingUntilShouldIKeepGoingIsFalse() { var dal = new Mock<IDataAccessLayer>(); var sut = ...

Using Assert to compare two objects

Hi everyone, Writing test cases for my project, one test I need is to test deletion. This may not exactly be the right way to go about it, but I've stumbled upon something which isn't making sense to me. Code is like this: [Test] private void DeleteFruit() { BuildTestData(); var f1 = new Fruit("Banana",1,1.5); var f2 = new...

Is it possible to integrate NUnit with VB.net Express Edition? Which is the best way?

Hi, I'm a Java Developer wich is learning VB.net for a small project. While coding in Java, we don't have to think a lot about how to integrate our IDE with our unit test framework because most of the IDEs already area integrated. But now that I'm working on a project which the main requirement is to use VB.net Express Edition, is it p...

How do I simplify these NUNit tests?

These three tests are identical, except that they use a different static function to create a StartInfo instance. I have this pattern coming up all trough my testcode, and would love to be be able to simplify this using [TestCase], or any other way that reduces boilerplate code. To the best of my knowledge I'm not allowed to use a dele...

How to run NUnit from my code

I'd like to use NUnit to run unit tests in my plug-in, but it needs to be run in the context of my application. To solve this, I was trying to develop a plug-in that runs NUnit, which in turn will execute my tests in the application's context. I didn't find a specific documentation on this subject so I dug a piece of information here an...

nant: invalid element nunit2. Unknown task or datatype

How to solve this problem? I have this ProjectName.UnitTests.config file, and I did exactly what the documentation said: http://nant.sourceforge.net/release/latest/help/tasks/nunit2.html <?xml version="1.0" encoding="utf-8" ?> <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> ...

How to control Chrome browser from an NUnit test?

What is the easiest way to control Chrome (pc/mac) from an NUnit test? Things I want it to do: Use a proxy server I specify not bring up any dialog boxes that need to be clicked. open a url I specify close With firefox I can do all these things by writing out a temp firefox profile, and telling firefox to use it. If someone knows a...

Silverlight unit testing (using NUnit)

I'm using NUnit for testing back-end. Unit tests are being executed while building (I'm using TeamCity for continuous building). Now I hove to test front-end (Silverlight 4.0). Because the tests are being executed while building, I have to simulate browser (TypeMock - is not free, isn't it?) could I use NUnit.Mocks somehow?. How to use...

Creating parallel selenium tests in C# and using Nunit as the runner application

I am writing a new test suite for the company to test a very complex ASP.NET application which is heavily AJAX driven. We have decided to use Selenium (Grid & Remote Control) and Nunit to run these tests. The actually tests are dynamically created at run time from a spreadsheet. Each Column in an excel spreadsheet relates to a new test...

How to Run NUnit Tests from C# Code

I'm trying to write a simple method that receives a file and runs it using NUnit. The code I managed to build using NUnit's source does not work: if(openFileDialog1.ShowDialog() != DialogResult.OK) { return; } var builder = new TestSuiteBuilder(); var testPackage = new TestPackage(openFileDialog1.FileName); var directoryName = Path...

NBehave and NUnit-2.5.5.10112 can work together?

I'm using Unit-2.5.5.10112. How can I use also NBehave, if it has dependency on an older version of NUnit? Should I ignore NBehave? ...

How to unit test my project against different versions of external dll api?

I am developing an app that relies heavily on an external dll, my app needs to support new versions of the dll as well as being backwards compatible with the old ones. Are there any good ways to have my unit tests target all of these different dll versions without the need to rewrite the tests as soon as a new version of the api is rel...

Silverlight unit testing. Error while running tests.

I'm using VS2010. Silverlight 4, NUnit 2.5.5, and TypeMock TypemockIsolatorSetup6.0.3.619.msi In the test project MVVM is implemented, PeopleViewModel is a ViewModel which I want to test. Please advise if you use other products for unit testing of MVVM Silverlight. Or please help to win this TypeMock. TIA This is the code of the test:...

FsCheck NUnit . Tests with condition

I'm trying to make test for this function let extract_one_rule (rule:Rule.t<'a,'b>) = let rec expand = function |PAlt (a,b) -> expand a @ expand b |PSeq (a,b) -> let wrap = List.map (fun x -> (x.rule, fun r -> {x with rule = r})) a |> List.unzip in ...

NUnit, is it possible to continue executing test after Assert fails?

In a test that contains some asserts, for example: Assert.AreEqual(1,1); Assert.AreEqual(2,1); Assert.AreEqual(2,2); is it possible to let the test keep running after it fails at some point? In the example, first condition is true, second fails and the test stops. I'd like to evaluate also the following condition. ...

Is there an MSTest equivalent to NUnit's Explicit Attribute?

Is there something like that in MSTest? Thanks ...

How to run NUnit test in MonoDevelop 2.2 in Ubuntu 10.04?

I was following a tutorial but I can't find the option to run tests. ...

NUnit+ReSharper: How to view results for TestFixture with different parameters?

Hi all! I have written unit tests under NUnit that use TestFixtures with different parameters. Now, when I run tests, I want to see with which parameters test has been passed and with which hasn't. Unfortunately, ReSharper shows only "Test failed: Child test failed" and no more information. Is there any way to see which parameters hav...

NUNIT + VS2010 = Unable to copy file from /obj to /bin...being used by another process

I am trying to run some unit tests using NUnit while I have the project open, and VS 2010 cannot rebuild the project while the assembly is loaded in NUnit. I have looked around and haven't found any solutions that seen to fix it. I can close NUnit, then the project builds fine. This is a the same solution based on Rob Conery's BDD demo f...