Click here to Skip to main content
15,895,746 members
Home / Discussions / C#
   

C#

 
GeneralRe: Help in matching inputted string to a regex pattern Pin
gamer11275-Aug-09 4:00
gamer11275-Aug-09 4:00 
GeneralRe: Help in matching inputted string to a regex pattern Pin
riced5-Aug-09 4:22
riced5-Aug-09 4:22 
GeneralRe: Help in matching inputted string to a regex pattern Pin
gamer11275-Aug-09 4:39
gamer11275-Aug-09 4:39 
GeneralRe: Help in matching inputted string to a regex pattern Pin
riced5-Aug-09 4:44
riced5-Aug-09 4:44 
QuestionSerializationBinder and parsing type fullname Pin
Super Lloyd5-Aug-09 1:46
Super Lloyd5-Aug-09 1:46 
AnswerRe: SerializationBinder and parsing type fullname Pin
Super Lloyd5-Aug-09 4:00
Super Lloyd5-Aug-09 4:00 
GeneralRe: SerializationBinder and parsing type fullname Pin
Super Lloyd5-Aug-09 5:27
Super Lloyd5-Aug-09 5:27 
QuestionHow to test Web Methods with NUnit Pin
Phillip Donegan5-Aug-09 1:26
Phillip Donegan5-Aug-09 1:26 
Hi all,

In my solution I already have lots of business object unit tests. However I also want to test the web service layer. So to do this I've added another project to the solution and added a project reference to the web service layer. So now I can see all the web methods.

The problem I have is that when I want to go to the database my method GetDAOFactory() always returns null. I think this is because the global file inherits the HttpApplication class. E.G.

Try and get the customer or create a new one
1)

private Customer GetCustomerInSession()
{
Customer customer = Session[PropertyCustomer] as Customer;
if (customer == null)
{
Session[PropertyCustomer] = customer = new Customer(GetDAOFactory());
}
return customer;
}

Get the DAO Factory this returns null
2)

private IDAOFactory GetDAOFactory()
{
return Application[Global.DAOFactorySetting] as IDAOFactory;
}

I think the reason is because global inherits HttpApplication
3)

public class Global : HttpApplication
{

protected void Application_Start(object sender, EventArgs e)
{
// create data access implementation
string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["DevBox"].ConnectionString;
Application[DAOFactorySetting] = new ADODAOFactory(ProviderType.SqlServer, connectionString);
}

protected void Application_End(object sender, EventArgs e)
{

}

public static readonly string DAOFactorySetting = "DAOFactory";
}

Any ideas why its returning null?

I've thought of one solution and that would be to change the reference to a web reference. The only problem then is that I would either have to add a localhost web reference which wouldn't work with the CI build. Or to reference the published development app layer, but that would mean that when I change my code I wouldn't be able to test it until it was committed!!

Any help would be greatly appreciated. I'm using C#.Net 2.0 with NUnit 2.4.7

Phil

P.S. I've copied the connectionString DevBox to the App.config in the WebServiceTests project so that it can see it.
Questionbyte array To text box is it possible? Pin
gwithey5-Aug-09 1:24
gwithey5-Aug-09 1:24 
AnswerRe: byte array To text box is it possible? Pin
musefan5-Aug-09 2:16
musefan5-Aug-09 2:16 
QuestionConvert String To Unix Timestamp Pin
iNutR5-Aug-09 0:27
iNutR5-Aug-09 0:27 
AnswerRe: Convert String To Unix Timestamp Pin
Christian Graus5-Aug-09 0:31
protectorChristian Graus5-Aug-09 0:31 
GeneralRe: Convert String To Unix Timestamp Pin
iNutR5-Aug-09 0:36
iNutR5-Aug-09 0:36 
GeneralRe: Convert String To Unix Timestamp Pin
Christian Graus5-Aug-09 0:39
protectorChristian Graus5-Aug-09 0:39 
GeneralRe: Convert String To Unix Timestamp Pin
iNutR5-Aug-09 0:41
iNutR5-Aug-09 0:41 
GeneralRe: Convert String To Unix Timestamp Pin
Christian Graus5-Aug-09 0:47
protectorChristian Graus5-Aug-09 0:47 
GeneralRe: Convert String To Unix Timestamp Pin
iNutR5-Aug-09 0:54
iNutR5-Aug-09 0:54 
GeneralRe: Convert String To Unix Timestamp Pin
Christian Graus5-Aug-09 1:00
protectorChristian Graus5-Aug-09 1:00 
GeneralRe: Convert String To Unix Timestamp Pin
Michael Bookatz5-Aug-09 2:35
Michael Bookatz5-Aug-09 2:35 
GeneralRe: Convert String To Unix Timestamp Pin
stancrm5-Aug-09 0:52
stancrm5-Aug-09 0:52 
GeneralRe: Convert String To Unix Timestamp Pin
iNutR5-Aug-09 0:57
iNutR5-Aug-09 0:57 
GeneralRe: Convert String To Unix Timestamp Pin
Christian Graus5-Aug-09 1:01
protectorChristian Graus5-Aug-09 1:01 
GeneralRe: Convert String To Unix Timestamp Pin
iNutR5-Aug-09 1:47
iNutR5-Aug-09 1:47 
GeneralRe: Convert String To Unix Timestamp Pin
Michael Bookatz5-Aug-09 2:36
Michael Bookatz5-Aug-09 2:36 
AnswerRe: Convert String To Unix Timestamp Pin
Luc Pattyn5-Aug-09 4:26
sitebuilderLuc Pattyn5-Aug-09 4:26 

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.