To enable debugging and stepping through unit test code when using NUnit: In the project containing the unit tests add a reference to nunit-console-runner.dll. Add a file to the project called NUnitConsoleRunner, for example. using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Utilities_Tests { public class NUnitConsoleRunner { [STAThread] public static void Main(string[] args) { NUnit.ConsoleRunner.Runner.Main(args); } } } Under the properties for the project: - Application - set the output type to Windows Application. - Debug - set the command line arguments to the name of the executable produced, e.g. Utilities_Tests.exe, and set the working directory to where it lives. Set the project to be the st...
Answer from StackOveflow that worked for me: If you are running into this error message can you please try adding the “HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows Kits\Installed Roots\KitsRoot” registry key and give it the same value as "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots\KitsRoot"
Null Object Pattern Motivation The Null Object pattern can be used to avoid having checks that objects are not null before using them to avoid throwing NullReferenceExceptions, e.g. if (myObject == null) { return; } // do something with myObject… Example For example, say we have a device object with a Connect() method that a client wishes to call. If we're getting the device from a repository we have to do a check for null before calling Connect(). If however the repository returns the null object, no null check is required. The null check is done within the repository so the client code does have to worry about it. Null object code public interface IDevice { string Name { get ; set ; } void Connect (); } public class RealDevice : IDevice { public string Name { get ; ...
Comments
Post a Comment