public void TestInitialize()
        {
            UserManager.Login(Settings.Default.TestUserName, Settings.Default.TestPassword, _applicationName, false);

            // Set used datasources
            UserDataSource.SetDataSource();
            TaxonDataSource.SetDataSource();
            TaxonAttributeDataSource.SetDataSource();
            ReferenceDataSource.SetDataSource();

            bool loginSuccess = false;

            // Added try catch due to problems with Moneses-Dev loosing connection.
            try
            {
                loginSuccess = Login(Settings.Default.TestUserName, Settings.Default.TestPassword);
            }
            catch (TimeoutException)
            {
                Thread.Sleep(20000);
                loginSuccess = Login(Settings.Default.TestUserName, Settings.Default.TestPassword);
            }

            if (!loginSuccess)
            {
                throw new ArgumentException("UserManager login failed.");
            }
        }
        public void TestCleanup()
        {
            UserManager.Logout();

            try
            {
                CoreData.UserManager.Logout(_userContext);
            }
            catch
            {
                // Test is done.
                // We are not interested in problems that
                // occures due to test of error handling.
            }
        }