Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Services.Authentication Prototype/UnitTests/HeuristicLabRoleProviderTest.cs @ 3951

Last change on this file since 3951 was 3951, checked in by bfarka, 14 years ago

changed persistence for roles and implemented first Method in RoleProvider --> FinAllUsers (#1046)

File size: 8.5 KB
Line 
1using Service.Provider;
2using Microsoft.VisualStudio.TestTools.UnitTesting;
3namespace UnitTests {
4  /// <summary>
5  ///This is a test class for HeuristicLabRoleProviderTest and is intended
6  ///to contain all HeuristicLabRoleProviderTest Unit Tests
7  ///</summary>
8  [TestClass()]
9  public class HeuristicLabRoleProviderTest : AbstractHeuristicLabTest {
10    private TestContext testContextInstance;
11    private const string TEST_ROLE_NAME = "testRole";
12    /// <summary>
13    ///Gets or sets the test context which provides
14    ///information about and functionality for the current test run.
15    ///</summary>
16    public TestContext TestContext {
17      get {
18        return testContextInstance;
19      }
20      set {
21        testContextInstance = value;
22      }
23    }
24
25    #region Additional test attributes
26    //
27    //You can use the following additional attributes as you write your tests:
28    //
29    //Use ClassInitialize to run code before running the first test in the class
30    //[ClassInitialize()]
31    //public static void MyClassInitialize(TestContext testContext)
32    //{
33    //}
34    //
35    //Use ClassCleanup to run code after all tests in a class have run
36    //[ClassCleanup()]
37    //public static void MyClassCleanup()
38    //{
39    //}
40    //
41    //Use TestInitialize to run code before running each test
42    //[TestInitialize()]
43    //public void MyTestInitialize()
44    //{
45    //}
46    //
47    //Use TestCleanup to run code after each test has run
48    //[TestCleanup()]
49    //public void MyTestCleanup()
50    //{
51    //}
52    //
53    #endregion
54
55
56    /// <summary>
57    ///A test for ApplicationName
58    ///</summary>
59    [TestMethod()]
60    public void ApplicationNameTest() {
61      HeuristicLabRoleProvider target = new HeuristicLabRoleProvider(); // TODO: Initialize to an appropriate value
62      string expected = string.Empty; // TODO: Initialize to an appropriate value
63      string actual;
64      target.ApplicationName = expected;
65      actual = target.ApplicationName;
66      Assert.AreEqual(expected, actual);
67      Assert.Inconclusive("Verify the correctness of this test method.");
68    }
69
70    /// <summary>
71    ///tests if the RoleExits method works --> test is done in a positiv and negativ way
72    ///</summary>
73    [TestMethod()]
74    public void RoleExistsTest() {
75      HeuristicLabRoleProvider target = new HeuristicLabRoleProvider();
76      Persistence.HeuristicLabRole role = new Persistence.HeuristicLabRole();
77      role.RoleName = TEST_ROLE_NAME;
78      Persistence.DataClassesDataContext db = Persistence.DatabaseUtil.createDataClassesDataContext();
79      db.HeuristicLabRole.InsertOnSubmit((Persistence.HeuristicLabRole)role);
80      db.SubmitChanges();
81      Assert.IsTrue(target.RoleExists(TEST_ROLE_NAME));
82      Assert.IsFalse(target.RoleExists(TEST_ROLE_NAME + TEST_ROLE_NAME));
83    }
84
85    /// <summary>
86    ///A test for RemoveUsersFromRoles
87    ///</summary>
88    [TestMethod()]
89    public void RemoveUsersFromRolesTest() {
90      HeuristicLabRoleProvider target = new HeuristicLabRoleProvider(); // TODO: Initialize to an appropriate value
91      string[] usernames = null; // TODO: Initialize to an appropriate value
92      string[] roleNames = null; // TODO: Initialize to an appropriate value
93      target.RemoveUsersFromRoles(usernames, roleNames);
94      Assert.Inconclusive("A method that does not return a value cannot be verified.");
95    }
96
97    /// <summary>
98    ///A test for IsUserInRole
99    ///</summary>
100    [TestMethod()]
101    public void IsUserInRoleTest() {
102      HeuristicLabRoleProvider target = new HeuristicLabRoleProvider(); // TODO: Initialize to an appropriate value
103      string username = string.Empty; // TODO: Initialize to an appropriate value
104      string roleName = string.Empty; // TODO: Initialize to an appropriate value
105      bool expected = false; // TODO: Initialize to an appropriate value
106      bool actual;
107      actual = target.IsUserInRole(username, roleName);
108      Assert.AreEqual(expected, actual);
109      Assert.Inconclusive("Verify the correctness of this test method.");
110    }
111
112    /// <summary>
113    ///A test for GetUsersInRole
114    ///</summary>
115    [TestMethod()]
116    public void GetUsersInRoleTest() {
117      HeuristicLabRoleProvider target = new HeuristicLabRoleProvider(); // TODO: Initialize to an appropriate value
118      string roleName = string.Empty; // TODO: Initialize to an appropriate value
119      string[] expected = null; // TODO: Initialize to an appropriate value
120      string[] actual;
121      actual = target.GetUsersInRole(roleName);
122      Assert.AreEqual(expected, actual);
123      Assert.Inconclusive("Verify the correctness of this test method.");
124    }
125
126    /// <summary>
127    ///A test for GetRolesForUser
128    ///</summary>
129    [TestMethod()]
130    public void GetRolesForUserTest() {
131      HeuristicLabRoleProvider target = new HeuristicLabRoleProvider(); // TODO: Initialize to an appropriate value
132      string username = string.Empty; // TODO: Initialize to an appropriate value
133      string[] expected = null; // TODO: Initialize to an appropriate value
134      string[] actual;
135      actual = target.GetRolesForUser(username);
136      Assert.AreEqual(expected, actual);
137      Assert.Inconclusive("Verify the correctness of this test method.");
138    }
139
140    /// <summary>
141    ///A test for GetAllRoles
142    ///</summary>
143    [TestMethod()]
144    public void GetAllRolesTest() {
145      HeuristicLabRoleProvider target = new HeuristicLabRoleProvider(); // TODO: Initialize to an appropriate value
146      string[] expected = null; // TODO: Initialize to an appropriate value
147      string[] actual;
148      actual = target.GetAllRoles();
149      Assert.AreEqual(expected, actual);
150      Assert.Inconclusive("Verify the correctness of this test method.");
151    }
152
153    /// <summary>
154    ///A test for FindUsersInRole
155    ///</summary>
156    [TestMethod()]
157    public void FindUsersInRoleTest() {
158      HeuristicLabRoleProvider target = new HeuristicLabRoleProvider(); // TODO: Initialize to an appropriate value
159      string roleName = string.Empty; // TODO: Initialize to an appropriate value
160      string usernameToMatch = string.Empty; // TODO: Initialize to an appropriate value
161      string[] expected = null; // TODO: Initialize to an appropriate value
162      string[] actual;
163      actual = target.FindUsersInRole(roleName, usernameToMatch);
164      Assert.AreEqual(expected, actual);
165      Assert.Inconclusive("Verify the correctness of this test method.");
166    }
167
168    /// <summary>
169    ///A test for DeleteRole
170    ///</summary>
171    [TestMethod()]
172    public void DeleteRoleTest() {
173      HeuristicLabRoleProvider target = new HeuristicLabRoleProvider(); // TODO: Initialize to an appropriate value
174      string roleName = string.Empty; // TODO: Initialize to an appropriate value
175      bool throwOnPopulatedRole = false; // TODO: Initialize to an appropriate value
176      bool expected = false; // TODO: Initialize to an appropriate value
177      bool actual;
178      actual = target.DeleteRole(roleName, throwOnPopulatedRole);
179      Assert.AreEqual(expected, actual);
180      Assert.Inconclusive("Verify the correctness of this test method.");
181    }
182
183    /// <summary>
184    ///A test for CreateRole
185    ///</summary>
186    [TestMethod()]
187    public void CreateRoleTest() {
188      HeuristicLabRoleProvider target = new HeuristicLabRoleProvider(); // TODO: Initialize to an appropriate value
189      string roleName = string.Empty; // TODO: Initialize to an appropriate value
190      target.CreateRole(roleName);
191      Assert.Inconclusive("A method that does not return a value cannot be verified.");
192    }
193
194    /// <summary>
195    ///A test for AddUsersToRoles
196    ///</summary>
197    [TestMethod()]
198    public void AddUsersToRolesTest() {
199      HeuristicLabRoleProvider target = new HeuristicLabRoleProvider(); // TODO: Initialize to an appropriate value
200      string[] usernames = null; // TODO: Initialize to an appropriate value
201      string[] roleNames = null; // TODO: Initialize to an appropriate value
202      target.AddUsersToRoles(usernames, roleNames);
203      Assert.Inconclusive("A method that does not return a value cannot be verified.");
204    }
205
206    /// <summary>
207    ///A test for HeuristicLabRoleProvider Constructor
208    ///</summary>
209    [TestMethod()]
210    public void HeuristicLabRoleProviderConstructorTest() {
211      HeuristicLabRoleProvider target = new HeuristicLabRoleProvider();
212      Assert.Inconclusive("TODO: Implement code to verify target");
213    }
214  }
215}
Note: See TracBrowser for help on using the repository browser.