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