Click here to Skip to main content
16,005,344 members
Home / Discussions / C#
   

C#

 
GeneralRe: Using LINQ with a ASP application Pin
Not Active23-May-08 3:16
mentorNot Active23-May-08 3:16 
Questioncannot convert char* to object or string? Pin
cristi_alonso23-May-08 1:41
cristi_alonso23-May-08 1:41 
AnswerRe: cannot convert char* to object or string? Pin
DaveyM6923-May-08 1:55
professionalDaveyM6923-May-08 1:55 
AnswerRe: cannot convert char* to object or string? Pin
leppie23-May-08 8:49
leppie23-May-08 8:49 
QuestionAccessing an ArrayList from a sub-form Pin
Dirk.Bock23-May-08 0:27
Dirk.Bock23-May-08 0:27 
AnswerRe: Accessing an ArrayList from a sub-form Pin
Phil J Pearson23-May-08 0:51
Phil J Pearson23-May-08 0:51 
AnswerRe: Accessing an ArrayList from a sub-form Pin
DaveyM6923-May-08 1:28
professionalDaveyM6923-May-08 1:28 
QuestionUsing NUnit to test class which uses external XML file. Pin
N a v a n e e t h23-May-08 0:01
N a v a n e e t h23-May-08 0:01 
I have a class say Categories. This class has a singleton property say Current. Here is how that property code looks like
public static Categories Current
{
      get
      {
           if (_categories == null)
               LoadCategories();
           return _categories;
      }
}
LoadCategories() method opens a XML file and creates Categories instance for the data given there. I would like to use a separate XML file when this class is running on test mode. For that I wrote the below code
const string defaultCategoryFile = "MainFileName";
const string defaultTestFile = "TestFileName";

public static bool IsTesting = false;

private static void LoadCategories()
{
     FileStream stream = null;
     // Opening the file
     if (IsTesting)
         stream = new FileStream(defaultTestFile, FileMode.Open);
     else
        stream = new FileStream(defaultCategoryFile, FileMode.Open);
     .............
}
In the test class, I will make the IsTesting flag as true to load the test file. Is this a good approach or any other better methods available for this scenario ?

All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia

How to use google | Ask smart questions

AnswerRe: Using NUnit to test class which uses external XML file. Pin
Colin Angus Mackay23-May-08 0:13
Colin Angus Mackay23-May-08 0:13 
GeneralRe: Using NUnit to test class which uses external XML file. Pin
N a v a n e e t h23-May-08 0:57
N a v a n e e t h23-May-08 0:57 
GeneralRe: Using NUnit to test class which uses external XML file. Pin
Colin Angus Mackay23-May-08 4:11
Colin Angus Mackay23-May-08 4:11 
QuestionProblem in ReportDocument.Export() function. [modified] Pin
Nitten22-May-08 23:55
Nitten22-May-08 23:55 
QuestionDictionary. Can anyone spot whats going on here? Pin
MarkB77722-May-08 22:41
MarkB77722-May-08 22:41 
AnswerRe: Dictionary. Can anyone spot whats going on here? Pin
Giorgi Dalakishvili22-May-08 22:47
mentorGiorgi Dalakishvili22-May-08 22:47 
GeneralRe: Dictionary. Can anyone spot whats going on here? Pin
MarkB77723-May-08 0:00
MarkB77723-May-08 0:00 
GeneralRe: Dictionary. Can anyone spot whats going on here? Pin
Giorgi Dalakishvili23-May-08 7:02
mentorGiorgi Dalakishvili23-May-08 7:02 
AnswerRe: Dictionary. Can anyone spot whats going on here? Pin
The Nightcoder23-May-08 15:26
The Nightcoder23-May-08 15:26 
GeneralRe: Dictionary. Can anyone spot whats going on here? Pin
MarkB77723-May-08 16:17
MarkB77723-May-08 16:17 
GeneralRe: Dictionary. Can anyone spot whats going on here? Pin
The Nightcoder23-May-08 16:29
The Nightcoder23-May-08 16:29 
QuestionHow to bind property to control (through this[string]) Pin
El'Cachubrey22-May-08 22:33
El'Cachubrey22-May-08 22:33 
AnswerRe: How to bind property to control (through this[string]) Pin
darkelv22-May-08 23:00
darkelv22-May-08 23:00 
GeneralRe: How to bind property to control (through this[string]) Pin
El'Cachubrey22-May-08 23:05
El'Cachubrey22-May-08 23:05 
GeneralRe: How to bind property to control (through this[string]) Pin
darkelv23-May-08 0:00
darkelv23-May-08 0:00 
GeneralRe: How to bind property to control (through this[string]) Pin
El'Cachubrey23-May-08 1:21
El'Cachubrey23-May-08 1:21 
GeneralRe: How to bind property to control (through this[string]) [modified] Pin
darkelv23-May-08 1:31
darkelv23-May-08 1:31 

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.