[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 507
  • Last Modified:

Could anyone give me a guideline/walkthrough to add a test case from VS2010?

Hi there;

Could anyone give me a guideline/walkthrough to add a test case from VS2010?

As I had a sample application, I want to add that application to my real application. How to do this?

Regards.
0
jazzIIIlove
Asked:
jazzIIIlove
  • 5
  • 4
5 Solutions
 
for_yanCommented:
I'm not sure what you mean about adding a test case from VS2010 ?

Do you want some guidance on how to use VS2010 for C# ?
0
 
disruptCommented:
See this page to create manual test cases

http://msdn.microsoft.com/en-us/library/dd286715.aspx
0
 
jazzIIIloveAuthor Commented:
for_yan:

yep.

Kind regards.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
jazzIIIloveAuthor Commented:
ok, I got a problem, I am not sure whether to say Yes or No for the shot, I try to create unit test for my project and select it during the wizard but I end up with screen. So, what should I do?

Kind regards.
1.png
0
 
for_yanCommented:


http://msdn.microsoft.com/en-us/library/bb385974.aspx

This is explanation (llok also a little bit above it in the same link about testing internal methods through accessor)

When you create a unit test for an internal method in C# or for a friend method in Microsoft Visual Basic, a dialog box appears that allows you to choose between having your internal methods accessed with the private accessor or with the InternalsVisibleToAttribute.


If you choose to have your internal methods accessed with the InternalsVisibleToAttribute, the attribute is added to the AssemblyInfo.cs file. The attribute makes the internal methods in the code that you are testing available to the test project. A new attribute is added for each test project for which you choose this option.

If you choose to have your internal methods accessed with the private accessor, you see the same behavior as described earlier in this article for private methods: a Test References folder is added to your test project, an accessor is added to that folder, and the accessor is referred to in the logic of the unit test method. In this case, the private accessor provides access to both the internal and the private methods that you are testing.

If you have chosen to add the InternalsVisibleToAttribute to your project, you can still create unit tests for internal methods and have them accessed with the private accessor instead. However, you have to do this when you create the unit test. In the Create Unit Test dialog box, click Settings. In the Test Generation Settings dialog box, clear the Honor InternalsVisibleTo Attribute check box.
0
 
jazzIIIloveAuthor Commented:
>>The attribute makes the internal methods in the code that you are testing available to the test project.

Thanks.
0
 
jazzIIIloveAuthor Commented:
So; in fact, to be more clear, in plain english;

InternalsVisibleToAttribute means;

Internals [which are the members of a class in a C# application are] VisibleToAttribute [which is the test project having that Test attribute]

Is it true?

Regards.
0
 
for_yanCommented:
Yes it is true.
But this applies not just to any members of the class, but to those methods which are declared internal - so they cannot be accessed
normally by other classes. So as I undersatdn there are two ways to test them - either with private accessors (see the same link above
http://msdn.microsoft.com/en-us/library/bb385974.aspx - the beginning of the page)  or with this visibleToAttribute.
0
 
jazzIIIloveAuthor Commented:
>> to those methods which are declared internal

E.g. a method that is in a referenced dll which is used by that C# application (not the test application I am taliking about).

Right?

or?

Kind regards.

0
 
for_yanCommented:
No, this is about methods in your application, in your code.
Your test class would often be the oustide class for those methods
and you would not nortmally be able to execute internal methods  from outside class.
So this part is concerned with dealing with such situation.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now