Click here to Skip to main content
15,892,927 members
Home / Discussions / C#
   

C#

 
AnswerRe: Stored Procedures (Drag&Drop) Pin
Josh Smith11-Jul-06 9:45
Josh Smith11-Jul-06 9:45 
QuestionPassing Data from a Mdi Child form to its Parent form Pin
joshp121711-Jul-06 6:01
joshp121711-Jul-06 6:01 
AnswerNumerous methods Pin
Ennis Ray Lynch, Jr.11-Jul-06 6:07
Ennis Ray Lynch, Jr.11-Jul-06 6:07 
Questiondownload image Pin
TAREQ F ABUZUHRI11-Jul-06 5:14
TAREQ F ABUZUHRI11-Jul-06 5:14 
AnswerRe: download image Pin
Eran Aharonovich11-Jul-06 5:21
Eran Aharonovich11-Jul-06 5:21 
GeneralRe: download image Pin
TAREQ F ABUZUHRI11-Jul-06 16:02
TAREQ F ABUZUHRI11-Jul-06 16:02 
GeneralRe: download image Pin
Eran Aharonovich11-Jul-06 20:25
Eran Aharonovich11-Jul-06 20:25 
QuestionUnit Testing a Singleton Pin
Colin Angus Mackay11-Jul-06 5:13
Colin Angus Mackay11-Jul-06 5:13 
I'm trying to figure out the best way to write unit tests for a singleton class. Naturally, it has a private constructor and is accessed through a static method that returns the only ever instance. However, for unit testing purposes I want to be able to set some state up in advance, put in some mock objects and so on to test that in certain situations the correct exceptions are thrown or results given - all things that I can't really set up through the public interface of the class.

So, for the purposes of unit testing it would be useful to have more than one instance of the class available. Or perhaps there is another solution.

Does anyone have any ideas on how the singleton class might be effectively unit tested?


Scottish Developers events:
* .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy
* Developer Day Scotland: are you interested in speaking or attending?

My: Website | Blog
AnswerRe: Unit Testing a Singleton Pin
Dustin Metzgar11-Jul-06 5:18
Dustin Metzgar11-Jul-06 5:18 
AnswerRe: Unit Testing a Singleton Pin
Jun Du11-Jul-06 5:45
Jun Du11-Jul-06 5:45 
GeneralRe: Unit Testing a Singleton Pin
Colin Angus Mackay11-Jul-06 5:49
Colin Angus Mackay11-Jul-06 5:49 
GeneralRe: Unit Testing a Singleton Pin
Judah Gabriel Himango11-Jul-06 5:53
sponsorJudah Gabriel Himango11-Jul-06 5:53 
GeneralRe: Unit Testing a Singleton Pin
Jun Du11-Jul-06 6:07
Jun Du11-Jul-06 6:07 
GeneralRe: Unit Testing a Singleton Pin
Dustin Metzgar11-Jul-06 6:22
Dustin Metzgar11-Jul-06 6:22 
GeneralRe: Unit Testing a Singleton Pin
Jun Du11-Jul-06 7:07
Jun Du11-Jul-06 7:07 
GeneralRe: Unit Testing a Singleton Pin
Kevin McFarlane11-Jul-06 6:17
Kevin McFarlane11-Jul-06 6:17 
GeneralRe: Unit Testing a Singleton Pin
Colin Angus Mackay11-Jul-06 13:01
Colin Angus Mackay11-Jul-06 13:01 
GeneralRe: Unit Testing a Singleton Pin
Judah Gabriel Himango11-Jul-06 13:08
sponsorJudah Gabriel Himango11-Jul-06 13:08 
GeneralRe: Unit Testing a Singleton Pin
Colin Angus Mackay11-Jul-06 22:50
Colin Angus Mackay11-Jul-06 22:50 
GeneralRe: Unit Testing a Singleton Pin
Judah Gabriel Himango12-Jul-06 6:52
sponsorJudah Gabriel Himango12-Jul-06 6:52 
AnswerRe: Unit Testing a Singleton Pin
Judah Gabriel Himango11-Jul-06 5:47
sponsorJudah Gabriel Himango11-Jul-06 5:47 
AnswerInherit the singleton Pin
Ennis Ray Lynch, Jr.11-Jul-06 6:08
Ennis Ray Lynch, Jr.11-Jul-06 6:08 
Questionfont script Pin
TAREQ F ABUZUHRI11-Jul-06 4:45
TAREQ F ABUZUHRI11-Jul-06 4:45 
AnswerRe: font script Pin
mav.northwind11-Jul-06 4:46
mav.northwind11-Jul-06 4:46 
GeneralRe: font script Pin
TAREQ F ABUZUHRI11-Jul-06 4:52
TAREQ F ABUZUHRI11-Jul-06 4:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.