2 // GenericIdentityTest.cs - NUnit Test Cases for GenericIdentity
5 // Sebastien Pouliot (spouliot@motus.com)
7 // (C) 2003 Motus Technologies Inc. (http://www.motus.com)
10 using NUnit
.Framework
;
12 using System
.Security
.Principal
;
14 namespace MonoTests
.System
.Security
.Principal
{
17 public class GenericIdentityTest
: Assertion
{
20 [ExpectedException (typeof (ArgumentNullException
))]
21 public void NullName ()
23 GenericIdentity gi
= new GenericIdentity (null);
27 [ExpectedException (typeof (ArgumentNullException
))]
28 public void NullAuthenticationType ()
30 GenericIdentity gi
= new GenericIdentity ("user", null);
36 GenericIdentity gi
= new GenericIdentity ("user");
37 AssertEquals ("Name.Name", "user", gi
.Name
);
38 AssertEquals ("Name.AuthenticationType", "", gi
.AuthenticationType
);
39 Assert ("Name.IsAuthenticated", gi
.IsAuthenticated
);
43 public void NameAuthenticationType ()
45 GenericIdentity gi
= new GenericIdentity ("user", "blood oath");
46 AssertEquals ("NameAuthenticationType.Name", "user", gi
.Name
);
47 AssertEquals ("NameAuthenticationType.AuthenticationType", "blood oath", gi
.AuthenticationType
);
48 Assert ("NameAuthenticationType.IsAuthenticated", gi
.IsAuthenticated
);
52 public void EmptyName ()
54 GenericIdentity gi
= new GenericIdentity ("");
55 AssertEquals ("EmptyName.Name", "", gi
.Name
);
56 AssertEquals ("EmptyName.AuthenticationType", "", gi
.AuthenticationType
);
57 Assert ("EmptyName.IsAuthenticated", !gi
.IsAuthenticated
);