Hi Rusty,
I couldn't get clearly understand on Tony's advice, could you explain me
more detail about this. I have 3 projects separately Yolk.DTO,
Yolk.Data.iBatis, and UnitTest.
I let Yolk.Data.iBatis can access to my internal constructor of my classes
in Yolk.DTO, so I add [assembly: InternalVisibleTo("Yolk.Data.iBatis, Public
Key=.") to assemblyinfo.cs in my Yolk.DTO.
How can I access to internal constructor in sqlMap of iBatis.Net? But I can
access to internal properties. What have I done something wrong?
When I execute my testing I got an error:
IBatisNet.Common.Exceptions.ConfigurationException:
- The error occurred while loading SqlMap.
- Argument property (id) set the typeHandler attribute.
- The error occurred in <sqlMap embedded="Maps.Agreement.xml,
Yolk.Data.iBatis" xmlns="http://ibatis.apache.org/dataMapper" />.
- Check the Agreement.agreementResult.
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Build(XmlDocument
document, DataSource dataSource, Boolean useConfigFileWatcher, Boolean
isCallFromDao)
at IBatisNet.DataMapper.Configuration.DomSqlMapBuilder.Configure(XmlDocument
document)
at Yolk.Data.iBatis.DirectoryMapper.InitMapper() in DirectoryMapper.cs:line
<cref://210B6FE1-9FD6-4DB5-97E1-DF93C954004C/d:Core/f:DirectoryMapper.cs*34*
1> 34
at Yolk.Data.iBatis.DirectoryMapper.Instance() in DirectoryMapper.cs:line
<cref://210B6FE1-9FD6-4DB5-97E1-DF93C954004C/d:Core/f:DirectoryMapper.cs*50*
1> 50
at Yolk.Data.iBatis.AgreementRepository.GetNextAgreementId() in
AgreementRepository.cs:line
<cref://210B6FE1-9FD6-4DB5-97E1-DF93C954004C/f:AgreementRepository.cs*19*1>
19
at UnitTests.AgreementRepositoryTest.GetNextAgreementId() in
AgreementRepositoryTest.cs:line
<cref://32617940-B547-4303-9746-A97F8F86F69E/f:AgreementRepositoryTest.cs*17
*1> 17
IBatisNet.Common.Exceptions.ConfigurationException: Could not configure
ResultMap named "Agreement.agreementResult", Cause: Unable to optimize
create instance. Cause : Could not find public constructor matching
specified arguments for type "Agreement".
Cheers,
Samnang
From: Rusty Wright [mailto:[EMAIL PROTECTED]
Sent: Saturday, July 21, 2007 1:54 AM
To: [email protected]
Subject: Re: internal constructor problem
I had a similar problem with unit tests; see the reply from Tony Bjerstedt
below.
-------- Original Message --------
Subject:
Re: [Nunit-users] name spaces?
Date:
Tue, 17 Jul 2007 18:41:24 -0700
From:
Charlie Poole <mailto:[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>
To:
<mailto:[EMAIL PROTECTED]>
<[EMAIL PROTECTED]>
Hi Rusty,
Tony's advice is good, assuming you are using Visual Studio 2005.
Note that it's only the use of a separate assembly, not a different
namespace that is causing the problem. You can have different namespaces
in a single assembly or one namespace across multiple assemblies.
You handle assembly visibility with references. Namespace visibility
with using (VB=imports) statements.
Charlie
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf
> Of Rusty Wright
> Sent: Tuesday, July 17, 2007 11:20 AM
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: Re: [Nunit-users] name spaces?
>
> Great, sounds like just what I need. Thanks.
>
> [EMAIL PROTECTED] wrote:
> > If your tests are in a different assembly, they no longer
> can see any
> > of the classes that they test. Internal scope only allows other
> > classes in the same assembly to have access to the internal scoped
> > classes and members. You can extend internal visibility to other
> > assemblies using the "InternalsVisibleTo" attribute.
> >
> > Add a statement like:
> > [assembly: InternalsVisibleTo("My.Test.Assembly")]
> > To you "assemblyinfo.cs" file.
> >
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED] On
> Behalf Of Rusty
> > Wright
> > Sent: Tuesday, July 17, 2007 12:29 PM
> > To: [EMAIL PROTECTED]
> > Subject: [Nunit-users] name spaces?
> >
> > How do people manage their name spaces with NUnit? I have
> a class in
> > the namespace ShopsiteOrderApi that I'm testing and my unit
> tests are
> > in
> >
> > the namespace Tests. I tried changing the class in the
> > ShopsiteOrderApi
> >
> > from public to internal but now the test won't compile.
> >
> >
> ----------------------------------------------------------------------
> > --
> > -
> > This SF.net email is sponsored by DB2 Express Download DB2
> Express C -
> > the FREE version of DB2 express and take control of your XML. No
> > limits. Just data. Click to get it now.
> > http://sourceforge.net/powerbar/db2/
> > _______________________________________________
> > Nunit-users mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/nunit-users
> >
>
> --------------------------------------------------------------
> -----------
> This SF.net email is sponsored by DB2 Express Download DB2
> Express C - the FREE version of DB2 express and take control
> of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Nunit-users mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/nunit-users
>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Nunit-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nunit-users