[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

WindowsIdentity

Posted on 2007-10-19
7
Medium Priority
?
215 Views
Last Modified: 2013-11-07
Hi experts ..

Is it possible to write a code (sceniaro) that will force WindowsIdentity.GetCurrent() method to throw exception?


thanx~
0
Comment
Question by:DrAske
  • 4
  • 3
7 Comments
 
LVL 21

Expert Comment

by:surajguptha
ID: 20110451
I am curious. why would you want that to happen?
0
 
LVL 9

Author Comment

by:DrAske
ID: 20110557
testing purpose :o)
0
 
LVL 9

Author Comment

by:DrAske
ID: 20110581
This code is part of a component and want to make sure that specific exception will be thrown when that method failed.
0
Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

 
LVL 21

Accepted Solution

by:
surajguptha earned 2000 total points
ID: 20110694
Why not add a
try catch block around WindowsIdentity.GetCurrent()  and throw a custom "Unable to fetch identity" ??
0
 
LVL 9

Author Comment

by:DrAske
ID: 20110816
actually this is what I am doing, any exception thrown by this method will be wrapped in a custom exception
I just wanted to write a test case for this code but it seems to it is not that easy!!

 thanx :o)
0
 
LVL 21

Expert Comment

by:surajguptha
ID: 20111051
well you may not force that method to throw a exception. Instead why not manually throw an exception using the throw statement to simulate a exception and see what happens
0
 
LVL 9

Author Comment

by:DrAske
ID: 20111414
This is not what I want in my case!! actually I am writing unit test cases for the component and the coverage percent should be >80% (already achaived), I just wanted to make the coverage percent 100% :o)

really appreciate your time and help :o)
Regards,
0

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses
Course of the Month19 days, 6 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question