DCSIMG
April 2009 - Posts - Tamir Shlomi's Blog

Tamir Shlomi's Blog

Welcome to Tamir Shlomi's blog. All about .NET, OOP and SQL server

April 2009 - Posts

OwnerAttribute Or: How To Own Visual Studio 2008 Unit Test

When working on a large project with a lot of test methods, that each one of them might be under the responsibility of another developer, finding your own unit test methods in the endless list is just like finding a needle in a haystack.

This can be easily become much simple.

When creating unit test for a process, Visual Studio generates unit test method decorated with the TestMethodAttribute. Now, to “own” the unit test, just add new attribute named “OwnerAttribute” which specify the person responsible for the process behind that unit test.

Sample:

[TestMethod]
[Owner("Tamir Shlomi")]
public void UnitTestMethod()
{
    ...
}

Now, after you marked all your unit test with the OwnerAttribute, all you need to do to find your own unit tests is opening the TestView window (Test –> Windows –> TestView) and filter by Owner using the name you supplied at the OwnerAttribute and only yours unit tests will be listed, ready for running.

Hope this helps,
Tamir Shlomi

Error: "Ajax client-side framework failed to load" After Login

“Ajax client-side framework failed to load”.
If you encountered with the error message above after login to your site and you're using the ASP.NET membership framework (and you verified that MS AJAX is properly installed),
you can add the following configuration section to your web.config:

<configuration>
...
  <location path="ScriptResource.axd">
     <system.web>
       <authorization>
         <allow users="*"/>
       </authorization>
     </system.web>
   </location>
...
</configuration> 

This configuration setting allows any user accessing the ScriptResource.axd file
who’s required for the AJAX client side framework to load, as when the website deny unauthorized users from accessing the required web page and redirect them back into the login page the required script files might not be downloaded for them and the above error may occur.
Allowing access to this file for any user may fix this problem. 

Hope this helps,
Tamir Shlomi