Click here to Skip to main content
15,920,053 members
Home / Discussions / C#
   

C#

 
GeneralRe: Observer Pattern with Remote Machines Pin
Pete O'Hanlon2-Mar-16 21:08
mvePete O'Hanlon2-Mar-16 21:08 
AnswerRe: Observer Pattern with Remote Machines Pin
BillWoodruff2-Mar-16 6:43
professionalBillWoodruff2-Mar-16 6:43 
GeneralRe: Observer Pattern with Remote Machines Pin
Bernhard Hiller2-Mar-16 21:24
Bernhard Hiller2-Mar-16 21:24 
AnswerRe: Observer Pattern with Remote Machines Pin
BillWoodruff2-Mar-16 21:54
professionalBillWoodruff2-Mar-16 21:54 
AnswerRe: Observer Pattern with Remote Machines Pin
Super Lloyd5-Mar-16 19:01
Super Lloyd5-Mar-16 19:01 
GeneralRe: Observer Pattern with Remote Machines Pin
Bernhard Hiller6-Mar-16 21:30
Bernhard Hiller6-Mar-16 21:30 
GeneralRe: Observer Pattern with Remote Machines Pin
Super Lloyd6-Mar-16 23:04
Super Lloyd6-Mar-16 23:04 
QuestionReflection for non public type in Unit Testing Pin
Member 91405151-Mar-16 18:23
Member 91405151-Mar-16 18:23 
Hi All,

I am new to Unit Testing. Need your help in understanding how to use reflection in unit test case.i am using N-Unit Framework for writing unit test.

How to write unit test case for function "GetStudentinfo" in which private field "Studentresult" is updating. How to check this list value in unit test in order to compare expected and actual value using Assertions.
C#
class Updatestdinfo
{
        private enum Result
        {
            Firstclass,
            secondclass
        }
        private List<int, Result > Studentresult = new List<int, Result >();

    public void GetStudentinfo()
    {
      Studentresult[0] = Result.secondclass; 
    }
}


I tried to use reflection [gettype, getmethod] inorder to get the ENum type so that i can define list to initialize the expected value which can be used in Assert method. But its not returning the type of object. How can i resolve this?

modified 2-Mar-16 0:31am.

AnswerRe: Reflection for non public type in Unit Testing Pin
Bernhard Hiller1-Mar-16 21:26
Bernhard Hiller1-Mar-16 21:26 
GeneralRe: Reflection for non public type in Unit Testing Pin
Member 91405152-Mar-16 19:18
Member 91405152-Mar-16 19:18 
GeneralRe: Reflection for non public type in Unit Testing Pin
Bernhard Hiller2-Mar-16 20:42
Bernhard Hiller2-Mar-16 20:42 
AnswerRe: Reflection for non public type in Unit Testing Pin
BillWoodruff2-Mar-16 2:53
professionalBillWoodruff2-Mar-16 2:53 
GeneralRe: Reflection for non public type in Unit Testing Pin
Member 91405152-Mar-16 19:37
Member 91405152-Mar-16 19:37 
QuestionInput format was not in correct format for int? Followed by "Invalid expression term try" Pin
Sam 91001-Mar-16 8:26
Sam 91001-Mar-16 8:26 
AnswerRe: Input format was not in correct format for int? Followed by "Invalid expression term try" Pin
Eddy Vluggen1-Mar-16 9:07
professionalEddy Vluggen1-Mar-16 9:07 
GeneralRe: Input format was not in correct format for int? Followed by "Invalid expression term try" Pin
Sam 91001-Mar-16 12:08
Sam 91001-Mar-16 12:08 
QuestionRe: Input format was not in correct format for int? Followed by "Invalid expression term try" Pin
Matt T Heffron1-Mar-16 13:35
professionalMatt T Heffron1-Mar-16 13:35 
AnswerRe: Input format was not in correct format for int? Followed by "Invalid expression term try" Pin
Sam 91003-Mar-16 4:28
Sam 91003-Mar-16 4:28 
QuestionWhy getting Error :Column name doesn't belong to table Pin
Veena Hosur29-Feb-16 23:32
Veena Hosur29-Feb-16 23:32 
QuestionRe: Why getting Error :Column name doesn't belong to table Pin
Richard MacCutchan1-Mar-16 0:00
mveRichard MacCutchan1-Mar-16 0:00 
AnswerRe: Why getting Error :Column name doesn't belong to table Pin
Veena Hosur1-Mar-16 0:08
Veena Hosur1-Mar-16 0:08 
GeneralRe: Why getting Error :Column name doesn't belong to table Pin
Richard MacCutchan1-Mar-16 0:25
mveRichard MacCutchan1-Mar-16 0:25 
AnswerRe: Why getting Error :Column name doesn't belong to table Pin
Richard MacCutchan1-Mar-16 0:06
mveRichard MacCutchan1-Mar-16 0:06 
SuggestionRe: Why getting Error :Column name doesn't belong to table PinPopular
Sascha Lefèvre1-Mar-16 0:13
professionalSascha Lefèvre1-Mar-16 0:13 
GeneralRe: Why getting Error :Column name doesn't belong to table Pin
Luc Pattyn1-Mar-16 2:35
sitebuilderLuc Pattyn1-Mar-16 2:35 

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.