Hey, I put my NHibernate data access class in WCF service to can consume it by Silverlight project, but I have error and want to test my queries.
It is possible to test this queries in service class using NUnit ? Earlier I test normally this class but how do it when it is in service class ??
It's my WCF service class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using DataTransfer;
using NHibernate;
using NHibernate.Cfg;
using System.Diagnostics;
namespace WcfService1
{
public class Service1 : IService1
{
private ISession _session;
public Service1()
{
try
{
_session = (new Configuration()).Configure().BuildSessionFactory().OpenSession();
}
catch (Exception e)
{
Debug.Write(e);
throw;
}
}
public IList<Dziecko> GetChildByFirstname(string _firstname)
{
return _session.CreateCriteria(typeof(Dziecko))
.Add(NHibernate.Criterion.Expression.Eq("Imie", _firstname)).List<Dziecko>();
}
public IList<Dziecko> GetChildByLastname(string _lastname)
{
return _session.CreateCriteria(typeof(Dziecko))
.Add(NHibernate.Criterion.Expression.Eq("Nazwisko", _lastname)).List<Dziecko>();
}
public IList<Dziecko> GetChildByFirstnameAndLastname(string _firstname, string _lastname)
{
return _session.CreateCriteria(typeof(Dziecko))
.Add(NHibernate.Criterion.Expression.Eq("Imie", _firstname)).Add(NHibernate.Criterion.Expression.Eq("Nazwisko", _lastname)).List<Dziecko>();
}
}
}