Microsoft
Software
Hardware
Network
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().GetHashCod
e();
}
}
}
Answer : C# and NUnit Framework
I got some help. Thanks
Random Solutions
SQL SSD setup
VB.NET: how to highlight listview item and place on TOP
show tables and their fields in tsql?
SBS 2008 Disk Full
How to make outlook 2003 run at all times on Windows 2003 server
Explorer.EXE - Unable To Locate Component
user can not login after the complete restore of AD
Have full control in Sharepoint but cannot view groiup
There is insufficient system memory in resource pool 'internal' to run this query. WE upgraded from a 32 bit, 4 GB, Windows 2003 server, SQL server 2005 machine to a 64 bit, 2 processor quad core, 8
Excel Macro to Compare Cells and Edit the Workbook