public void AuthTest()
        {
            //// Arrange
            var errors = new List<string>();
            var logon = new Logon { Id = "1", Role = "TestRole" };

            var mockRepository = new Mock<IAuthorizeRepository>();
            mockRepository.Setup(x => x.Authenticate("testuser", "testpassword", ref errors))
                .Returns(logon);

            var authService = new AuthorizeService(mockRepository.Object);

            //// Act
            var logonReturned = authService.Authenticate("testuser", "testpassword", ref errors);

            //// Assert
            Assert.AreEqual(logon.ToString(), logonReturned.ToString());
            Assert.AreEqual(0, errors.Count);
            mockRepository.Verify(x => x.Authenticate(It.IsAny<string>(), It.IsAny<string>(), ref errors), Times.Once);
        }
       public Logon Authenticate(string email, string password, ref List<string> errors)
        {
            var logon = new Logon { Id = string.Empty, Role = "invalid" };

            var conn = new SqlConnection(ConnectionString);
            try
            {
                var adapter = new SqlDataAdapter(GetLoginInfoProcedure, conn)
                                  {
                                      SelectCommand =
                                          {
                                              CommandType = CommandType.StoredProcedure
                                          }
                                  };
                adapter.SelectCommand.Parameters.Add(new SqlParameter("@email", SqlDbType.VarChar, 64));
                adapter.SelectCommand.Parameters.Add(new SqlParameter("@password", SqlDbType.VarChar, 64));

                adapter.SelectCommand.Parameters["@email"].Value = email;
                adapter.SelectCommand.Parameters["@password"].Value = password;

                var dataSet = new DataSet();
                adapter.Fill(dataSet);

                if (dataSet.Tables[0].Rows.Count > 0)
                {
                    logon.Role = dataSet.Tables[0].Rows[0]["role"].ToString();
                    logon.Id = dataSet.Tables[0].Rows[0]["id"].ToString();
                }
            }
            catch (Exception e)
            {
                errors.Add("Error: " + e);
            }
            finally
            {
                conn.Dispose();
            }

            return logon;
        }