Beispiel #1
0
        public void Test_Update()
        {
            System.Console.Out.WriteLine("Update");
            // test to make sure update returns something
            arm.Update(accounts);
            Assert.IsNotNull(arm.GetIndirectReference(account1));

            // test to make sure update removes items that are no longer in the list
            accounts.Remove(account3);
            arm.Update(accounts);
            String indirect = arm.GetIndirectReference(account3);

            Assert.IsNull(indirect);

            // test to make sure old indirect reference is maintained after an update
            arm.Update(accounts);
            String newIndirect = arm.GetIndirectReference(account3);

            Assert.AreEqual(indirect, newIndirect);
        }
        public DataTable GetAccountReferences()
        {
            DataTable  table = new DataTable();
            DataColumn column;

            column            = new DataColumn();
            column.DataType   = Type.GetType("System.String");
            column.ColumnName = "reference";
            table.Columns.Add(column);

            column            = new DataColumn();
            column.DataType   = Type.GetType("System.String");
            column.ColumnName = "name";
            table.Columns.Add(column);
            foreach (Account account in arm.GetDirectReferences())
            {
                DataRow row = table.NewRow();
                row["reference"] = arm.GetIndirectReference(account);
                row["name"]      = account.Name;
                table.Rows.Add(row);
            }
            return(table);
        }