**** Merged from MCS ****
[mono-project.git] / mcs / class / corlib / Test / System.Security.Principal / GenericIdentityTest.cs
blob2ab23499c2ed12afdfafc58238a6d110205f087c
1 //
2 // GenericIdentityTest.cs - NUnit Test Cases for GenericIdentity
3 //
4 // Author:
5 // Sebastien Pouliot (spouliot@motus.com)
6 //
7 // (C) 2003 Motus Technologies Inc. (http://www.motus.com)
8 //
10 using NUnit.Framework;
11 using System;
12 using System.Security.Principal;
14 namespace MonoTests.System.Security.Principal {
16 [TestFixture]
17 public class GenericIdentityTest : Assertion {
19 [Test]
20 [ExpectedException (typeof (ArgumentNullException))]
21 public void NullName ()
23 GenericIdentity gi = new GenericIdentity (null);
26 [Test]
27 [ExpectedException (typeof (ArgumentNullException))]
28 public void NullAuthenticationType ()
30 GenericIdentity gi = new GenericIdentity ("user", null);
33 [Test]
34 public void Name ()
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);
42 [Test]
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);
51 [Test]
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);