Click here to Skip to main content
15,891,981 members
Home / Discussions / C#
   

C#

 
GeneralRe: Huh? Can this be logical? Pin
Jerry Hammond31-Aug-04 8:43
Jerry Hammond31-Aug-04 8:43 
AnswerRe: Huh? Can this be logical? Pin
Eric Gunnerson (msft)1-Sep-04 12:45
Eric Gunnerson (msft)1-Sep-04 12:45 
GeneralLogging asynchronously Pin
Michel Rainville31-Aug-04 6:22
Michel Rainville31-Aug-04 6:22 
GeneralRe: Logging asynchronously Pin
Heath Stewart31-Aug-04 6:55
protectorHeath Stewart31-Aug-04 6:55 
GeneralRe: Logging asynchronously Pin
Daniel3000i31-Aug-04 8:00
Daniel3000i31-Aug-04 8:00 
GeneralRe: Logging asynchronously Pin
Michel Rainville31-Aug-04 10:08
Michel Rainville31-Aug-04 10:08 
GeneralRe: Logging asynchronously Pin
Daniel3000i31-Aug-04 11:16
Daniel3000i31-Aug-04 11:16 
GeneralWriting Unit Tests Pin
matthias s.31-Aug-04 6:17
matthias s.31-Aug-04 6:17 
Hi there,

I'm facing the following problem: I'm writing test cases (using NUnit) for my classes and I have to test for example if properties will throw an Exception when there is an attempt to assign invalid values.

Say I have a Car class with a Speed Property I want it to throw an Exception if the user attempts to assign a value greater then 90.

My test code looks somewhat like this:
Car c = new Car();
bool bFailed = false;

try { c.Speed = 200; }
catch { bFailed = true; }

Assert.IsTrue(bFailed, "Property Speed accepts incorrect values");


When you have a ton of TestCases to write and a lot of Properties to test, this becomes quite cumbersome.

My question is, can this code be somewhat improved? Is there a more generic approach?

Thanks in advance.

Matthias


If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.
(Lounge/David Wulff)

www.emvoid.de

GeneralRe: Writing Unit Tests Pin
Steven Campbell31-Aug-04 6:27
Steven Campbell31-Aug-04 6:27 
GeneralRe: Writing Unit Tests Pin
Colin Angus Mackay31-Aug-04 6:41
Colin Angus Mackay31-Aug-04 6:41 
GeneralRe: Writing Unit Tests Pin
Daniel Turini31-Aug-04 6:47
Daniel Turini31-Aug-04 6:47 
QuestionHow to intercept alerts from embedded programs? Pin
Member 129675731-Aug-04 5:57
Member 129675731-Aug-04 5:57 
AnswerRe: How to intercept alerts from embedded programs? Pin
Judah Gabriel Himango31-Aug-04 7:33
sponsorJudah Gabriel Himango31-Aug-04 7:33 
GeneralRe: What is missing? C# Pin
adnanh7531-Aug-04 5:04
adnanh7531-Aug-04 5:04 
GeneralDrag and Drop between two treeviews-drawing a line Pin
Cagatay Bilgin31-Aug-04 4:47
Cagatay Bilgin31-Aug-04 4:47 
GeneralRe: Drag and Drop between two treeviews-drawing a line Pin
LongRange.Shooter1-Sep-04 8:13
LongRange.Shooter1-Sep-04 8:13 
QuestionWhat is missing? C# Pin
adnanh7531-Aug-04 4:32
adnanh7531-Aug-04 4:32 
AnswerRe: What is missing? C# Pin
Steve Maier31-Aug-04 4:59
professionalSteve Maier31-Aug-04 4:59 
GeneralWait Thread close Pin
jzb31-Aug-04 4:23
jzb31-Aug-04 4:23 
GeneralRe: Wait Thread close Pin
Corinna John31-Aug-04 5:11
Corinna John31-Aug-04 5:11 
GeneralAcquire object name at runtime Pin
TehMedic31-Aug-04 1:36
TehMedic31-Aug-04 1:36 
GeneralRe: Acquire object name at runtime Pin
Nick Parker31-Aug-04 3:29
protectorNick Parker31-Aug-04 3:29 
GeneralRe: Acquire object name at runtime Pin
TehMedic1-Sep-04 0:13
TehMedic1-Sep-04 0:13 
QuestionSOS:How to make properties displayed in the property grid in the special order as I expected? Pin
dotnet_paradise31-Aug-04 1:10
dotnet_paradise31-Aug-04 1:10 
AnswerRe: SOS:How to make properties displayed in the property grid in the special order as I expected? Pin
leppie31-Aug-04 3:26
leppie31-Aug-04 3:26 

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.