[TestMethod()]//INFO: there is possibility that there is no change in past two days for customer or vendor, then CDC will not return any entities. FIX: make an operation for customer and vendor before calling CDC
        public void CDCTest()
        {
            Customer addedCustomer = dataServiceTestCases.AddEntity(DataServiceTestHelper.CreateCustomer()) as Customer;
            if (addedCustomer == null || addedCustomer.Id == null)
            {
                Assert.Inconclusive("Unable to add customer to verify CDC Test");
            }

            Vendor addedVendor = dataServiceTestCases.AddEntity(DataServiceTestHelper.CreateVendor()) as Vendor;
            if (addedVendor == null || addedVendor.Id == null)
            {
                Assert.Inconclusive("Unable to add vendor to verify CDC Test");
            }

            List<IEntity> entityList = new List<IEntity>() { new Customer(), new Vendor() };

            IntuitCDCResponse cdcResponse = dataServiceTestCases.CDCEntity(entityList, System.DateTime.Today.AddDays(-2));
            try
            {
                List<Customer> customerList = cdcResponse.getEntity("Customer").Cast<Customer>().ToList();
                Assert.IsNotNull(customerList);

                List<Vendor> vendorList = cdcResponse.getEntity("Vendor").Cast<Vendor>().ToList();
                Assert.IsNotNull(customerList);

            }
            catch (System.Exception ex)
            {
                Assert.Fail(ex.ToString());
            }
        }
Exemple #2
0
 public void AddTest()
 {
     try
     {
         Customer addedCustomer = dataServiceTestCases.AddEntity(DataServiceTestHelper.CreateCustomer()) as Customer;
         Assert.IsNotNull(addedCustomer.Id);
     }
     catch (System.Exception ex)
     {
         Assert.Fail(ex.ToString());
     }
 }
 public void UpdateTest()
 {
     try
     {
         Customer addedCustomer = dataServiceTestCases.AddEntity(DataServiceTestHelper.CreateCustomer()) as Customer;
         string middleName = "ABC";
         Customer UpdatedCustomer = dataServiceTestCases.UpdateEntity(DataServiceTestHelper.UpdateCustomerMiddleName(addedCustomer, middleName)) as Customer;
         Assert.AreEqual(UpdatedCustomer.MiddleName, middleName);
     }
     catch (System.Exception ex)
     {
         Assert.Fail(ex.ToString());
     }
 }
 public void FindByIdTest()
 {
     Customer addedCustomer = dataServiceTestCases.AddEntity(DataServiceTestHelper.CreateCustomer()) as Customer;
     try
     {
         Customer foundCustomer = dataServiceTestCases.FindByIdEntity(addedCustomer) as Customer;
         Assert.IsNotNull(foundCustomer);
         Assert.IsTrue(foundCustomer.Id == addedCustomer.Id);
     }
     catch (System.Exception ex)
     {
         Assert.Fail(ex.ToString());
     }
 }
 public void SparseUpdateTest()
 {
     try
     {
         Customer addedCustomer = dataServiceTestCases.AddEntity(DataServiceTestHelper.CreateCustomer()) as Customer;
         addedCustomer.MiddleName = "ABC";
         addedCustomer.sparse = true;
         addedCustomer.sparseSpecified = true;
         Customer UpdatedCustomer = dataServiceTestCases.UpdateEntity(addedCustomer) as Customer;
         Assert.AreEqual(UpdatedCustomer.MiddleName, addedCustomer.MiddleName);
         Assert.AreEqual(UpdatedCustomer.GivenName, addedCustomer.GivenName);
         Assert.AreEqual(UpdatedCustomer.Title, addedCustomer.Title);
         Assert.AreEqual(UpdatedCustomer.FamilyName, addedCustomer.FamilyName);
         Assert.AreEqual(UpdatedCustomer.DisplayName, addedCustomer.DisplayName);
     }
     catch (System.Exception ex)
     {
         Assert.Fail(ex.ToString());
     }
 }