I created a three layer windows based application. I'm trying to make a unit testing using NUINT, but the problem is that I don't know how to access the method.
I created my application in this manner :
I'll try to test the method Shto(Klasa obj)
Business Object namespace "BO"
namespace BO
{
public class Klasa
{
private int k_ID_Klasa;
private int k_KlasaViti;
private int k_Paralelja;
public Klasa()
{
}
public int ID_Klasa
{
get { return k_ID_Klasa; }
set { k_ID_Klasa = value; }
}
public int KlasaViti
{
get { return k_KlasaViti; }
set { k_KlasaViti = value; }
}
public int Paralelja
{
get { return k_Paralelja; }
set { k_Paralelja = value; }
}
}
}
Data Access Layer "DAL"
namespace DAL
{
public class KlasaDB
{
public KlasaDB()
{
}
public static void Shto(Klasa obj)
{
SqlConnection sqlConn = new SqlConnection(StringKoneksioni.Stringu);
SqlCommand sqlCmd = new SqlCommand("procShtoKlasa", sqlConn);
sqlCmd.CommandType = CommandType.StoredProcedure;
sqlCmd.Parameters.AddWithValue("@KlasaViti", obj.KlasaViti);
sqlCmd.Parameters.AddWithValue("@Paralelja", obj.Paralelja);
sqlConn.Open();
sqlCmd.ExecuteNonQuery();
sqlConn.Close();
}
}
}
Business Logic Layer "BLL"
namespace BLL
{
public class KlasaIURD
{
public KlasaIURD()
{
}
public static void Shto(Klasa obj)
{
KlasaDB.Shto(obj);
}
}
}
I created the references for the namespaces needed in the project and also I created a testing class but the problem is that I don't know how to access the class method, that means I'm stacked in the following class:
namespace ScoMan_TI.NUnit_Testing
{
[TestFixture]
class Klasa_Testuese
{
Klasa klasa;
[SetUp]
public void initKlasa()
{
//int ID_Klasa = 15;
//int KlasaViti = 12;
//int Paralelja = 5;
//KlasaDB = new KlasaDB()
//KlasaDB.Shto()
//klasa = new Klasa(new Klasa{ID_Klasa, KlasaViti, Paralelja});
}
}
}
Thank you in advance for your reply.
Cheers