Hi,
I'm trying to get into unit testing with C#. Various people told me to go with NUnit since it's better than MSTest (apparently, I have no idea) and it also has very good support in ReSharper which I'm using.
Now I've never written a unit test before in my life (bear with me, I'm a university student). ReSharper has this nice Create...
Folks, I am new to writing testcases for the methods. Here I have a InsertMethod for which I want to write testcase using NUnit testing framework. Help me in writing the testcase for the method below :
public bool insertUser(String FirstName, String LastName)
{
bool result = false;
SqlConnection myconn = new SqlConnect...
Hi,
I've a test class named MyClass. MyClass has a TestFixtureSetUp that loads some initial data. I want to mark whole class as Inconclusive when loading initial data fails. Just like when somebody marks a test method Inconclusive by calling Assert.Inconclusive().
Is there any solution?
...
I'm running nant and used nunit2 to generate a xml result file per assembly.
My problems is when i use nunit2report the generate reports has dublicated its self
by the number of assembly result files. Does anyone know where i went wrong
portion of my nant script:
`
<nunit2 failonerror="false" verbose="true">
<formatter type="Xml" ...
public interface IMyServer
{
[OperationContract]
[DynamicResponseType]
[WebGet(UriTemplate = "info")]
string ServerInfo();
}
How do I write an NUnit test to prove that the C# interface method has the [DynamicResponseType] attribute set on it?
...
I have following question :
what are advantages and disadvantages in running nunit-console with /noshadow option?
Your comments will be very helpful
Thanks
...
I'm experimenting with potentially using Visual Web Developer 2008 Express for a project, but since the Express edition doesn't support the publish feature and since the ide also does not create any *proj files, how can I use the nunit gui to run my tests?
...
Say you have a method that could potentially get stuck in an endless method-call loop and crash with a StackOverflowException. For example my naive RecursiveSelect method mentioned in this question.
Starting with the .NET Framework version 2.0, a StackOverflowException object cannot be caught by a try-catch block and the correspondin...
I'm wondering how I should be testing this sort of functionality via NUnit.
Public void HighlyComplexCalculationOnAListOfHairyObjects()
{
// calls 19 private methods totalling ~1000 lines code + comments + whitespace
}
From reading I see that NUnit isn't designed to test private methods for philosophical reasons about what unit ...
Hi everybody,
I am putting together a bunch of applications to create an automatic building for microsoft platform (the products I chose and the software I will build, both, runs on windows). The products I've chosen are:
Code repository: SubVersion
Continuous integration: CruiseControl
Unit testing: NUnit
Test coverage: NCover
Static...
Hi All,
I'm currently using WatiN to run some javascript unit tests however everything works fine if I initialise the WatiN IE browser like this:
Browser browser = new IE("http://localhost/Project/tests.hyml");
However, as soon as I try to initialise the browser with a file uri, i.e.:
Browser browser = new IE("c:\\\\Projects\\Projec...
Hi,
in the current NUnit version, I can parameterized TestFixture and instantiated it multiple times. E.g.:
[TestFixture("var1")]
[TestFixture("var2")]
[TestFixture("var3")]
public class MyTestFixture
{
private string var;
public MyTestFixture(string var)
{
this.var = var;
}
...
...
I am new in Unit Testing. I have been asked that nUnitASP can be used to test WebForms. and it is already integrated in VS2008. I am not able to find any way in VS2008 for unit Testing ASP Webforms specifically.
Though I know the native method VS provide for UnitTesting, I am quite aware of NUnit using as seperate GUI. I am seeking for a...
I'm writing an NUnit TextFixture for portions of a Windows Forms application. Some of the classes in the file are derived from UI component classes, like so:
[TestFixture]
public class MainFormTest : PersistenceTestBase // Base class here is not a form
{
class TestMainForm : MainForm // MainForm inherits from Form
{
pub...
Can anyone tell me what is NUnit in .NET and how to use it? I have heard that using this tools improves design of an application. Is it true? Where can I get an absolute beginners tutorial on this topic?
...
To test that something throws for example an ArgumentException I can do this:
Assert.Throws<ArgumentException>(() => dog.BarkAt(deafDog));
How can I check that the ParamName is correct in a clear way? And bonus question: Or would you perhaps perhaps recommend not testing this at all?
...
Say we have a method that looks like this:
public IEnumerable<Dog> GrowAll(this IEnumerable<Puppy> puppies)
{
if(subjects == null)
throw new ArgumentNullException("subjects");
foreach(var puppy in puppies)
yield return puppy.Grow();
}
If I test that by doing this:
Puppy[] puppies = null;
Assert.Throws<Argumen...
I'm launching the NUnit gui from visual studio by setting the test project to start start nunit 2.5.3 as an external program. That loads the tests into the GUI but I still have to manually click the run button. Is there a command line argument that will have the tests run at the same time they're loaded?
...
Is there a 'standard' way to introduce assertions against Log4Net output?
E.g.
NUnit.Log4Net.Checkpoint()
...run some code that should not throw warnings...
NUnit.Log4Net.AssertNoErrors()
NUnit.Log4Net.AssertNoErrorsOrWarnings()
Or
NUnit.Log4Net.Checkpoint()
...code that warns user about an obsolete value...
NUnit.Log4Net.Asser...
I have a class like so:
public abstract class ClassA<T>
{
protected ClassA(IInterface interface)
{
if (interface== null)
{
throw new ArgumentNullException ("interface");
}
}
}
I want to write a test which verifies that if I pass null in the exception is thrown:
[Test]
[ExpectedExcep...