public void ResetPasswordForUnknownSession()
        {
            ExternalFileSecurityManager manager = new ExternalFileSecurityManager();
            string session = InitialiseManagerAndLogin(manager);

            Assert.That(delegate { manager.ResetPassword("unknown", "johndoe", "whoami"); },
                        Throws.TypeOf <SessionInvalidException>());
        }
        public void ResetPasswordWithoutPermission()
        {
            ExternalFileSecurityManager manager = new ExternalFileSecurityManager();
            string session = InitialiseManagerAndLogin(manager);

            Assert.That(delegate { manager.ResetPassword(session, "johndoe", "whoami"); },
                        Throws.TypeOf <PermissionDeniedException>());
        }
        public void ResetPasswordWithValidDetails()
        {
            ExternalFileSecurityManager manager = new ExternalFileSecurityManager();
            string session = InitialiseManagerAndLogin(manager, "janedoe");

            manager.ResetPassword(session, "johndoe", "whoami");

            string actual   = TrimWhitespace(File.ReadAllText(GenerateUsersFileName()));
            string expected = GenerateUserFileContents("whoami");

            Assert.AreEqual(expected, actual, "File contents do not match");
        }