473,505 Members | 13,805 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

nunit deploy and accessibility modifiers

Hi, I have a DLL project that implements the Model/Controller part of
MVC, and the client of the DLL would be the View. The interface the
View consumes is the Controller API, and the Model is marked internal,
b/c the View shouldn't need to get at it, but this means I can no
longer test the Model unless my NUnit tests exist inside the DLL
project.

This has the unwanted side-effect of having to deploy nunit.framework,
nunit.core along with the DLL.

If I move the tests out into a separate project, the NUnit tests that
run against the model no longer work b/c the model is not accessible.

Is there some compromise to this solution? Is it possible to fiddle
around with VS2005 DEBUG/RELEASE settings to solve this, or is there
another way?

Thx in advance,
Davis

Jun 18 '06 #1
4 1781
what about something like:
[assembly: InternalsVisibleTo("TheUnitTestLirary")]?

Alternatively the unit tests could be in the main library but be compiled
only in debug mode
with either of:
#if DEBUG
or
[Conditional("DEBUG")]

"Davis Ford" <da*******@gmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
Hi, I have a DLL project that implements the Model/Controller part of
MVC, and the client of the DLL would be the View. The interface the
View consumes is the Controller API, and the Model is marked internal,
b/c the View shouldn't need to get at it, but this means I can no
longer test the Model unless my NUnit tests exist inside the DLL
project.

This has the unwanted side-effect of having to deploy nunit.framework,
nunit.core along with the DLL.

If I move the tests out into a separate project, the NUnit tests that
run against the model no longer work b/c the model is not accessible.

Is there some compromise to this solution? Is it possible to fiddle
around with VS2005 DEBUG/RELEASE settings to solve this, or is there
another way?

Thx in advance,
Davis

Jun 18 '06 #2
"Davis Ford" <da*******@gmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
Hi, I have a DLL project that implements the Model/Controller part of
MVC, and the client of the DLL would be the View. The interface the
View consumes is the Controller API, and the Model is marked internal,
b/c the View shouldn't need to get at it, but this means I can no
longer test the Model unless my NUnit tests exist inside the DLL
project.


The tests should not be in the same assembly as the Model, because, as you
note, you don't want to have to deploy NUnit.

However, the tests are a client of the model. Unlike with C++, there's no
way to grant access on a class-by-class basis. Hence, you have only once
choice -- make the Model public.

It would be nice if it were impossible then for the View to access the
Model, but there's no way to do that, so you have to live with it. It's not
a big deal in practice - View isn't like a living, breathing voyeur who's
just dying to peak inside your business objects. :)

///ark
Jun 18 '06 #3

Mark Wilden wrote:
"Davis Ford" <da*******@gmail.com> wrote in message
news:11**********************@i40g2000cwc.googlegr oups.com...
Hi, I have a DLL project that implements the Model/Controller part of
MVC, and the client of the DLL would be the View. The interface the
View consumes is the Controller API, and the Model is marked internal,
b/c the View shouldn't need to get at it, but this means I can no
longer test the Model unless my NUnit tests exist inside the DLL
project.


The tests should not be in the same assembly as the Model, because, as you
note, you don't want to have to deploy NUnit.

However, the tests are a client of the model. Unlike with C++, there's no
way to grant access on a class-by-class basis. Hence, you have only once
choice -- make the Model public.

It would be nice if it were impossible then for the View to access the
Model, but there's no way to do that, so you have to live with it. It's not
a big deal in practice - View isn't like a living, breathing voyeur who's
just dying to peak inside your business objects. :)

///ark


I still don't like the idea of making the Model public, simply b/c it
can make for a more confusing API and set of documentation. In some
cases the method called on the Controller is passed through to the same
method on the Model b/c it has no "controller activity" to do. This
can perhaps be confusing -- it is simpler/cleaner if the View looks at
a simple API containing only those things that are relevant to it.

Regards,
Davis

Jun 18 '06 #4
"Davis Ford" <da*******@gmail.com> wrote in message
news:11*********************@f6g2000cwb.googlegrou ps.com...

I still don't like the idea of making the Model public, simply b/c it
can make for a more confusing API and set of documentation. In some
cases the method called on the Controller is passed through to the same
method on the Model b/c it has no "controller activity" to do. This
can perhaps be confusing -- it is simpler/cleaner if the View looks at
a simple API containing only those things that are relevant to it.


I agree, but I don't see what choice you have.
Jun 18 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
494
by: Klas Mellbourn | last post by:
I have several assemblies, in separate dll:s, each with nunit tests embedded. Every assembly requires its own config file. I would like to run all nunit tests on the same command line. Like this: ...
7
1497
by: ian_malcom_im | last post by:
Hi all i'm reading up on the internals of the CLR and I noticed that it is possible to make a class have the famandassem accessibility modifier. I've looked at the C# language reference and I...
3
1919
by: Finn J Johnsen | last post by:
Hi Dow do I get ndoc to ignore classes flagged with the attribute? Thanks, Finn Johnsen
0
1647
by: Ray Tayek | last post by:
hi, getting a: .\Stdafx.cpp : fatal error C1192: #using failed on 'i: nunit\samples\cpp-sample"' 'The filename, directory name, or volume label syntax is incorrect.' nunit is installed in...
6
8335
by: Ray Tayek | last post by:
hi, i am preparing to teach a class in c++ and would like to intoduce some unit testing. i can make unit tests in c# using this dll and nant from the command line. i am using visual c++ 2005...
20
1981
by: Parag | last post by:
Hi, I am trying to figure out best testing tool for my project. I have narrowed down my requirements to two tools NUNIT and VSTS unit. But I have used neither and I have to use only one of them....
2
5146
by: JohnGoogle | last post by:
Hi, I'm a newbie so sorry if there is a simple answer to this! I'm using C# in Visual Studio Express at the moment. I've downloaded NUnit v 2.2.8 and can load and run the tests they supply...
2
1467
by: Steve | last post by:
Hi All, I'm starting a new project and want to separate my NUnit testing stuff so I can perform testing in the debug version but not have testing code deployed in the Release build. I vaguely...
9
5125
by: dylan.miller | last post by:
I'm having trouble understanding the internal access modifier. There are many classes in my assembly that should not be accessible outside of the assembly. I've used the internal access modifier...
0
7213
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5610
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5026
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4698
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
406
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.