From: <gc...@us...> - 2003-02-13 16:21:39
|
Update of /cvsroot/dotnetmock/dotnetmock/DotNetMock/Security/Principal In directory sc8-pr-cvs1:/tmp/cvs-serv17685/DotNetMock/Security/Principal Modified Files: MockIIdentity.cs MockIPrincipal.cs Log Message: Added XML Comments to MockIIDentity & MockIPrincipal Index: MockIIdentity.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Security/Principal/MockIIdentity.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MockIIdentity.cs 13 Feb 2003 03:33:47 -0000 1.1 --- MockIIdentity.cs 13 Feb 2003 16:21:32 -0000 1.2 *************** *** 5,32 **** namespace DotNetMock.Security.Principal { public class MockIIdentity : MockObject, IIdentity { private string _expectedAuthType = ""; private string _expectedName = ""; ! private bool _expectedIsAuth = false; ! public MockIIdentity() { this.name = "MockIdentity"; } public void SetExpectedAuthenticationType( string authType ) { _expectedAuthType = authType; } public void SetExpectedIsAuthenticated( bool isAuth ) { _expectedIsAuth = isAuth; } public void SetExpectedName( string name ) { _expectedName = name; } #region Implementation of IIdentity public bool IsAuthenticated { --- 5,63 ---- namespace DotNetMock.Security.Principal { + /// <summary> + /// MockObject implementing the IIdentity interface. Since the IIdentity interface only includes getters, + /// this MockObject does not do much. + /// </summary> public class MockIIdentity : MockObject, IIdentity { + /// <summary> + /// The expected AuthenticationType + /// </summary> private string _expectedAuthType = ""; + /// <summary> + /// The expected Name + /// </summary> private string _expectedName = ""; ! /// <summary> ! /// The expected value for IsAuthenticated ! /// </summary> private bool _expectedIsAuth = false; ! /// <summary> ! /// Default Constructor ! /// </summary> public MockIIdentity() { this.name = "MockIdentity"; } + #region Mock Methods + /// <summary> + /// Sets the expected AuthenticationType value to return + /// </summary> + /// <param name="authType">Authentication Type to return</param> public void SetExpectedAuthenticationType( string authType ) { _expectedAuthType = authType; } + /// <summary> + /// Sets the expected IsAuthenticated value to return + /// </summary> + /// <param name="isAuth">IsAuthenticated value to return</param> public void SetExpectedIsAuthenticated( bool isAuth ) { _expectedIsAuth = isAuth; } + /// <summary> + /// Sets the expected Name value to return + /// </summary> + /// <param name="name">Name value to return</param> public void SetExpectedName( string name ) { _expectedName = name; } + #endregion #region Implementation of IIdentity + /// <summary> + /// Returns true/false if the current Identity is Authenticated or not + /// </summary> public bool IsAuthenticated { *************** *** 36,40 **** } } ! public string Name { --- 67,73 ---- } } ! /// <summary> ! /// Returns the name of the current Identity ! /// </summary> public string Name { *************** *** 44,48 **** } } ! public string AuthenticationType { --- 77,83 ---- } } ! /// <summary> ! /// Returns the current Authentication Type ! /// </summary> public string AuthenticationType { Index: MockIPrincipal.cs =================================================================== RCS file: /cvsroot/dotnetmock/dotnetmock/DotNetMock/Security/Principal/MockIPrincipal.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MockIPrincipal.cs 13 Feb 2003 02:56:38 -0000 1.1 --- MockIPrincipal.cs 13 Feb 2003 16:21:33 -0000 1.2 *************** *** 6,16 **** namespace DotNetMock.Security.Principal { public class MockIPrincipal : MockObject, IPrincipal { private IIdentity _expectedIdentity = null; private ExpectationCounter _isInRoleCalls = new ExpectationCounter("MockIPrincipal.IsIsRoleCalls"); ! private ArrayList _roles = null; ! public MockIPrincipal() { --- 6,29 ---- namespace DotNetMock.Security.Principal { + /// <summary> + /// Mock Object to implement the IPrincipal interface + /// </summary> public class MockIPrincipal : MockObject, IPrincipal { + /// <summary> + /// Current Identity associated with this Principal + /// </summary> private IIdentity _expectedIdentity = null; + /// <summary> + /// Expected number of IsInRole() calls + /// </summary> private ExpectationCounter _isInRoleCalls = new ExpectationCounter("MockIPrincipal.IsIsRoleCalls"); ! /// <summary> ! /// Lists of roles the current Principal belongs to ! /// </summary> private ArrayList _roles = null; ! /// <summary> ! /// Default Constructor ! /// </summary> public MockIPrincipal() { *************** *** 19,34 **** --- 32,63 ---- } #region MockMethods + /// <summary> + /// Sets the expected value of Identity to return + /// </summary> + /// <param name="identity">Identity for current Principal</param> public void SetExpectedIdentity( IIdentity identity ) { _expectedIdentity = identity; } + /// <summary> + /// Sets the number of calls to IsInRole() + /// </summary> + /// <param name="count">expected number of calls to IsInRol()</param> public void SetExpectedIsInRoleCount( int count ) { _isInRoleCalls.Expected = count; } + /// <summary> + /// Adds the given role to the list of roles this Principal belongs to + /// </summary> + /// <param name="role">role to add</param> public void AddExpectedRole( string role ) { _roles.Add( role ); } + /// <summary> + /// Adds the given roles to the list of roles this Principal belongs to + /// </summary> + /// <param name="roles"></param> public void AddExpectedRoles( string[] roles ) { *************** *** 40,43 **** --- 69,77 ---- #endregion #region Implementation of IPrincipal + /// <summary> + /// Returns true/false if the current principal belongs to the given role + /// </summary> + /// <param name="roleToSearch">Role to check for</param> + /// <returns>True/False</returns> public bool IsInRole(string roleToSearch) { *************** *** 53,57 **** return found; } ! public System.Security.Principal.IIdentity Identity { --- 87,93 ---- return found; } ! /// <summary> ! /// Returns the current Identity associated with this Principal ! /// </summary> public System.Security.Principal.IIdentity Identity { |