Wed Feb 24 15:47:16 CET 2010 Paolo Molaro <lupus@ximian.com>
[mono.git] / mcs / class / System.Web / Test / mainsoft / NunitWeb / NunitWeb / TestRoleProvider.cs
1 #if NET_2_0
2
3 using System;
4 using System.Collections.Specialized;
5 using System.Configuration.Provider;
6 using System.Web.Security;
7
8 namespace MonoTests.SystemWeb.Framework
9 {
10         public class TestRoleProvider : RoleProvider
11         {
12                 public override string ApplicationName
13                 {
14                         get;
15                         set;
16                 }
17
18                 public override void AddUsersToRoles(string[] usernames, string[] roleNames)
19                 {
20                         throw new Exception ("Not implemented yet.");
21                 }
22
23                 public override void CreateRole (string roleName)
24                 {
25                         throw new Exception ("Not implemented yet.");
26                 }
27
28                 public override bool DeleteRole (string roleName, bool throwOnPopulatedRole)
29                 {
30                         throw new Exception ("Not implemented yet.");
31                 }
32
33                 public override string[] FindUsersInRole (string roleName, string usernameToMatch)
34                 {
35                         throw new Exception ("Not implemented yet.");
36                 }
37
38                 public override string[] GetAllRoles ()
39                 {
40                         throw new Exception ("Not implemented yet.");
41                 }
42
43                 public override string[] GetRolesForUser (string username)
44                 {
45                         throw new Exception ("Not implemented yet.");
46                 }
47
48                 public override string[] GetUsersInRole (string roleName)
49                 {
50                         throw new Exception ("Not implemented yet.");
51                 }
52
53                 public override bool IsUserInRole (string username, string roleName)
54                 {
55                         if (username == null)
56                                 throw new ArgumentNullException ("Username cannot be null.");
57                         if (roleName == null)
58                                 throw new ArgumentNullException ("Role name cannot be null.");
59                         if (username == string.Empty)
60                                 throw new ArgumentException ("Username cannot be empty.");
61                         if (roleName == string.Empty)
62                                 throw new ArgumentException ("Role name cannot be empty.");
63                         if (username == "invalid")
64                                 throw new ProviderException ("User does not exist.");
65                         if (roleName == "invalid")
66                                 throw new ProviderException ("Role does not exist.");
67                         if (username == "true")
68                                 return true;
69                         return false;
70                 }
71
72                 public override void RemoveUsersFromRoles (string[] usernames, string[] roleNames)
73                 {
74                         throw new Exception ("Not implemented yet.");
75                 }
76
77                 public override bool RoleExists (string roleName)
78                 {
79                         throw new Exception ("Not implemented yet.");
80                 }
81         }
82 }
83 #endif