StoreUserAccount() public method

public StoreUserAccount ( UserAccount data ) : bool
data OpenSim.Services.Interfaces.UserAccount
return bool
        public void UserAccounts_001()
        {
            UserAccountServicesConnector m_Connector = new UserAccountServicesConnector(DemonServer.Address);

            string first = "Completely";
            string last = "Clueless";
            string email = "*****@*****.**";

            UserAccount account = m_Connector.CreateUser(first, last, "123", email, UUID.Zero);
            Assert.IsNotNull(account, "Failed to create account " + first + " " + last);
            UUID user1 = account.PrincipalID;

            account = m_Connector.GetUserAccount(UUID.Zero, user1);
            Assert.NotNull(account, "Failed to retrieve account for user id " + user1);
            Assert.AreEqual(account.FirstName, first, "First name does not match");
            Assert.AreEqual(account.LastName, last, "Last name does not match");

            account = m_Connector.GetUserAccount(UUID.Zero, first, last);
            Assert.IsNotNull(account, "Failed to retrieve account for user " + first + " " + last);
            Assert.AreEqual(account.FirstName, first, "First name does not match (bis)");
            Assert.AreEqual(account.LastName, last, "Last name does not match (bis)");

            account.Email = "*****@*****.**";
            bool success = m_Connector.StoreUserAccount(account);
            Assert.IsTrue(success, "Failed to store existing account");

            account = m_Connector.GetUserAccount(UUID.Zero, user1);
            Assert.NotNull(account, "Failed to retrieve account for user id " + user1);
            Assert.AreEqual(account.Email, "*****@*****.**", "Incorrect email");

            account = new UserAccount(UUID.Zero, "DoesNot", "Exist", "*****@*****.**");
            success = m_Connector.StoreUserAccount(account);
            Assert.IsFalse(success, "Storing a non-existing account must fail");

            account = m_Connector.GetUserAccount(UUID.Zero, "DoesNot", "Exist");
            Assert.IsNull(account, "Account DoesNot Exist must not be there");

        }
        public static void Main(string[] args)
        {
            ConsoleAppender consoleAppender = new ConsoleAppender();
            consoleAppender.Layout =
                new PatternLayout("%date [%thread] %-5level %logger [%property{NDC}] - %message%newline");
            log4net.Config.BasicConfigurator.Configure(consoleAppender);

            string serverURI = "http://127.0.0.1:8003";
            UserAccountServicesConnector m_Connector = new UserAccountServicesConnector(serverURI);

            UUID user1 = UUID.Random();
            string first = "Completely";
            string last = "Clueless";
            string email = "*****@*****.**";

            UserAccount account = new UserAccount(user1);
            account.FirstName = first;
            account.LastName = last;
            account.Email = email;
            account.ServiceURLs = new Dictionary<string, object>();
            account.ServiceURLs.Add("InventoryServerURI", "http://cnn.com");
            account.ServiceURLs.Add("AssetServerURI", "http://cnn.com");

            bool success = m_Connector.StoreUserAccount(account);
            if (success)
                m_log.InfoFormat("[USER CLIENT]: Successfully created account for user {0} {1}", account.FirstName, account.LastName);
            else
                m_log.InfoFormat("[USER CLIENT]: failed to create user {0} {1}", account.FirstName, account.LastName);

            System.Console.WriteLine("\n");

            account = m_Connector.GetUserAccount(UUID.Zero, user1);
            if (account == null)
                m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by UUID for {0}", user1);
            else
            {
                m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}",
                                  account.PrincipalID, account.FirstName, account.LastName, account.Email);
                foreach (KeyValuePair<string, object> kvp in account.ServiceURLs)
                    m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value);
            }

            System.Console.WriteLine("\n");

            account = m_Connector.GetUserAccount(UUID.Zero, first, last);
            if (account == null)
                m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by name for {0}", user1);
            else
            {
                m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}",
                                  account.PrincipalID, account.FirstName, account.LastName, account.Email);
                foreach (KeyValuePair<string, object> kvp in account.ServiceURLs)
                    m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value);
            }

            System.Console.WriteLine("\n");
            account = m_Connector.GetUserAccount(UUID.Zero, email);
            if (account == null)
                m_log.InfoFormat("[USER CLIENT]: Unable to retrieve accouny by email for {0}", user1);
            else
            {
                m_log.InfoFormat("[USER CLIENT]: Account retrieved correctly: userID={0}; FirstName={1}; LastName={2}; Email={3}",
                                  account.PrincipalID, account.FirstName, account.LastName, account.Email);
                foreach (KeyValuePair<string, object> kvp in account.ServiceURLs)
                    m_log.DebugFormat("\t {0} -> {1}", kvp.Key, kvp.Value);
            }

        }