Beispiel #1
0
        public void CRM_Query_Account_CrUD()
        {
            // Create
            Account account = new Account
            {
                Name            = accountName,
                FullName        = accountName + " Full Name",
                ParentAccountId = null
            };
            var id = query.Create(account);

            // Get
            account = query.GetItem(id);
            Assert.AreEqual(accountName, account.Name);
            Assert.AreEqual(accountName + " Full Name", account.FullName);


            // Updated
            account = new Account
            {
                Id              = id,
                Name            = accountRename,
                FullName        = accountRename + " Full Name",
                ParentAccountId = parent
            };
            query.Update(account);
            var accountEntity = getAccount(accountRename);

            Assert.AreEqual(accountRename, accountEntity.Name);
            Assert.AreEqual(accountRename + " Full Name", accountEntity.FullName);
            Assert.AreEqual(parent, accountEntity.ParentAccountId);

            // Delete
            query.Delete(id);
        }