Question : C# and NUnit Framework

I have the  class below--UserInfo. I can insert the following code into main method:to test my class
however I need to use the NUnit Framework to test it (the web-site www.nunit.org). I have attached the NUnit_UserInfo.txt file - I'm using the NUnit Framework to test. Am I using NUnit Framework correctly?? What would be the best approach?? Thanks

b1 = new UserInfo("Bill Smith", "BSMITH");
b2 = new UserInfo("Bill Smith", "BSMITH");
System.Console.WriteLine( b1.Equals(b1) ); // prints true
System.Console.WriteLine( b1.Equals(b2) ); // prints true

****************************
namespace abc
{
      [Serializable()]
      public class UserInfo
      {
            private String _name;      //             
            private String _userId;      //             

            public String Name            
            {                  
                  get { return _name; }                  
                  set { _name = value; }            
            }             


            public String UserId            
            {                  
                  get { return _userId; }                  
                  set { _userId = value; }            
            }             
            ///            
            /// Default constructor necessary for             
            /// XML serialization            
            ///

            public UserInfo()            
            {                  
                  _name = String.Empty;                  
                  _userId = String.Empty;            
            }             

            public UserInfo(String name, String userId)            
            {                  
                  this._name = name;                  
                  this._userId = userId;            
            }             
   
            public override bool Equals(object obj)            
            {                  
                  if ((object)obj == null)                        
                        return false;                   

                  if(!(obj is UserInfo))                        
                        return false;                   

                  return (this._name == (obj as UserInfo)._name) && (_userId == (obj as UserInfo)._userId);            
            }             

            public override string ToString()            
            {                  
                  return String.Format("{0}: {1}", _userId, _name);            
            }             


            public override int GetHashCode()            
            {                  
                  return this.ToString().GetHashCode();            
            }      

      }
}

Answer : C# and NUnit Framework

I got some help. Thanks
Random Solutions  
 
programming4us programming4us