Title: Why I can't add generic class to silverlight unit test project?
Tags: unit-testing;windows-phone-7;generics
Question: I have little problem here.

I have two projects for Windows Phone 7.
One is regular Client appliacation and second is Test project.

Test project can be normal executed. But when i add generic class:

```public class Class1<T&gt;
{

}
```

Then test execution ends with

```Information: Tag expression "All" is in use.
TestInfrastructure: All
TestExecution: Unit Testing
A first chance exception of type 'System.NotSupportedException' occurred in mscorlib.dll
TestExecution: TestGroupLifestyleClient.Test starting
```

No test is executed. On emulator (or device) appear only "test assemblies" (no test names, no nothing).
When I remove the ```<T&gt;``` part from class it works normaly again.

Comment: Is `Class1` a Testclass?

Comment: Would it be stating the obvious to say that it's not supported? :)


Here is another answer: I've encountered the same problem when mocking/stubbing the functionality of a generic class that my unit tests rely on. If the generic class isn't a test class (i.e. annotated [TestClass]) then a work around is to create this generic class in another project in your Visual Studio solution and then make the project with your unit tests reference this new project. The generic class will then be accessible to your tests and runnable.

My solution structure given below

```= Solution 'MobileApp'    
    - MobileAppProject
    - TestProject
    - TestSupportProject
```

Cheers,
Alasdair.


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 2, 'ContentLicense': 'CC BY-SA 2.5', 'CreationDate': '2011:00:03/22/11', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<unit-testing><windows-phone-7><generics>', 'Title': "Why I can't add generic class to silverlight unit test project?", 'ViewCount': 174, 'id': 5392335, 'user_AboutMe': '', 'user_AccountId': 340990.0, 'user_DisplayName': 'Karlvonbahnhof', 'user_Reputation': 94.0, 'user_Views': 12.0, 'user_id': 671321.0}}