How to escape double quotes in as a parameter to an NUnit TestCase?
The correct way to escape double-quotes in VB is by doubling the double-quotes: <TestCase(“FirstNode”, “<node id=””FirstNode””>”)>
The correct way to escape double-quotes in VB is by doubling the double-quotes: <TestCase(“FirstNode”, “<node id=””FirstNode””>”)>
Implement the SetEntryAssembly(Assembly assembly) method given in http://frostwave.googlecode.com/svn-history/r75/trunk/F2DUnitTests/Code/AssemblyUtilities.cs to your unit test project. /// <summary> /// Use as first line in ad hoc tests (needed by XNA specifically) /// </summary> public static void SetEntryAssembly() { SetEntryAssembly(Assembly.GetCallingAssembly()); } /// <summary> /// Allows setting the Entry Assembly when needed. /// Use AssemblyUtilities.SetEntryAssembly() as first line in XNA … Read more
My shop has finally worked through an answer for this for our MVC project. And I want to share it as I chased a lot of dead ends here on StackOverflow hearing a lot of people say it couldn’t be done. We do it like this: Open the MVC folder “as a website, from local … Read more
There are two products that can help you there: Microsoft Chess Typemock Racer Both check for deadlocks in your code (via unit test) and I think Chess checks for race conditions as well. Using both tools is easy – you write a simple unit test and the run your code several times and check if … Read more
There is bug when using MockSequence on same mock. It definitely will be fixed in later releases of Moq library (you can also fix it manually by changing Moq.MethodCall.Matches implementation). If you want to use Moq only, then you can verify method call order via callbacks: int callOrder = 0; writerMock.Setup(x => x.Write(expectedType)).Callback(() => Assert.That(callOrder++, … Read more
I just want to point out that while most of the responders assumed these were unit tests, the question did not specify that they were. nUnit is a great tool that can be used for a variety of testing situations. I can see appropriate reasons for wanting to control test order. In those situations I … Read more
Try this AppDomain.CurrentDomain.SetupInformation.ConfigurationFile
If I remember correctly, “*chrome” is used to launch a special mode of Firefox (a mode in which your application has more privilegies — with less security restrictions) ; so, the fact that it’s Firefox that is launched, and not Google Chrome, is normal. If you want to launch Google Chrome, you will have to … Read more
If you want to run NUnit tests in parallel, there are at least 2 options: NCrunch offers it out of the box (without changing anything, but is a commercial product) NUnit 3 offers a Parallelizable attribute, which can be used to denote which tests can be run in parallel
While I agree that the focus of unit testing should be the public interface, you get a far more granular impression of your code if you test private methods as well. The MS testing framework allows for this through the use of PrivateObject and PrivateType, NUnit does not. What I do instead is: private MethodInfo … Read more