From 3f846fb71a4edfdf8e0760db773831b1936250d5 Mon Sep 17 00:00:00 2001 From: nimish84 Date: Sat, 31 Aug 2019 01:33:21 -0700 Subject: [PATCH 01/18] test travis --- .travis.yml | 19 + .../Intuit.Ipp.Test/Intuit.Ipp.Test.sln | 33 + .../Intuit.Ipp.Test/Intuit.Ipp.Test.vsmdi | 6 + .../Intuit.Ipp.Test/Intuit.Ipp.Test1.vsmdi | 6 + .../Intuit.Ipp.Test/Local.testsettings | 10 + .../SDKV3Test/Appsettings.json | 94 + .../SDKV3Test/Common/AuthorizationKeysQBO.cs | 19 + .../SDKV3Test/Common/Helper.cs | 1648 +++ .../SDKV3Test/Common/Initializer.cs | 313 + .../SDKV3Test/Common/QBOHelper.cs | 12328 ++++++++++++++++ .../SDKV3Test/Common/UserInformation.cs | 37 + .../SDKV3Test/Intuit.Ipp.Test.csproj | 58 + .../SDKV3Test/Intuit.Ipp.Test.xml | 37 + .../Services/Platform/PlatformApi.cs | 238 + .../SDKV3Test/Services/QBO/Account.cs | 375 + .../SDKV3Test/Services/QBO/Attachable.cs | 370 + .../Services/QBO/BatchProcessingTests.cs | 207 + .../SDKV3Test/Services/QBO/Bill.cs | 350 + .../SDKV3Test/Services/QBO/BillPayment.cs | 347 + .../QBO/BooleanTypeCustomFieldDefinition.cs | 115 + .../SDKV3Test/Services/QBO/Budget.cs | 364 + .../SDKV3Test/Services/QBO/Class.cs | 335 + .../SDKV3Test/Services/QBO/Company.cs | 333 + .../SDKV3Test/Services/QBO/CompanyCurrency.cs | 350 + .../SDKV3Test/Services/QBO/CompanyInfo.cs | 350 + .../SDKV3Test/Services/QBO/CreditMemo.cs | 351 + .../Services/QBO/CustomFieldDefinition.cs | 115 + .../SDKV3Test/Services/QBO/Customer.cs | 528 + .../SDKV3Test/Services/QBO/CustomerMsg.cs | 333 + .../SDKV3Test/Services/QBO/CustomerType.cs | 333 + .../QBO/DateTypeCustomFieldDefinition.cs | 115 + .../SDKV3Test/Services/QBO/Department.cs | 352 + .../SDKV3Test/Services/QBO/Deposit.cs | 331 + .../SDKV3Test/Services/QBO/Employee.cs | 319 + .../SDKV3Test/Services/QBO/Estimate.cs | 335 + .../SDKV3Test/Services/QBO/ExchangeRate.cs | 93 + .../SDKV3Test/Services/QBO/FixedAsset.cs | 334 + .../Services/QBO/GlobalTaxService.cs | 91 + .../SDKV3Test/Services/QBO/InventorySite.cs | 334 + .../SDKV3Test/Services/QBO/Invoice.cs | 337 + .../SDKV3Test/Services/QBO/Item.cs | 413 + .../SDKV3Test/Services/QBO/JobType.cs | 335 + .../SDKV3Test/Services/QBO/JournalCode.cs | 433 + .../SDKV3Test/Services/QBO/JournalEntry.cs | 334 + .../SDKV3Test/Services/QBO/NameBase.cs | 141 + .../SDKV3Test/Services/QBO/NameValue.cs | 142 + .../QBO/NumberTypeCustomFieldDefinition.cs | 115 + .../SDKV3Test/Services/QBO/OtherName.cs | 333 + .../SDKV3Test/Services/QBO/Payment.cs | 357 + .../SDKV3Test/Services/QBO/PaymentMethod.cs | 337 + .../SDKV3Test/Services/QBO/Preferences.cs | 344 + .../SDKV3Test/Services/QBO/PriceLevel.cs | 333 + .../Services/QBO/PriceLevelPerItem.cs | 156 + .../SDKV3Test/Services/QBO/Purchase.cs | 576 + .../Services/QBO/PurchaseByVendor.cs | 156 + .../SDKV3Test/Services/QBO/PurchaseOrder.cs | 353 + .../Services/QBO/QueryFilterTests.cs | 1722 +++ .../SDKV3Test/Services/QBO/RefundReceipt.cs | 336 + .../SDKV3Test/Services/QBO/Reports.cs | 563 + .../SDKV3Test/Services/QBO/SalesOrder.cs | 332 + .../SDKV3Test/Services/QBO/SalesReceipt.cs | 338 + .../SDKV3Test/Services/QBO/SalesRep.cs | 334 + .../Services/QBO/SalesTransaction.cs | 156 + .../SDKV3Test/Services/QBO/ShipMethod.cs | 333 + .../SDKV3Test/Services/QBO/StatementCharge.cs | 333 + .../SDKV3Test/Services/QBO/Status.cs | 333 + .../QBO/StringTypeCustomFieldDefinition.cs | 115 + .../SDKV3Test/Services/QBO/SyncActivity.cs | 333 + .../SDKV3Test/Services/QBO/Task.cs | 333 + .../SDKV3Test/Services/QBO/TaxAgency.cs | 159 + .../Services/QBO/TaxClassification.cs | 118 + .../SDKV3Test/Services/QBO/TaxCode.cs | 357 + .../SDKV3Test/Services/QBO/TaxRate.cs | 341 + .../SDKV3Test/Services/QBO/TemplateName.cs | 334 + .../SDKV3Test/Services/QBO/Term.cs | 335 + .../SDKV3Test/Services/QBO/TimeActivity.cs | 366 + .../SDKV3Test/Services/QBO/Timeout.cs | 114 + .../SDKV3Test/Services/QBO/Transaction.cs | 156 + .../SDKV3Test/Services/QBO/Transfer.cs | 347 + .../SDKV3Test/Services/QBO/UOM.cs | 334 + .../SDKV3Test/Services/QBO/User.cs | 334 + .../SDKV3Test/Services/QBO/Vendor.cs | 382 + .../SDKV3Test/Services/QBO/VendorCredit.cs | 334 + .../SDKV3Test/Services/QBO/VendorType.cs | 335 + .../SDKV3Test/Services/Resource/image.jpg | Bin 0 -> 2220 bytes .../Intuit.Ipp.Test/SDKV3Test/TokenStore.json | 6 + .../TraceAndTestImpact.testsettings | 9 + .../Entities/NameListEntities/Class.cs | 3 +- .../Entities/NameListEntities/TaxService.cs | 2 +- .../SampleApp_CRUD_.Net/Helper/QBOHelper.cs | 52 +- .../SampleApp_CRUD_DotNet_Oauth2.sln | 15 + .../Tests/Properties/AssemblyInfo.cs | 20 + SampleApp_CRUD_.Net/Tests/Tests.csproj | 68 + SampleApp_CRUD_.Net/Tests/UnitTest1.cs | 14 + SampleApp_CRUD_.Net/Tests/packages.config | 5 + 95 files changed, 37595 insertions(+), 7 deletions(-) create mode 100644 .travis.yml create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/Intuit.Ipp.Test.sln create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/Intuit.Ipp.Test.vsmdi create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/Intuit.Ipp.Test1.vsmdi create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/Local.testsettings create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/AuthorizationKeysQBO.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Helper.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/QBOHelper.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/UserInformation.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.xml create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/Platform/PlatformApi.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Account.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Attachable.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/BatchProcessingTests.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Bill.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/BillPayment.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/BooleanTypeCustomFieldDefinition.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Budget.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Class.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Company.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CompanyCurrency.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CompanyInfo.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CreditMemo.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CustomFieldDefinition.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Customer.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CustomerMsg.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CustomerType.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/DateTypeCustomFieldDefinition.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Department.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Deposit.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Employee.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Estimate.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/ExchangeRate.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/FixedAsset.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/GlobalTaxService.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/InventorySite.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Invoice.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Item.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/JobType.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/JournalCode.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/JournalEntry.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/NameBase.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/NameValue.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/NumberTypeCustomFieldDefinition.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/OtherName.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Payment.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/PaymentMethod.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Preferences.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/PriceLevel.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/PriceLevelPerItem.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Purchase.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/PurchaseByVendor.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/PurchaseOrder.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/QueryFilterTests.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/RefundReceipt.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Reports.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/SalesOrder.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/SalesReceipt.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/SalesRep.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/SalesTransaction.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/ShipMethod.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/StatementCharge.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Status.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/StringTypeCustomFieldDefinition.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/SyncActivity.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Task.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/TaxAgency.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/TaxClassification.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/TaxCode.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/TaxRate.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/TemplateName.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Term.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/TimeActivity.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Timeout.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Transaction.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Transfer.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/UOM.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/User.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Vendor.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/VendorCredit.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/VendorType.cs create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/Resource/image.jpg create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/TokenStore.json create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/TraceAndTestImpact.testsettings create mode 100644 SampleApp_CRUD_.Net/Tests/Properties/AssemblyInfo.cs create mode 100644 SampleApp_CRUD_.Net/Tests/Tests.csproj create mode 100644 SampleApp_CRUD_.Net/Tests/UnitTest1.cs create mode 100644 SampleApp_CRUD_.Net/Tests/packages.config diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..035791c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,19 @@ +dist: xenial + +sudo: required + +language: csharp + +mono: none + +dotnet: 2.0.0 + +solution: Intuit.Ipp.Test.sln + +script: +- cd SampleApp_CRUD_.Net\Intuit.Ipp.Test + +- dotnet restore +- dotnet build + +- dotnet test diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/Intuit.Ipp.Test.sln b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/Intuit.Ipp.Test.sln new file mode 100644 index 0000000..297bf04 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/Intuit.Ipp.Test.sln @@ -0,0 +1,33 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Intuit.Ipp.Test", "SDKV3Test\Intuit.Ipp.Test.csproj", "{060832A6-5005-4155-9B07-9586EDED2EB5}" +EndProject +Global + GlobalSection(TestCaseManagementSettings) = postSolution + CategoryFile = Intuit.Ipp.Test1.vsmdi + EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|Mixed Platforms = Debug|Mixed Platforms + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|Mixed Platforms = Release|Mixed Platforms + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {060832A6-5005-4155-9B07-9586EDED2EB5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {060832A6-5005-4155-9B07-9586EDED2EB5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {060832A6-5005-4155-9B07-9586EDED2EB5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {060832A6-5005-4155-9B07-9586EDED2EB5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {060832A6-5005-4155-9B07-9586EDED2EB5}.Debug|x86.ActiveCfg = Debug|Any CPU + {060832A6-5005-4155-9B07-9586EDED2EB5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {060832A6-5005-4155-9B07-9586EDED2EB5}.Release|Any CPU.Build.0 = Release|Any CPU + {060832A6-5005-4155-9B07-9586EDED2EB5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {060832A6-5005-4155-9B07-9586EDED2EB5}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {060832A6-5005-4155-9B07-9586EDED2EB5}.Release|x86.ActiveCfg = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/Intuit.Ipp.Test.vsmdi b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/Intuit.Ipp.Test.vsmdi new file mode 100644 index 0000000..d15cc81 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/Intuit.Ipp.Test.vsmdi @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/Intuit.Ipp.Test1.vsmdi b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/Intuit.Ipp.Test1.vsmdi new file mode 100644 index 0000000..915ec9d --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/Intuit.Ipp.Test1.vsmdi @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/Local.testsettings b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/Local.testsettings new file mode 100644 index 0000000..795b36b --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/Local.testsettings @@ -0,0 +1,10 @@ + + + These are default test settings for a local test run. + + + + + + + \ No newline at end of file diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json new file mode 100644 index 0000000..2d86825 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json @@ -0,0 +1,94 @@ +{ + "Oauth2Keys": { + "AccessToken": "eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..6eGoUSu4w5p_DM7GoxLSZg._qbb3fFXlVbVMTQ2eGd86hq87GGYPFuYXI7zNveJsevp0J8rt8geR3qDBlf9y-uD4osiFlCfiW7vh7uwnS5HJDEioPHYb82yVosVy3zVEoksg8rKPWkYO561MABv-TSpVTjlYWuzczTBt1GST30e5S0kEYbXtuj4PkbCKSGQKKT-yzaxn2hA72rzCvB9fCj2lZvDBS17xTzjT7j0sD1hBdbnoMr161qSxUTXfg3tDSE874FhYBVVc0rHJ0lqNwKpujnyMWFHGl_6Oh7YpeV0lngjmE2jrKHNxUaa-vJHisOGUN008Isv_ikjXUtQI1OpDflLWcHV9KD9CSxTXYcYnPkokf-kyeWNhC6wDDTJm58LhLHQ4W9L3Jv-M57cxYk3F4qCP-0861wDPXGcJMzsS-1wWYY3Gdpp1c2cDWXpTxlIxBERfnC3seh9bO0NoijMAXfz8rmXtUguBGjrf_n5TwLJmQAKpBTvijdJPwRmJzIvUm9azCIuLYBiA1XGukiEJ74oJbwE-51qANAsPHsUrQBeyinWkeXV9M1UmnWw_6zG5fsIv9IknmsGelsKXsWF7HrABYpgCA8IgenjtUq6w8TL_mjHnRsCJsdwJ1ddtEX9JZFL-kxVPlfew3p3HKfPv27QT0Vo9tW-bK-fCPPrflgFsO4V1udmM_Zfm7F90xc.ZYF0h8c8bJohLsu0Cc0q-g", + "RefreshToken": "AB1157596503335r71V6cslgBLIhIm8SbmGpIe96CpjMX76xvC", + "RealmId": "123146090856284", + "ClientId": "Q0joY7aqSROhDAspO4JLoH6ChEtpBvYalZIUwQOg3u5cwbVEaL", + "ClientSecret": "aHPShUDVCEg332ggf7pM3ffAkx6LyzcZIBh5muF5", + "RedirectUrl": "https://developer.intuit.com/v2/OAuth2Playground/RedirectUrl", + "QBOBaseUrl": "https://sandbox-quickbooks.api.intuit.com/", + "Environment": "sandbox" + + }, + "Logger": { + "RequestLog": { + "EnableLogs": "true", + "LogDirectory": "C://IdsLogs//" + } + }, + //not supported -added for backward compatibility + "CustomLogger": { + "RequestLog": { + "Enable": "false", + "Name": "", + "Type": "" + } + }, + "Security": { + "Mode": { + "Oauth": { + "Enable": "false", + "AccessToken": "" + }, + //not supported -added for backward compatibility + "Custom": { + "Enable": "false", + "Name": "", + "Type": "", + "Params": "" + } + } + }, + "Message": { + "Request": { + "CompressionFormat": "None", + "SerializationFormat": "Json" + }, + "Response": { + "CompressionFormat": "None", + "SerializationFormat": "Json" + } + }, + "Service": { + "BaseUrl": { + "Qbo": "https://sandbox-quickbooks.api.intuit.com/", //not supported- added for backward compatibility + "Ips": "", //not supported-added for backward compatibility + "OAuthAccessTokenUrl": "", //not supported-added for backward compatibility + "UserNameAuthentication": "" + }, + + "MinorVersion": { + "Qbo": "37" + } + }, + "WebhooksService": { + + "VerifierToken": { + "Value": "" + } + }, + "Retry": { + "Mode": { + + "LinearRetry": { + "Enable": "false", + "RetryCount": "", + "RetryInterval": "" + }, + "IncrementatlRetry": { + "Enable": "false", + "RetryCount": "", + "InitialInterval": "", + "Increment": "" + }, + "ExponentialRetry": { + "Enable": "false", + "RetryCount": "", + "MinBackoff": "", + "MaxBackoff": "", + "DeltaBackoff": "" + } + } + } +} + diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/AuthorizationKeysQBO.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/AuthorizationKeysQBO.cs new file mode 100644 index 0000000..f62807a --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/AuthorizationKeysQBO.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Intuit.Ipp.Test +{ + static class AuthorizationKeysQBO + { + internal static string accessTokenQBO; + internal static string refreshTokenQBO; + internal static string redirectUrl; + internal static string clientIdQBO; + internal static string clientSecretQBO; + internal static string realmIdIAQBO; + internal static string qboBaseUrl; + internal static string appEnvironment; + internal static string tokenFilePath; + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Helper.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Helper.cs new file mode 100644 index 0000000..be7f14f --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Helper.cs @@ -0,0 +1,1648 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Intuit.Ipp.Core; +using Intuit.Ipp.Exception; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Data; +using System.Collections.ObjectModel; +using System.Reflection; +using System.Threading; +using Intuit.Ipp.DataService; +using Intuit.Ipp.QueryFilter; + +using Intuit.Ipp.ReportService; +using Intuit.Ipp.Security; +using System.Configuration; +using Intuit.Ipp.OAuth2PlatformClient; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using System.IO; + +namespace Intuit.Ipp.Test +{ + public class Helper + { + internal static ServiceContext GetNewTokens_ServiceContext() + { + + + FileInfo fileinfo = new FileInfo(AuthorizationKeysQBO.tokenFilePath); + string jsonFile = File.ReadAllText(fileinfo.FullName); + var jObj = JObject.Parse(jsonFile); + + var oauth2Client = new OAuth2Client(AuthorizationKeysQBO.clientIdQBO, AuthorizationKeysQBO.clientSecretQBO, AuthorizationKeysQBO.redirectUrl, AuthorizationKeysQBO.appEnvironment); + try + { + var tokenResp = oauth2Client.RefreshTokenAsync(AuthorizationKeysQBO.refreshTokenQBO).Result; + jObj["Oauth2Keys"]["AccessToken"] = tokenResp.AccessToken; + jObj["Oauth2Keys"]["RefreshToken"] = tokenResp.RefreshToken; + } + catch (IdsException ex) + { + + if (jObj["Oauth2Keys"]["RefreshToken"] != null) + { + var tokenResp = oauth2Client.RefreshTokenAsync(jObj["Oauth2Keys"]["RefreshToken"].ToString()).Result; + jObj["Oauth2Keys"]["AccessToken"] = tokenResp.AccessToken; + jObj["Oauth2Keys"]["RefreshToken"] = tokenResp.RefreshToken; + } + else + { + throw ex; + } + } + + + string output = JsonConvert.SerializeObject(jObj, Formatting.Indented); + File.WriteAllText(fileinfo.FullName, output); + //tokenDict.Clear(); + var serviceContext = Initializer.InitializeQBOServiceContextUsingoAuth(); + return serviceContext; + + + + } + internal static T Add(ServiceContext context, T entity) where T : IEntity + { + try + { + //Initializing the Dataservice object with ServiceContext + DataService.DataService service = new DataService.DataService(context); + + //Adding the Bill using Dataservice object + + T added = service.Add(entity); + + //get IntuitEntity from entity + if (added.GetType().IsSubclassOf(typeof(IntuitEntity))) + { + IntuitEntity addedEntity = (IntuitEntity)(object)added; + + //Checking id of added Bill is not Null. If it is Null, Bill is not added properly + Assert.IsNotNull(addedEntity.Id); + } + + return added; + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + //var oauth2Client = new OAuth2Client(AuthorizationKeysQBO.clientIdQBO, AuthorizationKeysQBO.clientSecretQBO, AuthorizationKeysQBO.redirectUrl, AuthorizationKeysQBO.appEnvironment); + //var tokenResp = oauth2Client.RefreshTokenAsync(AuthorizationKeysQBO.refreshTokenQBO).Result; + //if (tokenResp.AccessToken != null && tokenResp.RefreshToken != null) + //{ + // string jsonFile = File.ReadAllText(AuthorizationKeysQBO.tokenFilePath); + // var jObj = JObject.Parse(jsonFile); + // jObj["Oauth2Keys"]["AccessToken"] = tokenResp.AccessToken; + // jObj["Oauth2Keys"]["RefreshToken"] = tokenResp.RefreshToken; + // string output = JsonConvert.SerializeObject(jObj, Formatting.Indented); + // File.WriteAllText(AuthorizationKeysQBO.tokenFilePath, output); + // //tokenDict.Clear(); + // var serviceContext = Initializer.InitializeQBOServiceContextUsingoAuth(); + var serviceContext = Helper.GetNewTokens_ServiceContext(); + var entityResponse = Add(serviceContext, entity); + return entityResponse; + + + } + else + { + throw; + } + } + + } + + internal static List FindAll(ServiceContext context, T entity, int startPosition = 1, int maxResults = 100) where T : IEntity + { + try + { + DataService.DataService service = new DataService.DataService(context); + + ReadOnlyCollection entityList = service.FindAll(entity, startPosition, maxResults); + + return entityList.ToList(); + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + List entityResponse = FindAll(serviceContext, entity); + return entityResponse; + + + } + else + { + throw; + } + } + } + + internal static List FindByLevel(ServiceContext context, T entity) where T : IEntity + { + try + { + DataService.DataService service = new DataService.DataService(context); + + ReadOnlyCollection entityList = service.FindByLevel(entity); + + return entityList.ToList(); + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + List entityResponse = FindByLevel(serviceContext, entity); + return entityResponse; + + + } + else + { + throw; + } + } + } + + internal static List FindByParentId(ServiceContext context, T entity) where T : IEntity + { + try + { + DataService.DataService service = new DataService.DataService(context); + + ReadOnlyCollection entityList = service.FindByParentId(entity); + + return entityList.ToList(); + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + List entityResponse = FindByParentId(serviceContext, entity); + return entityResponse; + + + } + else + { + throw; + } + } + } + + internal static T FindById(ServiceContext context, T entity) where T : IEntity + { + try + { + DataService.DataService service = new DataService.DataService(context); + T foundEntity = service.FindById(entity); + + return foundEntity; + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + var entityResponse = FindById(serviceContext, entity); + return entityResponse; + + + } + else + { + throw; + } + } + } + + internal static T Update(ServiceContext context, T entity) where T : IEntity + { + try + { + //initializing the dataservice object with servicecontext + DataService.DataService service = new DataService.DataService(context); + + //updating the entity + T updated = service.Update(entity); + + return updated; + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + var entityResponse = Update(serviceContext, entity); + return entityResponse; + + + } + else + { + throw; + } + } + } + + + internal static T UpdateAccountOnTxnsFrance(ServiceContext context, T entity) where T : IEntity + { + try + { + //initializing the dataservice object with servicecontext + DataService.DataService service = new DataService.DataService(context); + + //updating the entity + // update account for historical transactions + T updated = service.UpdateAccountOnTxns(entity); + + return updated; + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + var entityResponse = UpdateAccountOnTxnsFrance(serviceContext, entity); + return entityResponse; + + + } + else + { + throw; + } + } + } + + + internal static T DonotUpdateAccountOnTxnsFrance(ServiceContext context, T entity) where T : IEntity + { + //initializing the dataservice object with servicecontext + DataService.DataService service = new DataService.DataService(context); + + //updating the entity + // do not update account for historical transactions + T updated = service.DoNotUpdateAccountOnTxns(entity); + + return updated; + } + + + internal static T SparseUpdate(ServiceContext context, T entity) where T : IEntity + { + try + { + + //initializing the dataservice object with servicecontext + DataService.DataService service = new DataService.DataService(context); + + //updating the entity + T updated = service.Update(entity); + + return updated; + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + var entityResponse = SparseUpdate(serviceContext, entity); + return entityResponse; + + + } + else + { + throw; + } + } + } + + internal static T Delete(ServiceContext context, T entity) where T : IEntity + { + try + { + //Initializing the Dataservice object with ServiceContext + DataService.DataService service = new DataService.DataService(context); + + //Deleting the Bill using the service + T deleted = service.Delete(entity); + + return deleted; + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + var entityResponse = Delete(serviceContext, entity); + return entityResponse; + + + } + else + { + throw; + } + } + } + + + + internal static T Void(ServiceContext context, T entity) where T : IEntity + { + //Initializing the Dataservice object with ServiceContext + DataService.DataService service = new DataService.DataService(context); + + //Voiding the entity using the service + service.Void(entity); + + try + { + //Retrieving the voided entity + T found = service.FindById(entity); + Assert.IsNotNull(found); + return found; + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + var entityResponse = Delete(serviceContext, entity); + return entityResponse; + + + } + else + { + + } + } + + return entity; + } + + internal static List CDC(ServiceContext context, T entity, DateTime changedSince) where T : IEntity + { + //Initializing the Dataservice object with ServiceContext + DataService.DataService service = new DataService.DataService(context); + + List entityList = new List(); + entityList.Add(entity); + + try + { + IntuitCDCResponse response = service.CDC(entityList, changedSince); + if (response.entities.Count == 0) + { + return null; + } + //Retrieving the entity List + List found = response.getEntity(entity.GetType().Name).Cast().ToList(); + Assert.IsNotNull(found); + return found; + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + List entityResponse = CDC(serviceContext, entity, changedSince); + return entityResponse; + + + } + else + { + throw; + } + } + } + + internal static Attachable Upload(ServiceContext context, Attachable attachable, System.IO.Stream stream) + { + try + { + //Initializing the Dataservice object with ServiceContext + DataService.DataService service = new DataService.DataService(context); + + Attachable uploaded = service.Upload(attachable, stream); + return uploaded; + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + var entityResponse = Upload(serviceContext, attachable, stream); + return entityResponse; + + + } + else + { + throw; + } + } + } + + internal static byte[] Download(ServiceContext context, Attachable entity) + { + try + { + //Initializing the Dataservice object with ServiceContext + DataService.DataService service = new DataService.DataService(context); + + return service.Download(entity); + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + var entityResponse = Download(serviceContext, entity); + return entityResponse; + + + } + else + { + throw; + } + } + } + + internal static ReadOnlyCollection BatchTest(ServiceContext context, Dictionary operationDictionary) where T : IEntity + { + try + { + DataService.DataService service = new DataService.DataService(context); + List addedList = new List(); + List newList = new List(); + + + QueryService entityContext = new QueryService(context); + + DataService.Batch batch = service.CreateNewBatch(); + + foreach (KeyValuePair entry in operationDictionary) + { + if (entry.Value.GetType().Name.Equals(typeof(T).Name)) + batch.Add(entry.Value as IEntity, entry.Key.ToString() + entry.Value.GetType().Name, entry.Key); + else + batch.Add(entry.Value as string, "Query" + typeof(T).Name); + } + + + batch.Execute(); + + return batch.IntuitBatchItemResponses; + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + ReadOnlyCollection entityResponse = BatchTest(serviceContext, operationDictionary); + return entityResponse; + + + } + else + { + throw; + } + } + } + + + internal static Boolean CheckEqual(Object expected, Object actual) + { + return true; + } + + internal static String GetGuid() + { + return Guid.NewGuid().ToString("N"); + } + + internal static Report GetReportAsync(ServiceContext context, string reportName) + { + try + { + + //Initializing the Dataservice object with ServiceContext + ReportService.ReportService service = new ReportService.ReportService(context); + + IdsException exp = null; + Boolean reportReturned = false; + Report actual = null; + + // Used to signal the waiting test thread that a async operation have completed. + ManualResetEvent manualEvent = new ManualResetEvent(false); + + // Async callback events are anonomous and are in the same scope as the test code, + // and therefore have access to the manualEvent variable. + service.OnExecuteReportAsyncCompleted += (sender, e) => + { + manualEvent.Set(); + if (e.Error != null) + { + exp = e.Error; + } + if (exp == null) + { + if (e.Report != null) + { + reportReturned = true; + actual = e.Report; + } + } + }; + + // Call the service method + service.ExecuteReportAsync(reportName); + + manualEvent.WaitOne(30000, false); Thread.Sleep(10000); + + if (exp != null) + { + throw exp; + + } + + // Check if we completed the async call, or fail the test if we timed out. + if (!reportReturned) + { + Assert.Fail(String.Format("Retrieving {0} Report Failed", reportName)); + } + + // Set the event to non-signaled before making next async call. + manualEvent.Reset(); + + Assert.IsNotNull(actual); + return actual; + } + + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + var entityResponse = GetReportAsync(serviceContext, reportName); + return entityResponse; + + + } + else + { + throw ex; + } + } + + } + + internal static T AddAsync(ServiceContext context, T entity) where T : IEntity + { + try + { + //Initializing the Dataservice object with ServiceContext + DataService.DataService service = new DataService.DataService(context); + + bool isAdded = false; + + IdsException exp = null; + + T actual = (T)Activator.CreateInstance(entity.GetType()); + // Used to signal the waiting test thread that a async operation have completed. + ManualResetEvent manualEvent = new ManualResetEvent(false); + + // Async callback events are anonomous and are in the same scope as the test code, + // and therefore have access to the manualEvent variable. + service.OnAddAsyncCompleted += (sender, e) => + { + isAdded = true; + manualEvent.Set(); + if (e.Error != null) + { + exp = e.Error; + } + if (exp == null) + { + if (e.Entity != null) + { + actual = (T)e.Entity; + } + } + }; + + // Call the service method + service.AddAsync(entity); + + manualEvent.WaitOne(30000, false); Thread.Sleep(10000); + + if (exp != null) + { + throw exp; + } + + // Check if we completed the async call, or fail the test if we timed out. + if (!isAdded) + { + Assert.Fail("Adding Entity Failed"); + } + + // Set the event to non-signaled before making next async call. + manualEvent.Reset(); + + return actual; + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + var entityResponse = AddAsync(serviceContext, entity); + return entityResponse; + + + } + else + { + throw ex; + } + } + + } + + internal static List FindAllAsync(ServiceContext context, T entity, int startPosition = 1, int maxResults = 500) where T : IEntity + { + try + { + //Initializing the Dataservice object with ServiceContext + DataService.DataService service = new DataService.DataService(context); + + bool isFindAll = false; + + IdsException exp = null; + + // Used to signal the waiting test thread that a async operation have completed. + ManualResetEvent manualEvent = new ManualResetEvent(false); + + List entities = new List(); + + // Async callback events are anonomous and are in the same scope as the test code, + // and therefore have access to the manualEvent variable. + service.OnFindAllAsyncCompleted += (sender, e) => + { + isFindAll = true; + manualEvent.Set(); + if (e.Error != null) + { + exp = e.Error; + } + if (exp == null) + { + if (e.Entities != null) + { + foreach (IEntity en in e.Entities) + { + entities.Add((T)en); + } + } + } + }; + + // Call the service method + service.FindAllAsync(entity, 1, 10); + + manualEvent.WaitOne(60000, false); Thread.Sleep(10000); + + + // Check if we completed the async call, or fail the test if we timed out. + if (!isFindAll) + { + Assert.Fail("Find All Failed"); + } + + if (exp != null) + { + throw exp; + } + + if (entities != null) + { + Assert.IsTrue(entities.Count >= 0); + } + + // Set the event to non-signaled before making next async call. + manualEvent.Reset(); + return entities; + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + List entityResponse = FindAllAsync(serviceContext, entity); + return entityResponse; + + + } + else + { + throw ex; + } + } + } + + internal static List FindByLevelAsync(ServiceContext context, T entity) where T : IEntity + { + try + { + //Initializing the Dataservice object with ServiceContext + DataService.DataService service = new DataService.DataService(context); + + bool isFindByLevel = false; + + IdsException exp = null; + + // Used to signal the waiting test thread that a async operation have completed. + ManualResetEvent manualEvent = new ManualResetEvent(false); + + List entities = new List(); + + // Async callback events are anonomous and are in the same scope as the test code, + // and therefore have access to the manualEvent variable. + service.OnFindByLevelAsyncCompleted += (sender, e) => + { + isFindByLevel = true; + manualEvent.Set(); + if (e.Error != null) + { + exp = e.Error; + } + if (exp == null) + { + if (e.Entities != null) + { + foreach (IEntity en in e.Entities) + { + entities.Add((T)en); + } + } + } + }; + + // Call the service method + service.FindByLevelAsync(entity); + + manualEvent.WaitOne(60000, false); Thread.Sleep(10000); + + + // Check if we completed the async call, or fail the test if we timed out. + if (!isFindByLevel) + { + Assert.Fail("Find By Level Async Failed"); + } + + if (exp != null) + { + throw exp; + } + + if (entities != null) + { + Assert.IsTrue(entities.Count >= 0); + } + + // Set the event to non-signaled before making next async call. + manualEvent.Reset(); + return entities; + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + List entityResponse = FindByLevelAsync(serviceContext, entity); + return entityResponse; + + + } + else + { + throw ex; + } + } + } + + internal static List FindByParentIdAsync(ServiceContext context, T entity) where T : IEntity + { + try + { + //Initializing the Dataservice object with ServiceContext + DataService.DataService service = new DataService.DataService(context); + + bool isFindByParentId = false; + + IdsException exp = null; + + // Used to signal the waiting test thread that a async operation have completed. + ManualResetEvent manualEvent = new ManualResetEvent(false); + + List entities = new List(); + + // Async callback events are anonomous and are in the same scope as the test code, + // and therefore have access to the manualEvent variable. + service.OnFindByParentIdAsyncCompleted += (sender, e) => + { + isFindByParentId = true; + manualEvent.Set(); + if (e.Error != null) + { + exp = e.Error; + } + if (exp == null) + { + if (e.Entities != null) + { + foreach (IEntity en in e.Entities) + { + entities.Add((T)en); + } + } + } + }; + + // Call the service method + service.FindByParentIdAsync(entity); + + manualEvent.WaitOne(60000, false); Thread.Sleep(10000); + + + // Check if we completed the async call, or fail the test if we timed out. + if (!isFindByParentId) + { + Assert.Fail("Find By ParentId Async Failed"); + } + + if (exp != null) + { + throw exp; + } + + if (entities != null) + { + Assert.IsTrue(entities.Count >= 0); + } + + // Set the event to non-signaled before making next async call. + manualEvent.Reset(); + return entities; + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + List entityResponse = FindByParentIdAsync(serviceContext, entity); + return entityResponse; + + + } + else + { + throw ex; + } + } + } + + internal static T FindByIdAsync(ServiceContext context, T entity) where T : IEntity + { + try + { + //Initializing the Dataservice object with ServiceContext + DataService.DataService service = new DataService.DataService(context); + + bool isFindById = false; + + IdsException exp = null; + + // Used to signal the waiting test thread that a async operation have completed. + ManualResetEvent manualEvent = new ManualResetEvent(false); + + T returnedEntity = default(T); + + // Async callback events are anonomous and are in the same scope as the test code, + // and therefore have access to the manualEvent variable. + service.OnFindByIdAsyncCompleted += (sender, e) => + { + Assert.IsNotNull(e); + Assert.IsNotNull(e.Entity); + manualEvent.Set(); + isFindById = true; + returnedEntity = (T)e.Entity; + }; + + // Call the service method + service.FindByIdAsync(entity); + manualEvent.WaitOne(60000, false); Thread.Sleep(10000); + + // Check if we completed the async call, or fail the test if we timed out. + if (!isFindById) + { + Assert.Fail("FindByID Failed"); + } + + if (exp != null) + { + throw exp; + } + + // Set the event to non-signaled before making next async call. + manualEvent.Reset(); + return returnedEntity; + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + var entityResponse = FindByIdAsync(serviceContext, entity); + return entityResponse; + + + } + else + { + throw ex; + } + } + } + + internal static T UpdateAsync(ServiceContext context, T entity) where T : IEntity + { + try + { + //Initializing the Dataservice object with ServiceContext + DataService.DataService service = new DataService.DataService(context); + + bool isUpdated = false; + + // Used to signal the waiting test thread that a async operation have completed. + ManualResetEvent manualEvent = new ManualResetEvent(false); + + IdsException exp = null; + + T returnedEntity = entity; + // Async callback events are anonomous and are in the same scope as the test code, + // and therefore have access to the manualEvent variable. + service.OnUpdateAsyncCompleted += (sender, e) => + { + + isUpdated = true; + manualEvent.Set(); + if (e.Error != null) + { + exp = e.Error; + } + else + { + if (e.Entity != null) + { + returnedEntity = (T)e.Entity; + } + } + }; + + // Call the service method + service.UpdateAsync(entity); + + manualEvent.WaitOne(30000, false); Thread.Sleep(10000); + + if (exp != null) + { + throw exp; + } + // Check if we completed the async call, or fail the test if we timed out. + if (!isUpdated) + { + Assert.Fail("Update Failed"); + } + + //if entity is returned returnedEntity will be set with new object with same values + Assert.AreNotEqual(returnedEntity, entity); + + // Set the event to non-signaled before making next async call. + manualEvent.Reset(); + + return returnedEntity; + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + var entityResponse = UpdateAsync(serviceContext, entity); + return entityResponse; + + + } + else + { + throw ex; + } + } + } + + + internal static T UpdateAccountOnTxnsAsyncFrance(ServiceContext context, T entity) where T : IEntity + { + try + { + //Initializing the Dataservice object with ServiceContext + DataService.DataService service = new DataService.DataService(context); + + bool isUpdated = false; + + // Used to signal the waiting test thread that a async operation have completed. + ManualResetEvent manualEvent = new ManualResetEvent(false); + + IdsException exp = null; + + T returnedEntity = entity; + // Async callback events are anonomous and are in the same scope as the test code, + // and therefore have access to the manualEvent variable. + + //check this line for change + service.OnUpdateAccAsyncCompleted += (sender, e) => + { + + isUpdated = true; + manualEvent.Set(); + if (e.Error != null) + { + exp = e.Error; + } + else + { + if (e.Entity != null) + { + returnedEntity = (T)e.Entity; + } + } + }; + + // Call the service method + service.UpdateAccAsync(entity); + + manualEvent.WaitOne(30000, false); Thread.Sleep(10000); + + if (exp != null) + { + throw exp; + } + // Check if we completed the async call, or fail the test if we timed out. + if (!isUpdated) + { + Assert.Fail("UpdateAccountOnTxns Failed"); + } + + //if entity is returned returnedEntity will be set with new object with same values + Assert.AreNotEqual(returnedEntity, entity); + + // Set the event to non-signaled before making next async call. + manualEvent.Reset(); + + return returnedEntity; + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + var entityResponse = UpdateAccountOnTxnsAsyncFrance(serviceContext, entity); + return entityResponse; + + + } + else + { + throw ex; + } + } + } + + internal static T DonotUpdateAccountOnTxnsAsyncFrance(ServiceContext context, T entity) where T : IEntity + { + try + { + //Initializing the Dataservice object with ServiceContext + DataService.DataService service = new DataService.DataService(context); + + bool isUpdated = false; + + // Used to signal the waiting test thread that a async operation have completed. + ManualResetEvent manualEvent = new ManualResetEvent(false); + + IdsException exp = null; + + T returnedEntity = entity; + // Async callback events are anonomous and are in the same scope as the test code, + // and therefore have access to the manualEvent variable. + + //check this line for change + service.OnDoNotUpdateAccAsyncCompleted += (sender, e) => + { + + isUpdated = true; + manualEvent.Set(); + if (e.Error != null) + { + exp = e.Error; + } + else + { + if (e.Entity != null) + { + returnedEntity = (T)e.Entity; + } + } + }; + + // Call the service method + service.DoNotUpdateAccountOnTxns(entity); + + manualEvent.WaitOne(30000, false); Thread.Sleep(10000); + + if (exp != null) + { + throw exp; + } + // Check if we completed the async call, or fail the test if we timed out. + if (!isUpdated) + { + Assert.Fail("DoNotUpdateAccountOnTxns Failed"); + } + + //if entity is returned returnedEntity will be set with new object with same values + Assert.AreNotEqual(returnedEntity, entity); + + // Set the event to non-signaled before making next async call. + manualEvent.Reset(); + + return returnedEntity; + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + var entityResponse = DonotUpdateAccountOnTxnsAsyncFrance(serviceContext, entity); + return entityResponse; + + + } + else + { + throw ex; + } + } + } + + + internal static T DeleteAsync(ServiceContext context, T entity) where T : IEntity + { + try + { + //Initializing the Dataservice object with ServiceContext + DataService.DataService service = new DataService.DataService(context); + + bool isDeleted = false; + + // Used to signal the waiting test thread that a async operation have completed. + ManualResetEvent manualEvent = new ManualResetEvent(false); + + IdsException exp = null; + // Async callback events are anonomous and are in the same scope as the test code, + // and therefore have access to the manualEvent variable. + T returnedEntity = entity; + service.OnDeleteAsyncCompleted += (sender, e) => + { + isDeleted = true; + manualEvent.Set(); + if (e.Error != null) + { + exp = e.Error; + } + else + { + if (e.Entity != null) + { + returnedEntity = (T)e.Entity; + } + } + }; + + // Call the service method + service.DeleteAsync(entity); + + manualEvent.WaitOne(30000, false); Thread.Sleep(10000); + + if (exp != null) + { + throw exp; + } + // Check if we completed the async call, or fail the test if we timed out. + if (!isDeleted) + { + Assert.Fail("Delete Failed"); + } + + // Set the event to non-signaled before making next async call. + manualEvent.Reset(); + + return returnedEntity; + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + var entityResponse = DeleteAsync(serviceContext, entity); + return entityResponse; + + + } + else + { + throw ex; + } + } + } + + internal static void VoidAsync(ServiceContext context, T entity) where T : IEntity + { + try + { + //Initializing the Dataservice object with ServiceContext + DataService.DataService service = new DataService.DataService(context); + + bool isVoided = false; + + // Used to signal the waiting test thread that a async operation have completed. + ManualResetEvent manualEvent = new ManualResetEvent(false); + + IdsException exp = null; + // Async callback events are anonomous and are in the same scope as the test code, + // and therefore have access to the manualEvent variable. + service.OnVoidAsyncCompleted += (sender, e) => + { + isVoided = true; + manualEvent.Set(); + if (e.Error != null) + { + exp = e.Error; + } + + }; + + // Call the service method + service.VoidAsync(entity); + + manualEvent.WaitOne(30000, false); + Thread.Sleep(10000); + + if (exp != null) + { + throw exp; + } + // Check if we completed the async call, or fail the test if we timed out. + if (!isVoided) + { + Assert.Fail("Void Failed"); + } + + // Set the event to non-signaled before making next async call. + manualEvent.Reset(); + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + VoidAsync(serviceContext, entity); + + + + } + else + { + throw ex; + } + } + } + + internal static T FindOrAdd(ServiceContext context, T entity) where T : IEntity + { + try + { + List returnedEntities = FindAll(context, entity, 1, 500); + int count = 0; + foreach (T en in returnedEntities) + { + if ((returnedEntities[count] as IntuitEntity).status != EntityStatusEnum.SyncError) + return returnedEntities[count]; + count++; + } + + + BindingFlags bindingFlags = BindingFlags.NonPublic | BindingFlags.Static; + Type[] types = Assembly.GetExecutingAssembly().GetTypes(); + + foreach (Type type in types) + { + if ((context.ServiceType == IntuitServicesType.QBO && type.Name == "QBOHelper")) + { + String methodName = "Create" + entity.GetType().Name; + MethodInfo method = type.GetMethod("Create" + entity.GetType().Name, bindingFlags); + entity = (T)method.Invoke(null, new object[] { context }); + T returnEntity = Add(context, entity); + return returnEntity; + } + } + throw new System.ApplicationException("Could not find QBOHelper"); + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + var entityResponse = FindOrAdd(serviceContext, entity); + return entityResponse; + + + } + else + { + throw ex; + } + } + } + + internal static Account FindOrAddAccount(ServiceContext context, AccountTypeEnum accountType, AccountClassificationEnum classification) + { + try + { + Account typeOfAccount = null; + List listOfAccount = FindAll(context, new Account(), 1, 500); + if (listOfAccount.Count > 0) + { + foreach (Account acc in listOfAccount) + { + if (acc.AccountType == accountType && acc.Classification == classification && acc.status != EntityStatusEnum.SyncError) + { + typeOfAccount = acc; + break; + } + } + } + + if (typeOfAccount == null) + { + DataService.DataService service = new DataService.DataService(context); + Account account; + + account = QBOHelper.CreateAccount(context, accountType, classification); + account.Classification = classification; + account.AccountType = accountType; + Account createdAccount = service.Add(account); + typeOfAccount = createdAccount; + + + } + + return typeOfAccount; + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + var entityResponse = FindOrAddAccount(serviceContext, accountType, classification); + return entityResponse; + + + } + else + { + throw ex; + } + } + + } + + internal static Purchase FindOrAddPurchase(ServiceContext context, PaymentTypeEnum paymentType) + { + try + { + Purchase typeOfPurchase = null; + List listOfPurchase = FindAll(context, new Purchase(), 1, 10).Where(p => p.status != EntityStatusEnum.SyncError).ToList(); + if (listOfPurchase.Count > 0) + { + if (context.ServiceType == IntuitServicesType.QBO) + { + + foreach (Purchase payment in listOfPurchase) + { + if (payment.PaymentType == paymentType) + { + typeOfPurchase = payment; + break; + } + } + + if (typeOfPurchase == null) + { + //create a new purchase account + DataService.DataService service = new DataService.DataService(context); + Purchase purchase; + purchase = QBOHelper.CreatePurchase(context, PaymentTypeEnum.Cash); + //purchase.PaymentType = paymentType; + //purchase.PaymentTypeSpecified = true; + Purchase createdPurchase = service.Add(purchase); + typeOfPurchase = createdPurchase; + } + } + + + } + + return typeOfPurchase; + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + var entityResponse = FindOrAddPurchase(serviceContext, paymentType); + return entityResponse; + + + } + else + { + throw ex; + } + } + } + + + internal static PaymentMethod FindOrAddPaymentMethod(ServiceContext context, string paymentType) + { + try + { + PaymentMethod typeOfPayment = null; + List listOfPayment = FindAll(context, new PaymentMethod(), 1, 10).Where(p => p.status != EntityStatusEnum.SyncError).ToList(); + if (listOfPayment.Count > 0) + { + if (context.ServiceType == IntuitServicesType.QBO) + { + + foreach (PaymentMethod payment in listOfPayment) + { + if (payment.Type == paymentType) + { + typeOfPayment = payment; + break; + } + } + + if (typeOfPayment == null) + { + //Create a new purchase account + DataService.DataService service = new DataService.DataService(context); + PaymentMethod payment; + payment = QBOHelper.CreatePaymentMethod(context); + PaymentMethod createdPurchase = service.Add(payment); + typeOfPayment = createdPurchase; + } + } + + } + + return typeOfPayment; + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + var entityResponse = FindOrAddPaymentMethod(serviceContext, paymentType); + return entityResponse; + + + } + else + { + throw ex; + } + } + + } + + internal static Item FindOrAddItem(ServiceContext context, ItemTypeEnum type) + { + try + { + Item typeOfItem = null; + List listOfItem = FindAll(context, new Item(), 1, 500).Where(i => i.status != EntityStatusEnum.SyncError).ToList(); + if (listOfItem.Count > 0) + { + foreach (Item item in listOfItem) + { + if (item.Type == type) + { + typeOfItem = item; + break; + } + } + } + + if (typeOfItem == null) + { + DataService.DataService service = new DataService.DataService(context); + Item item; + + item = QBOHelper.CreateItem(context); + Item createdItem = service.Add(item); + typeOfItem = createdItem; + + + } + + return typeOfItem; + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + var entityResponse = FindOrAddItem(serviceContext, type); + return entityResponse; + + + } + else + { + throw ex; + } + } + } + + + + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs new file mode 100644 index 0000000..fc7d195 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs @@ -0,0 +1,313 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Intuit.Ipp.Security; +using Intuit.Ipp.Core; +using Intuit.Ipp.DataService; + +using System.Net; +using System.Globalization; +using System.IO; +using Intuit.Ipp.Exception; +using Intuit.Ipp.Data; +using Intuit.Ipp.OAuth2PlatformClient; +using Microsoft.Extensions.Configuration; +using Intuit.Ipp.Core.Configuration; +using Newtonsoft.Json.Linq; +using Newtonsoft.Json; + +namespace Intuit.Ipp.Test +{ + public class Initializer + { + + static OAuth2Client oauthClient = null; + public static Dictionary tokenDict = new Dictionary(); + public static string pathFile = ""; + static int counter = 0; + + static IConfigurationRoot builder; + public Initializer(string path) + { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; + //AuthorizationKeysQBO.tokenFilePath = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()))), "TokenStore.json"); + + AuthorizationKeysQBO.tokenFilePath = Path.Combine(System.IO.Directory.GetCurrentDirectory(), "TokenStore.json"); + + var builder = new ConfigurationBuilder() + .SetBasePath(Directory.GetCurrentDirectory()) + .AddJsonFile(path, optional: true, reloadOnChange: true) + .AddEnvironmentVariables() + .Build(); + + + AuthorizationKeysQBO.accessTokenQBO= builder.GetSection("Oauth2Keys")["AccessToken"]; + + AuthorizationKeysQBO.refreshTokenQBO = builder.GetSection("Oauth2Keys")["RefreshToken"]; + AuthorizationKeysQBO.clientIdQBO = builder.GetSection("Oauth2Keys")["ClientId"]; + AuthorizationKeysQBO.clientSecretQBO = builder.GetSection("Oauth2Keys")["ClientSecret"]; + AuthorizationKeysQBO.realmIdIAQBO = builder.GetSection("Oauth2Keys")["RealmId"]; + AuthorizationKeysQBO.redirectUrl = builder.GetSection("Oauth2Keys")["RedirectUrl"]; + AuthorizationKeysQBO.qboBaseUrl = builder.GetSection("Oauth2Keys")["QBOBaseUrl"]; + AuthorizationKeysQBO.appEnvironment = builder.GetSection("Oauth2Keys")["Environment"]; + FileInfo fileinfo = new FileInfo(AuthorizationKeysQBO.tokenFilePath); + string jsonFile = File.ReadAllText(fileinfo.FullName); + var jObj = JObject.Parse(jsonFile); + jObj["Oauth2Keys"]["AccessToken"] = AuthorizationKeysQBO.accessTokenQBO; + jObj["Oauth2Keys"]["RefreshToken"] = AuthorizationKeysQBO.refreshTokenQBO; + + string output = JsonConvert.SerializeObject(jObj, Formatting.Indented); + File.WriteAllText(fileinfo.FullName, output); + + counter++; + + + } + public Initializer() : this("Appsettings.json") + { + + } + + + static Initializer() + { } + + + private static void Initialize() + { + Initializer initializer = new Initializer(); + } + + + internal static ServiceContext InitializeQBOServiceContextUsingoAuth() + { + if (counter==0) + //if(tokenDict.Count == 0) + Initialize(); + else + { + //Load the second json file + FileInfo fileinfo = new FileInfo(AuthorizationKeysQBO.tokenFilePath); + string jsonFile = File.ReadAllText(fileinfo.FullName); + var jObj = JObject.Parse(jsonFile); + AuthorizationKeysQBO.accessTokenQBO= jObj["Oauth2Keys"]["AccessToken"].ToString(); + AuthorizationKeysQBO.refreshTokenQBO = jObj["Oauth2Keys"]["RefreshToken"].ToString(); + } + + ServiceContext context = null; + OAuth2RequestValidator reqValidator = null; + try + { + + reqValidator = new OAuth2RequestValidator(AuthorizationKeysQBO.accessTokenQBO); + context = new ServiceContext(AuthorizationKeysQBO.realmIdIAQBO, IntuitServicesType.QBO, reqValidator); + context.IppConfiguration.MinorVersion.Qbo = "37"; + DataService.DataService service = new DataService.DataService(context); + var compinfo= service.FindAll(new CompanyInfo()); + + //Add a dataservice call to check 401 + + return context; + } + catch (IdsException ex) + { + if (ex.Message == "Unauthorized-401") + { + //oauthClient = new OAuth2Client(AuthorizationKeysQBO.clientIdQBO, AuthorizationKeysQBO.clientSecretQBO, AuthorizationKeysQBO.redirectUrl, AuthorizationKeysQBO.appEnvironment); + //var tokenResp = oauthClient.RefreshTokenAsync(AuthorizationKeysQBO.refreshTokenQBO).Result; + //if (tokenResp.AccessToken != null && tokenResp.RefreshToken != null) + //{ + // FileInfo fileinfo = new FileInfo(AuthorizationKeysQBO.tokenFilePath); + // string jsonFile = File.ReadAllText(fileinfo.FullName); + // var jObj = JObject.Parse(jsonFile); + // jObj["Oauth2Keys"]["AccessToken"] = tokenResp.AccessToken; + // jObj["Oauth2Keys"]["RefreshToken"] = tokenResp.RefreshToken; + + // string output = JsonConvert.SerializeObject(jObj, Formatting.Indented); + // File.WriteAllText(fileinfo.FullName, output); + + var serviceContext = Helper.GetNewTokens_ServiceContext(); + return serviceContext; + + } + else + { + throw ex; + } + } + + } + + + + internal static Customer CreateCustomer1() + { + Customer newCustomer = new Customer(); + string guid = Guid.NewGuid().ToString("N"); + + //Mandatory Fields + + newCustomer.DisplayName = "Cust Cust Cust"; + newCustomer.Title = "Title" + guid.Substring(0, 7); + newCustomer.DisplayName = "DN" + guid.Substring(0, 20); + + newCustomer.MiddleName = "Cust"; + newCustomer.FamilyName = "Cust"; + newCustomer.GivenName = "Cust"; + newCustomer.Balance = 1000; + return newCustomer; + } + + internal static Customer CreateCustomer2() + { + Customer newCustomer = new Customer(); + string guid = Guid.NewGuid().ToString("N"); + + //Mandatory Fields + + newCustomer.DisplayName = "Cust Cust Cust"; + newCustomer.Title = "Title" + guid.Substring(0, 7); + newCustomer.DisplayName = "DN" + guid.Substring(0, 20); + + newCustomer.MiddleName = "Cust"; + newCustomer.FamilyName = "Cust"; + newCustomer.GivenName = "Cust"; + newCustomer.Balance = 900; + return newCustomer; + } + + internal static Customer CreateCustomer3() + { + Customer newCustomer = new Customer(); + string guid = Guid.NewGuid().ToString("N"); + + //Mandatory Fields + + newCustomer.DisplayName = "Cust Cust Cust"; + newCustomer.Title = "Title" + guid.Substring(0, 7); + newCustomer.DisplayName = "DN" + guid.Substring(0, 20); + + newCustomer.MiddleName = "Cust"; + newCustomer.FamilyName = "Cust"; + newCustomer.GivenName = "Cust"; + newCustomer.Balance = 2000; + return newCustomer; + } + + internal static Customer CreateCustomer4() + { + Customer newCustomer = new Customer(); + string guid = Guid.NewGuid().ToString("N"); + + //Mandatory Fields + + newCustomer.DisplayName = "Cust Cust Cust"; + newCustomer.Title = "Title" + guid.Substring(0, 7); + newCustomer.DisplayName = "DN" + guid.Substring(0, 20); + + newCustomer.MiddleName = "Cust"; + newCustomer.FamilyName = "Cust"; + newCustomer.GivenName = "Custest"; + newCustomer.Balance = 2000; + return newCustomer; + } + + internal static Customer CreateCustomer5() + { + Customer newCustomer = new Customer(); + string guid = Guid.NewGuid().ToString("N"); + + //Mandatory Fields + + newCustomer.DisplayName = "Cust Cust Cust"; + newCustomer.Title = "Title" + guid.Substring(0, 7); + newCustomer.DisplayName = "DN" + guid.Substring(0, 20); + + newCustomer.MiddleName = "Cust111"; + newCustomer.FamilyName = "Cust"; + newCustomer.GivenName = "Custest"; + newCustomer.Balance = 2000; + newCustomer.Active = true; + return newCustomer; + + } + + internal static Customer CreateCustomer6() + { + Customer newCustomer = new Customer(); + string guid = Guid.NewGuid().ToString("N"); + + //Mandatory Fields + + newCustomer.DisplayName = "Cust Cust Cust"; + newCustomer.Title = "Title" + guid.Substring(0, 7); + newCustomer.DisplayName = "DN" + guid.Substring(0, 20); + + newCustomer.MiddleName = "Cust111"; + newCustomer.FamilyName = "A"; + newCustomer.GivenName = "Custest"; + newCustomer.Balance = 2000; + newCustomer.Active = true; + return newCustomer; + + } + + internal static Customer CreateCustomer7() + { + Customer newCustomer = new Customer(); + string guid = Guid.NewGuid().ToString("N"); + + //Mandatory Fields + + newCustomer.DisplayName = "Cust Cust Cust"; + newCustomer.Title = "Title" + guid.Substring(0, 7); + newCustomer.DisplayName = "DN" + guid.Substring(0, 20); + + newCustomer.MiddleName = "Cust111"; + newCustomer.FamilyName = "B"; + newCustomer.GivenName = "Custest"; + newCustomer.Balance = 2000; + newCustomer.Active = true; + return newCustomer; + + } + + internal static Customer CreateCustomer8() + { + Customer newCustomer = new Customer(); + string guid = Guid.NewGuid().ToString("N"); + + //Mandatory Fields + + newCustomer.DisplayName = "Cust Cust Cust"; + newCustomer.Title = "Title" + guid.Substring(0, 7); + newCustomer.DisplayName = "DN" + guid.Substring(0, 20); + + newCustomer.MiddleName = "Cust111"; + newCustomer.FamilyName = "C"; + newCustomer.GivenName = "Custest"; + newCustomer.Balance = 2000; + newCustomer.Active = true; + return newCustomer; + + } + + internal static Customer AddCustomerHelper(ServiceContext context, Customer customer) + { + //Initializing the Dataservice object with ServiceContext + DataService.DataService service = new DataService.DataService(context); + + //Adding the Customer using Dataservice object + Customer addedCustomer = service.Add(customer); + + + + return addedCustomer; + } + + + + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/QBOHelper.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/QBOHelper.cs new file mode 100644 index 0000000..fcce58b --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/QBOHelper.cs @@ -0,0 +1,12328 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Runtime.InteropServices; +using System.Text; +using Intuit.Ipp.Data; +using Intuit.Ipp.DataService; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using System.Collections.ObjectModel; +using System.Configuration; +using Intuit.Ipp.Security; +using System.Net; +using System.Globalization; +using System.IO; +using Intuit.Ipp.Exception; +using Intuit.Ipp.QueryFilter; + + +namespace Intuit.Ipp.Test +{ + class QBOHelper + { + #region Create Helper Methods + + internal static NameValue CreateNameValue(ServiceContext context) + { + NameValue nameValue = new NameValue(); + //nameValue.Name = "Name"; + //nameValue.Value = "Value"; + return nameValue; + } + + + + internal static NameValue UpdateNameValue(ServiceContext context, NameValue entity) + { + //update the properties of entity + return entity; + } + + + + internal static Company CreateCompany(ServiceContext context) + { + Company company = new Company(); + company.CompanyName = "CompanyName"; + company.LegalName = "LegalName"; + PhysicalAddress companyAddr = new PhysicalAddress(); + companyAddr.Line1 = "Company_addr"; + companyAddr.Line2 = "Company_addr2"; + //companyAddr.Line3 = "line3"; + //companyAddr.Line4 = "Line4"; + //companyAddr.Line5 = "Line5"; + companyAddr.City = "Hyderabad"; + companyAddr.Country = "India"; + companyAddr.CountryCode = "009"; + //companyAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //companyAddr.PostalCode = "PostalCode"; + //companyAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //companyAddr.Lat = "Lat"; + //companyAddr.Long = "Long"; + //companyAddr.Tag = "Tag"; + //companyAddr.Note = "Note"; + company.CompanyAddr = companyAddr; + PhysicalAddress customerCommunicationAddr = new PhysicalAddress(); + customerCommunicationAddr.Line1 = "Line1"; + customerCommunicationAddr.Line2 = "Line2"; + customerCommunicationAddr.Line3 = "Line3"; + //customerCommunicationAddr.Line4 = "Line4"; + //customerCommunicationAddr.Line5 = "Line5"; + customerCommunicationAddr.City = "hyd"; + customerCommunicationAddr.Country = "India"; + customerCommunicationAddr.CountryCode = "009"; + //customerCommunicationAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //customerCommunicationAddr.PostalCode = "PostalCode"; + //customerCommunicationAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //customerCommunicationAddr.Lat = "Lat"; + //customerCommunicationAddr.Long = "Long"; + //customerCommunicationAddr.Tag = "Tag"; + //customerCommunicationAddr.Note = "Note"; + company.CustomerCommunicationAddr = customerCommunicationAddr; + //PhysicalAddress legalAddr = new PhysicalAddress(); + //legalAddr.Line1 = "Line1"; + //legalAddr.Line2 = "Line2"; + //legalAddr.Line3 = "Line3"; + //legalAddr.Line4 = "Line4"; + //legalAddr.Line5 = "Line5"; + //legalAddr.City = "City"; + //legalAddr.Country = "Country"; + //legalAddr.CountryCode = "CountryCode"; + //legalAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //legalAddr.PostalCode = "PostalCode"; + //legalAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //legalAddr.Lat = "Lat"; + //legalAddr.Long = "Long"; + //legalAddr.Tag = "Tag"; + //legalAddr.Note = "Note"; + //company.LegalAddr = legalAddr; + //EmailAddress companyEmailAddr = new EmailAddress(); + //companyEmailAddr.Address = "Address"; + //companyEmailAddr.Default = true; + //companyEmailAddr.DefaultSpecified = true; + //companyEmailAddr.Tag = "Tag"; + //company.CompanyEmailAddr = companyEmailAddr; + //EmailAddress customerCommunicationEmailAddr = new EmailAddress(); + //customerCommunicationEmailAddr.Address = "Address"; + //customerCommunicationEmailAddr.Default = true; + //customerCommunicationEmailAddr.DefaultSpecified = true; + //customerCommunicationEmailAddr.Tag = "Tag"; + //company.CustomerCommunicationEmailAddr = customerCommunicationEmailAddr; + //WebSiteAddress companyURL = new WebSiteAddress(); + //companyURL.URI = "URI"; + //companyURL.Default = true; + //companyURL.DefaultSpecified = true; + //companyURL.Tag = "Tag"; + //company.CompanyURL = companyURL; + TelephoneNumber primaryPhone = new TelephoneNumber(); + primaryPhone.DeviceType = "DeviceType"; + primaryPhone.CountryCode = "CountryCode"; + primaryPhone.AreaCode = "AreaCode"; + primaryPhone.ExchangeCode = "ExchangeCode"; + primaryPhone.Extension = "Extension"; + primaryPhone.FreeFormNumber = "FreeFormNumber"; + primaryPhone.Default = true; + primaryPhone.DefaultSpecified = true; + //primaryPhone.Tag = "Tag"; + company.PrimaryPhone = primaryPhone; + + //List otherContactInfoList = new List(); + //ContactInfo otherContactInfo = new ContactInfo(); + //otherContactInfo.Type = ContactTypeEnum.; + //otherContactInfo.TypeSpecified = true; + //otherContactInfo.AnyIntuitObject = + //otherContactInfoList.Add(otherContactInfo); + //company.OtherContactInfo = otherContactInfoList.ToArray(); + //company.CompanyFileName = "CompanyFileName"; + //company.FlavorStratum = "FlavorStratum"; + //company.SampleFile = true; + //company.SampleFileSpecified = true; + //company.CompanyUserId = "CompanyUserId"; + //company.CompanyUserAdminEmail = "CompanyUserAdminEmail"; + //company.CompanyStartDate = DateTime.UtcNow.Date; + //company.CompanyStartDateSpecified = true; + //company.EmployerId = "EmployerId"; + //company.FiscalYearStartMonth = MonthEnum.; + //company.FiscalYearStartMonthSpecified = true; + //company.TaxYearStartMonth = MonthEnum.; + //company.TaxYearStartMonthSpecified = true; + //company.QBVersion = "QBVersion"; + //company.Country = "Country"; + //PhysicalAddress shipAddr = new PhysicalAddress(); + //shipAddr.Line1 = "Line1"; + //shipAddr.Line2 = "Line2"; + //shipAddr.Line3 = "Line3"; + //shipAddr.Line4 = "Line4"; + //shipAddr.Line5 = "Line5"; + //shipAddr.City = "City"; + //shipAddr.Country = "Country"; + //shipAddr.CountryCode = "CountryCode"; + //shipAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //shipAddr.PostalCode = "PostalCode"; + //shipAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //shipAddr.Lat = "Lat"; + //shipAddr.Long = "Long"; + //shipAddr.Tag = "Tag"; + //shipAddr.Note = "Note"; + //company.ShipAddr = shipAddr; + + //List otherAddrList = new List(); + //PhysicalAddress otherAddr = new PhysicalAddress(); + //otherAddr.Line1 = "Line1"; + //otherAddr.Line2 = "Line2"; + //otherAddr.Line3 = "Line3"; + //otherAddr.Line4 = "Line4"; + //otherAddr.Line5 = "Line5"; + //otherAddr.City = "City"; + //otherAddr.Country = "Country"; + //otherAddr.CountryCode = "CountryCode"; + //otherAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //otherAddr.PostalCode = "PostalCode"; + //otherAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //otherAddr.Lat = "Lat"; + //otherAddr.Long = "Long"; + //otherAddr.Tag = "Tag"; + //otherAddr.Note = "Note"; + //otherAddrList.Add(otherAddr); + //company.OtherAddr = otherAddrList.ToArray(); + //TelephoneNumber mobile = new TelephoneNumber(); + //mobile.DeviceType = "DeviceType"; + //mobile.CountryCode = "CountryCode"; + //mobile.AreaCode = "AreaCode"; + //mobile.ExchangeCode = "ExchangeCode"; + //mobile.Extension = "Extension"; + //mobile.FreeFormNumber = "FreeFormNumber"; + //mobile.Default = true; + //mobile.DefaultSpecified = true; + //mobile.Tag = "Tag"; + //company.Mobile = mobile; + //TelephoneNumber fax = new TelephoneNumber(); + //fax.DeviceType = "DeviceType"; + //fax.CountryCode = "CountryCode"; + //fax.AreaCode = "AreaCode"; + //fax.ExchangeCode = "ExchangeCode"; + //fax.Extension = "Extension"; + //fax.FreeFormNumber = "FreeFormNumber"; + //fax.Default = true; + //fax.DefaultSpecified = true; + //fax.Tag = "Tag"; + //company.Fax = fax; + //EmailAddress email = new EmailAddress(); + //email.Address = "Address"; + //email.Default = true; + //email.DefaultSpecified = true; + //email.Tag = "Tag"; + //company.Email = email; + //WebSiteAddress webSite = new WebSiteAddress(); + //webSite.URI = "URI"; + //webSite.Default = true; + //webSite.DefaultSpecified = true; + //webSite.Tag = "Tag"; + //company.WebSite = webSite; + //company.LastImportedTime = DateTime.UtcNow.Date; + //company.LastImportedTimeSpecified = true; + //company.SupportedLanguages = "SupportedLanguages"; + //company.DefaultTimeZone = "DefaultTimeZone"; + //company.MultiByteCharsSupported = true; + //company.MultiByteCharsSupportedSpecified = true; + + //List nameValueList = new List(); + //NameValue nameValue = new NameValue(); + //nameValue.Name = "Name"; + //nameValue.Value = "Value"; + //nameValueList.Add(nameValue); + //company.NameValue = nameValueList.ToArray(); + //company.CompanyInfoEx = + return company; + } + + + + internal static Company UpdateCompany(ServiceContext context, Company entity) + { + //update the properties of entity + entity.CompanyName = "ComapnyName" + Helper.GetGuid().Substring(0, 5); + entity.LegalName = "legalName" + Helper.GetGuid().Substring(0, 5); + + return entity; + } + + + internal static Company UpdateCompanySparse(ServiceContext context, string id, string syncToken) + { + Company entity = new Company(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.CompanyName = "ComapnyName" + Helper.GetGuid().Substring(0, 5); + entity.LegalName = "legalName" + Helper.GetGuid().Substring(0, 5); + + return entity; + } + + internal static CompanyInfo CreateCompanyInfo(ServiceContext context) + { + CompanyInfo companyInfo = new CompanyInfo(); + companyInfo.CompanyName = "CompanyName"; + companyInfo.LegalName = "LegalName"; + PhysicalAddress companyAddr = new PhysicalAddress(); + companyAddr.Line1 = "company_addr"; + companyAddr.Line2 = "compnay_addr2"; + //companyAddr.Line3 = "Line3"; + //companyAddr.Line4 = "Line4"; + //companyAddr.Line5 = "Line5"; + companyAddr.City = "Bangalore"; + companyAddr.Country = "India"; + companyAddr.CountryCode = "CountryCode"; + //companyAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + companyAddr.PostalCode = "PostalCode"; + //companyAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //companyAddr.Lat = "Lat"; + //companyAddr.Long = "Long"; + //companyAddr.Tag = "Tag"; + //companyAddr.Note = "Note"; + companyInfo.CompanyAddr = companyAddr; + PhysicalAddress customerCommunicationAddr = new PhysicalAddress(); + customerCommunicationAddr.Line1 = "addr_comunication"; + customerCommunicationAddr.Line2 = "addr2_communication"; + //customerCommunicationAddr.Line3 = "Line3"; + //customerCommunicationAddr.Line4 = "Line4"; + //customerCommunicationAddr.Line5 = "Line5"; + customerCommunicationAddr.City = "Bnagalore"; + customerCommunicationAddr.Country = "India"; + customerCommunicationAddr.CountryCode = "009"; + //customerCommunicationAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + customerCommunicationAddr.PostalCode = "PostalCode"; + //customerCommunicationAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //customerCommunicationAddr.Lat = "Lat"; + //customerCommunicationAddr.Long = "Long"; + //customerCommunicationAddr.Tag = "Tag"; + //customerCommunicationAddr.Note = "Note"; + companyInfo.CustomerCommunicationAddr = customerCommunicationAddr; + PhysicalAddress legalAddr = new PhysicalAddress(); + legalAddr.Line1 = "legal_addr1" + Helper.GetGuid().Substring(0, 5); + legalAddr.Line2 = "legal_addr2" + Helper.GetGuid().Substring(0, 5); + //legalAddr.Line3 = "Line3"; + //legalAddr.Line4 = "Line4"; + //legalAddr.Line5 = "Line5"; + legalAddr.City = "hyd"; + legalAddr.Country = "India"; + legalAddr.CountryCode = "0009"; + //legalAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //legalAddr.PostalCode = "PostalCode"; + //legalAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //legalAddr.Lat = "Lat"; + //legalAddr.Long = "Long"; + //legalAddr.Tag = "Tag"; + //legalAddr.Note = "Note"; + companyInfo.LegalAddr = legalAddr; + //EmailAddress companyEmailAddr = new EmailAddress(); + //companyEmailAddr.Address = "Address"; + //companyEmailAddr.Default = true; + //companyEmailAddr.DefaultSpecified = true; + //companyEmailAddr.Tag = "Tag"; + //companyInfo.CompanyEmailAddr = companyEmailAddr; + //EmailAddress customerCommunicationEmailAddr = new EmailAddress(); + //customerCommunicationEmailAddr.Address = "Address"; + //customerCommunicationEmailAddr.Default = true; + //customerCommunicationEmailAddr.DefaultSpecified = true; + //customerCommunicationEmailAddr.Tag = "Tag"; + //companyInfo.CustomerCommunicationEmailAddr = customerCommunicationEmailAddr; + //WebSiteAddress companyURL = new WebSiteAddress(); + //companyURL.URI = "URI"; + //companyURL.Default = true; + //companyURL.DefaultSpecified = true; + //companyURL.Tag = "Tag"; + //companyInfo.CompanyURL = companyURL; + //TelephoneNumber primaryPhone = new TelephoneNumber(); + //primaryPhone.DeviceType = "DeviceType"; + //primaryPhone.CountryCode = "CountryCode"; + //primaryPhone.AreaCode = "AreaCode"; + //primaryPhone.ExchangeCode = "ExchangeCode"; + //primaryPhone.Extension = "Extension"; + //primaryPhone.FreeFormNumber = "FreeFormNumber"; + //primaryPhone.Default = true; + //primaryPhone.DefaultSpecified = true; + //primaryPhone.Tag = "Tag"; + //companyInfo.PrimaryPhone = primaryPhone; + + //List otherContactInfoList = new List(); + //ContactInfo otherContactInfo = new ContactInfo(); + //otherContactInfo.Type = ContactTypeEnum.; + //otherContactInfo.TypeSpecified = true; + //otherContactInfo.AnyIntuitObject = + //otherContactInfoList.Add(otherContactInfo); + //companyInfo.OtherContactInfo = otherContactInfoList.ToArray(); + //companyInfo.CompanyFileName = "CompanyFileName"; + //companyInfo.FlavorStratum = "FlavorStratum"; + //companyInfo.SampleFile = true; + //companyInfo.SampleFileSpecified = true; + //companyInfo.CompanyUserId = "CompanyUserId"; + //companyInfo.CompanyUserAdminEmail = "CompanyUserAdminEmail"; + //companyInfo.CompanyStartDate = DateTime.UtcNow.Date; + //companyInfo.CompanyStartDateSpecified = true; + //companyInfo.EmployerId = "EmployerId"; + //companyInfo.FiscalYearStartMonth = MonthEnum.; + //companyInfo.FiscalYearStartMonthSpecified = true; + //companyInfo.TaxYearStartMonth = MonthEnum.; + //companyInfo.TaxYearStartMonthSpecified = true; + //companyInfo.QBVersion = "QBVersion"; + //companyInfo.Country = "Country"; + //PhysicalAddress shipAddr = new PhysicalAddress(); + //shipAddr.Line1 = "Line1"; + //shipAddr.Line2 = "Line2"; + //shipAddr.Line3 = "Line3"; + //shipAddr.Line4 = "Line4"; + //shipAddr.Line5 = "Line5"; + //shipAddr.City = "City"; + //shipAddr.Country = "Country"; + //shipAddr.CountryCode = "CountryCode"; + //shipAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //shipAddr.PostalCode = "PostalCode"; + //shipAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //shipAddr.Lat = "Lat"; + //shipAddr.Long = "Long"; + //shipAddr.Tag = "Tag"; + //shipAddr.Note = "Note"; + //companyInfo.ShipAddr = shipAddr; + + //List otherAddrList = new List(); + //PhysicalAddress otherAddr = new PhysicalAddress(); + //otherAddr.Line1 = "Line1"; + //otherAddr.Line2 = "Line2"; + //otherAddr.Line3 = "Line3"; + //otherAddr.Line4 = "Line4"; + //otherAddr.Line5 = "Line5"; + //otherAddr.City = "City"; + //otherAddr.Country = "Country"; + //otherAddr.CountryCode = "CountryCode"; + //otherAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //otherAddr.PostalCode = "PostalCode"; + //otherAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //otherAddr.Lat = "Lat"; + //otherAddr.Long = "Long"; + //otherAddr.Tag = "Tag"; + //otherAddr.Note = "Note"; + //otherAddrList.Add(otherAddr); + //companyInfo.OtherAddr = otherAddrList.ToArray(); + //TelephoneNumber mobile = new TelephoneNumber(); + //mobile.DeviceType = "DeviceType"; + //mobile.CountryCode = "CountryCode"; + //mobile.AreaCode = "AreaCode"; + //mobile.ExchangeCode = "ExchangeCode"; + //mobile.Extension = "Extension"; + //mobile.FreeFormNumber = "FreeFormNumber"; + //mobile.Default = true; + //mobile.DefaultSpecified = true; + //mobile.Tag = "Tag"; + //companyInfo.Mobile = mobile; + //TelephoneNumber fax = new TelephoneNumber(); + //fax.DeviceType = "DeviceType"; + //fax.CountryCode = "CountryCode"; + //fax.AreaCode = "AreaCode"; + //fax.ExchangeCode = "ExchangeCode"; + //fax.Extension = "Extension"; + //fax.FreeFormNumber = "FreeFormNumber"; + //fax.Default = true; + //fax.DefaultSpecified = true; + //fax.Tag = "Tag"; + //companyInfo.Fax = fax; + //EmailAddress email = new EmailAddress(); + //email.Address = "Address"; + //email.Default = true; + //email.DefaultSpecified = true; + //email.Tag = "Tag"; + //companyInfo.Email = email; + //WebSiteAddress webAddr = new WebSiteAddress(); + //webAddr.URI = "URI"; + //webAddr.Default = true; + //webAddr.DefaultSpecified = true; + //webAddr.Tag = "Tag"; + //companyInfo.WebAddr = webAddr; + companyInfo.LastImportedTime = DateTime.UtcNow.Date; + companyInfo.LastImportedTimeSpecified = true; + //companyInfo.SupportedLanguages = "SupportedLanguages"; + companyInfo.DefaultTimeZone = "DefaultTimeZone"; + companyInfo.MultiByteCharsSupported = true; + companyInfo.MultiByteCharsSupportedSpecified = true; + + //List nameValueList = new List(); + //NameValue nameValue = new NameValue(); + //nameValue.Name = "Name"; + //nameValue.Value = "Value"; + //nameValueList.Add(nameValue); + //companyInfo.NameValue = nameValueList.ToArray(); + //companyInfo.CompanyInfoEx = + + return companyInfo; + } + + + + internal static CompanyInfo UpdateCompanyInfo(ServiceContext context, CompanyInfo entity) + { + //update the properties of entity + entity.CompanyName = entity.CompanyName.Substring(0, Math.Min(entity.CompanyName.Length, 13)) + Helper.GetGuid().Substring(0, 5); + entity.LegalName = "legal_updated" + Helper.GetGuid().Substring(0, 5); + + return entity; + } + + + internal static CompanyInfo SparseUpdateCompanyInfo(ServiceContext context, string Id, string syncToken, string companyName) + { + CompanyInfo entity = new CompanyInfo(); + entity.Id = Id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.CompanyName = companyName.Substring(0, 13) + Helper.GetGuid().Substring(0, 5); + entity.LegalName = "legal_updated" + Helper.GetGuid().Substring(0, 5); + + return entity; + } + + + + internal static Transaction CreateTransaction(ServiceContext context) + { + Transaction transaction = new Transaction(); + //transaction.DocNumber = "DocNumber"; + //transaction.TxnDate = DateTime.UtcNow.Date; + //transaction.TxnDateSpecified = true; + //transaction.DepartmentRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //transaction.CurrencyRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //transaction.ExchangeRate = new Decimal(100.00); + //transaction.ExchangeRateSpecified = true; + //transaction.PrivateNote = "PrivateNote"; + //transaction.TxnStatus = "TxnStatus"; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //transaction.LinkedTxn = linkedTxnList.ToArray(); + + //List lineList = new List(); + //Line line = new Line(); + //line.LineNum = "LineNum"; + //line.Description = "Description"; + //line.Amount = new Decimal(100.00); + //line.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + //line.DetailType = LineDetailTypeEnum.; + //line.AnyIntuitObject = + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //line.LineEx = + //lineList.Add(line); + //transaction.Line = lineList.ToArray(); + //TxnTaxDetail txnTaxDetail = new TxnTaxDetail(); + //txnTaxDetail.DefaultTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TxnTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TotalTax = new Decimal(100.00); + //txnTaxDetail.TotalTaxSpecified = true; + + //List taxLineList = new List(); + //Line taxLine = new Line(); + //taxLine.LineNum = "LineNum"; + //taxLine.Description = "Description"; + //taxLine.Amount = new Decimal(100.00); + //taxLine.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + //taxLine.DetailType = LineDetailTypeEnum.; + //taxLine.AnyIntuitObject = + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //taxLine.LineEx = + + //taxLineList.Add(taxLine); + //txnTaxDetail.TaxLine = taxLineList.ToArray(); + //transaction.TxnTaxDetail = txnTaxDetail; + return transaction; + } + + + + internal static Transaction UpdateTransaction(ServiceContext context, Transaction entity) + { + entity.PrivateNote = "updated note"; + return entity; + } + + + + internal static Transaction UpdateTransactionSparse(ServiceContext context, string id, string syncToken) + { + Transaction entity = new Transaction(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.PrivateNote = "updated note"; + return entity; + } + + + internal static SalesTransaction CreateSalesTransaction(ServiceContext context) + { + SalesTransaction salesTransaction = new SalesTransaction(); + //salesTransaction.AutoDocNumber = true; + //salesTransaction.AutoDocNumberSpecified = true; + //salesTransaction.CustomerRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //MemoRef customerMemo = new MemoRef(); + //customerMemo.id = "id"; + //customerMemo.Value = "Value"; + //salesTransaction.CustomerMemo = customerMemo; + //PhysicalAddress billAddr = new PhysicalAddress(); + //billAddr.Line1 = "Line1"; + //billAddr.Line2 = "Line2"; + //billAddr.Line3 = "Line3"; + //billAddr.Line4 = "Line4"; + //billAddr.Line5 = "Line5"; + //billAddr.City = "City"; + //billAddr.Country = "Country"; + //billAddr.CountryCode = "CountryCode"; + //billAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //billAddr.PostalCode = "PostalCode"; + //billAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //billAddr.Lat = "Lat"; + //billAddr.Long = "Long"; + //billAddr.Tag = "Tag"; + //billAddr.Note = "Note"; + //salesTransaction.BillAddr = billAddr; + //PhysicalAddress shipAddr = new PhysicalAddress(); + //shipAddr.Line1 = "Line1"; + //shipAddr.Line2 = "Line2"; + //shipAddr.Line3 = "Line3"; + //shipAddr.Line4 = "Line4"; + //shipAddr.Line5 = "Line5"; + //shipAddr.City = "City"; + //shipAddr.Country = "Country"; + //shipAddr.CountryCode = "CountryCode"; + //shipAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //shipAddr.PostalCode = "PostalCode"; + //shipAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //shipAddr.Lat = "Lat"; + //shipAddr.Long = "Long"; + //shipAddr.Tag = "Tag"; + //shipAddr.Note = "Note"; + //salesTransaction.ShipAddr = shipAddr; + //salesTransaction.RemitToRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesTransaction.ClassRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesTransaction.SalesTermRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesTransaction.DueDate = DateTime.UtcNow.Date; + //salesTransaction.DueDateSpecified = true; + //salesTransaction.SalesRepRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesTransaction.PONumber = "PONumber"; + //salesTransaction.FOB = "FOB"; + //salesTransaction.ShipMethodRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesTransaction.ShipDate = DateTime.UtcNow.Date; + //salesTransaction.ShipDateSpecified = true; + //salesTransaction.TrackingNum = "TrackingNum"; + //salesTransaction.GlobalTaxCalculation = GlobalTaxCalculationEnum.; + //salesTransaction.GlobalTaxCalculationSpecified = true; + //salesTransaction.TotalAmt = new Decimal(100.00); + //salesTransaction.TotalAmtSpecified = true; + //salesTransaction.HomeTotalAmt = new Decimal(100.00); + //salesTransaction.HomeTotalAmtSpecified = true; + //salesTransaction.ApplyTaxAfterDiscount = true; + //salesTransaction.ApplyTaxAfterDiscountSpecified = true; + //salesTransaction.TemplateRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesTransaction.PrintStatus = PrintStatusEnum.; + //salesTransaction.PrintStatusSpecified = true; + //salesTransaction.EmailStatus = EmailStatusEnum.; + //salesTransaction.EmailStatusSpecified = true; + //EmailAddress billEmail = new EmailAddress(); + //billEmail.Address = "Address"; + //billEmail.Default = true; + //billEmail.DefaultSpecified = true; + //billEmail.Tag = "Tag"; + //salesTransaction.BillEmail = billEmail; + //salesTransaction.ARAccountRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesTransaction.Balance = new Decimal(100.00); + //salesTransaction.BalanceSpecified = true; + //salesTransaction.FinanceCharge = true; + //salesTransaction.FinanceChargeSpecified = true; + //salesTransaction.PaymentMethodRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesTransaction.PaymentRefNum = "PaymentRefNum"; + //salesTransaction.PaymentType = PaymentTypeEnum.; + //salesTransaction.PaymentTypeSpecified = true; + //salesTransaction.AnyIntuitObject = + //salesTransaction.DepositToAccountRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesTransaction.DocNumber = "DocNumber"; + //salesTransaction.TxnDate = DateTime.UtcNow.Date; + //salesTransaction.TxnDateSpecified = true; + //salesTransaction.DepartmentRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesTransaction.CurrencyRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesTransaction.ExchangeRate = new Decimal(100.00); + //salesTransaction.ExchangeRateSpecified = true; + //salesTransaction.PrivateNote = "PrivateNote"; + //salesTransaction.TxnStatus = "TxnStatus"; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //salesTransaction.LinkedTxn = linkedTxnList.ToArray(); + + //List lineList = new List(); + //Line line = new Line(); + //line.LineNum = "LineNum"; + //line.Description = "Description"; + //line.Amount = new Decimal(100.00); + //line.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + //line.DetailType = LineDetailTypeEnum.; + //line.AnyIntuitObject = + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //line.LineEx = + + //lineList.Add(line); + //salesTransaction.Line = lineList.ToArray(); + //TxnTaxDetail txnTaxDetail = new TxnTaxDetail(); + //txnTaxDetail.DefaultTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TxnTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TotalTax = new Decimal(100.00); + //txnTaxDetail.TotalTaxSpecified = true; + + //List taxLineList = new List(); + //Line taxLine = new Line(); + //taxLine.LineNum = "LineNum"; + //taxLine.Description = "Description"; + //taxLine.Amount = new Decimal(100.00); + //taxLine.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + //taxLine.DetailType = LineDetailTypeEnum.; + //taxLine.AnyIntuitObject = + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //taxLine.LineEx = + + //taxLineList.Add(taxLine); + //txnTaxDetail.TaxLine = taxLineList.ToArray(); + //salesTransaction.TxnTaxDetail = txnTaxDetail; + return salesTransaction; + } + + + + internal static SalesTransaction UpdateSalesTransaction(ServiceContext context, SalesTransaction entity) + { + //update the properties of entity + return entity; + } + + + internal static SalesTransaction UpdateSalesTransactionSparse(ServiceContext context, string id, string syncToken) + { + SalesTransaction entity = new SalesTransaction(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.Balance = new Decimal(100); + entity.BalanceSpecified = true; + return entity; + } + + + internal static Invoice CreateInvoice(ServiceContext context) + { + Customer customer = Helper.FindOrAdd(context, new Customer()); + TaxCode taxCode = Helper.FindOrAdd(context, new TaxCode()); + Account account = Helper.FindOrAddAccount(context, AccountTypeEnum.AccountsReceivable, AccountClassificationEnum.Liability); + + Invoice invoice = new Invoice(); + invoice.Deposit = new Decimal(0.00); + invoice.DepositSpecified = true; + invoice.AllowIPNPayment = false; + invoice.AllowIPNPaymentSpecified = true; + //invoice.InvoiceEx = + + //invoice.AutoDocNumber = true; + //invoice.AutoDocNumberSpecified = true; + invoice.CustomerRef = new ReferenceType() + { + name = customer.DisplayName, + Value = customer.Id + }; + //MemoRef customerMemo = new MemoRef(); + //customerMemo.id = "id"; + //customerMemo.Value = "Value"; + //invoice.CustomerMemo = customerMemo; + //PhysicalAddress billAddr = new PhysicalAddress(); + //billAddr.Line1 = "Line1"; + //billAddr.Line2 = "Line2"; + //billAddr.Line3 = "Line3"; + //billAddr.Line4 = "Line4"; + //billAddr.Line5 = "Line5"; + //billAddr.City = "City"; + //billAddr.Country = "Country"; + //billAddr.CountryCode = "CountryCode"; + //billAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //billAddr.PostalCode = "PostalCode"; + //billAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //billAddr.Lat = "Lat"; + //billAddr.Long = "Long"; + //billAddr.Tag = "Tag"; + //billAddr.Note = "Note"; + //invoice.BillAddr = billAddr; + //PhysicalAddress shipAddr = new PhysicalAddress(); + //shipAddr.Line1 = "Line1"; + //shipAddr.Line2 = "Line2"; + //shipAddr.Line3 = "Line3"; + //shipAddr.Line4 = "Line4"; + //shipAddr.Line5 = "Line5"; + //shipAddr.City = "City"; + //shipAddr.Country = "Country"; + //shipAddr.CountryCode = "CountryCode"; + //shipAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //shipAddr.PostalCode = "PostalCode"; + //shipAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //shipAddr.Lat = "Lat"; + //shipAddr.Long = "Long"; + //shipAddr.Tag = "Tag"; + //shipAddr.Note = "Note"; + //invoice.ShipAddr = shipAddr; + //invoice.RemitToRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //invoice.ClassRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //invoice.SalesTermRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + invoice.DueDate = DateTime.UtcNow.Date; + invoice.DueDateSpecified = true; + //invoice.SalesRepRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //invoice.PONumber = "PONumber"; + //invoice.FOB = "FOB"; + //invoice.ShipMethodRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //invoice.ShipDate = DateTime.UtcNow.Date; + //invoice.ShipDateSpecified = true; + //invoice.TrackingNum = "TrackingNum"; + //invoice.GlobalTaxCalculation = GlobalTaxCalculationEnum.TaxExcluded; + //invoice.GlobalTaxCalculationSpecified = true; + invoice.TotalAmt = new Decimal(0.00); + invoice.TotalAmtSpecified = true; + //invoice.HomeTotalAmt = new Decimal(100.00); + //invoice.HomeTotalAmtSpecified = true; + //invoice.ApplyTaxAfterDiscount = false; + //invoice.ApplyTaxAfterDiscountSpecified = true; + //invoice.TemplateRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + invoice.PrintStatus = PrintStatusEnum.NotSet; + invoice.PrintStatusSpecified = true; + invoice.EmailStatus = EmailStatusEnum.NotSet; + invoice.EmailStatusSpecified = true; + + EmailAddress billEmail = new EmailAddress(); + billEmail.Address = @"abc@gmail.com"; + billEmail.Default = true; + billEmail.DefaultSpecified = true; + billEmail.Tag = "Tag"; + invoice.BillEmail = billEmail; + + EmailAddress billEmailcc = new EmailAddress(); + billEmailcc.Address = @"def@gmail.com"; + billEmailcc.Default = true; + billEmailcc.DefaultSpecified = true; + billEmailcc.Tag = "Tag"; + invoice.BillEmailCc = billEmailcc; + + EmailAddress billEmailbcc = new EmailAddress(); + billEmailbcc.Address = @"xyz@gmail.com"; + billEmailbcc.Default = true; + billEmailbcc.DefaultSpecified = true; + billEmailbcc.Tag = "Tag"; + invoice.BillEmailBcc = billEmailbcc; + + + invoice.ARAccountRef = new ReferenceType() + { + type = Enum.GetName(typeof(objectNameEnumType), objectNameEnumType.Account), + name = "Account Receivable", + Value = "QB:37" + }; + invoice.Balance = new Decimal(0.00); + invoice.BalanceSpecified = true; + + + + //invoice.FinanceCharge = true; + //invoice.FinanceChargeSpecified = true; + //invoice.PaymentMethodRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //invoice.PaymentRefNum = "PaymentRefNum"; + //invoice.PaymentType = PaymentTypeEnum.; + //invoice.PaymentTypeSpecified = true; + //invoice.AnyIntuitObject = + //invoice.DepositToAccountRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //invoice.DocNumber = "DocNumber"; + invoice.TxnDate = DateTime.UtcNow.Date; + invoice.TxnDateSpecified = true; + //invoice.DepartmentRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //invoice.CurrencyRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //invoice.ExchangeRate = new Decimal(100.00); + //invoice.ExchangeRateSpecified = true; + //invoice.PrivateNote = "PrivateNote"; + //invoice.TxnStatus = "TxnStatus"; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //invoice.LinkedTxn = linkedTxnList.ToArray(); + + List lineList = new List(); + Line line = new Line(); + //line.LineNum = "LineNum"; + line.Description = "Description"; + line.Amount = new Decimal(100.00); + line.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + line.DetailType = LineDetailTypeEnum.DescriptionOnly; + line.DetailTypeSpecified = true; + //line.AnyIntuitObject = + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //line.LineEx = + + lineList.Add(line); + invoice.Line = lineList.ToArray(); + //TxnTaxDetail txnTaxDetail = new TxnTaxDetail(); + //txnTaxDetail.DefaultTaxCodeRef = new ReferenceType() + //{ + // Value = taxCode.Id, + // type = Enum.GetName(typeof(objectNameEnumType), objectNameEnumType.Customer), + // name = taxCode.Name + //}; + //txnTaxDetail.TxnTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TotalTax = new Decimal(0.00); + //txnTaxDetail.TotalTaxSpecified = true; + + //List taxLineList = new List(); + //Line taxLine = new Line(); + //taxLine.LineNum = "LineNum"; + //taxLine.Description = "Description"; + //taxLine.Amount = new Decimal(100.00); + //taxLine.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + //taxLine.DetailType = LineDetailTypeEnum.; + //taxLine.AnyIntuitObject = + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //taxLine.LineEx = + + //taxLineList.Add(taxLine); + //txnTaxDetail.TaxLine = taxLineList.ToArray(); + //invoice.TxnTaxDetail = txnTaxDetail; + return invoice; + } + + + + internal static Invoice UpdateInvoice(ServiceContext context, Invoice entity) + { + //update the properties of entity + entity.DocNumber = "11" + Helper.GetGuid().Substring(0, 3); + entity.TxnTaxDetail = null; + return entity; + } + + + internal static Invoice SparseUpdateInvoice(ServiceContext context, string Id, string syncToken) + { + Invoice entity = new Invoice(); + entity.Id = Id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.DocNumber = "sparseupdated" + Helper.GetGuid().Substring(0, 3); + return entity; + } + + + + internal static SalesReceipt CreateSalesReceipt(ServiceContext context) + { + SalesReceipt salesReceipt = new SalesReceipt(); + //salesReceipt.SalesReceiptEx = + //salesReceipt.AutoDocNumber = true; + //salesReceipt.AutoDocNumberSpecified = true; + //Customer customer = Helper.FindOrAdd(context, new Customer()); + //salesReceipt.CustomerRef = new ReferenceType() + //{ + // name = "030ee948-bda4-421d-977a-1", + // Value = "19" + //}; + //MemoRef customerMemo = new MemoRef(); + //customerMemo.id = "id"; + //customerMemo.Value = "Value"; + //salesReceipt.CustomerMemo = customerMemo; + //PhysicalAddress billAddr = new PhysicalAddress(); + //billAddr.Line1 = "Line1"; + //billAddr.Line2 = "Line2"; + //billAddr.Line3 = "Line3"; + //billAddr.Line4 = "Line4"; + //billAddr.Line5 = "Line5"; + //billAddr.City = "City"; + //billAddr.Country = "Country"; + //billAddr.CountryCode = "CountryCode"; + //billAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //billAddr.PostalCode = "PostalCode"; + //billAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //billAddr.Lat = "Lat"; + //billAddr.Long = "Long"; + //billAddr.Tag = "Tag"; + //billAddr.Note = "Note"; + //salesReceipt.BillAddr = billAddr; + //PhysicalAddress shipAddr = new PhysicalAddress(); + //shipAddr.Line1 = "Line1"; + //shipAddr.Line2 = "Line2"; + //shipAddr.Line3 = "Line3"; + //shipAddr.Line4 = "Line4"; + //shipAddr.Line5 = "Line5"; + //shipAddr.City = "City"; + //shipAddr.Country = "Country"; + //shipAddr.CountryCode = "CountryCode"; + //shipAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //shipAddr.PostalCode = "PostalCode"; + //shipAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //shipAddr.Lat = "Lat"; + //shipAddr.Long = "Long"; + //shipAddr.Tag = "Tag"; + //shipAddr.Note = "Note"; + //salesReceipt.ShipAddr = shipAddr; + //salesReceipt.RemitToRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesReceipt.ClassRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesReceipt.SalesTermRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesReceipt.DueDate = DateTime.UtcNow.Date; + //salesReceipt.DueDateSpecified = true; + //salesReceipt.SalesRepRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesReceipt.PONumber = "PONumber"; + //salesReceipt.FOB = "FOB"; + //salesReceipt.ShipMethodRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesReceipt.ShipDate = DateTime.UtcNow.Date; + //salesReceipt.ShipDateSpecified = true; + //salesReceipt.TrackingNum = "TrackingNum"; + //salesReceipt.GlobalTaxCalculation = GlobalTaxCalculationEnum.TaxExcluded; + //salesReceipt.GlobalTaxCalculationSpecified = true; + salesReceipt.TotalAmt = new Decimal(100.00); + salesReceipt.TotalAmtSpecified = true; + //salesReceipt.HomeTotalAmt = new Decimal(100.00); + //salesReceipt.HomeTotalAmtSpecified = true; + salesReceipt.ApplyTaxAfterDiscount = false; + salesReceipt.ApplyTaxAfterDiscountSpecified = true; + //salesReceipt.TemplateRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + salesReceipt.PrintStatus = PrintStatusEnum.NeedToPrint; + salesReceipt.PrintStatusSpecified = true; + salesReceipt.EmailStatus = EmailStatusEnum.NotSet; + salesReceipt.EmailStatusSpecified = true; + //EmailAddress billEmail = new EmailAddress(); + //billEmail.Address = "Address@Intuit.com"; + //billEmail.Default = true; + //billEmail.DefaultSpecified = true; + //billEmail.Tag = "Tag"; + //salesReceipt.BillEmail = billEmail; + //salesReceipt.ARAccountRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + salesReceipt.Balance = new Decimal(0.00); + salesReceipt.BalanceSpecified = true; + //salesReceipt.FinanceCharge = true; + //salesReceipt.FinanceChargeSpecified = true; + //salesReceipt.PaymentMethodRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesReceipt.PaymentRefNum = "PaymentRefNum"; + //salesReceipt.PaymentType = PaymentTypeEnum.Cash; + //salesReceipt.PaymentTypeSpecified = true; + //salesReceipt.AnyIntuitObject = + Account account = Helper.FindOrAddAccount(context, AccountTypeEnum.Bank, AccountClassificationEnum.Liability); + salesReceipt.DepositToAccountRef = new ReferenceType() + { + name = account.Name, + Value = account.Id + }; + salesReceipt.DocNumber = "1003"; + salesReceipt.TxnDate = DateTime.UtcNow.Date; + salesReceipt.TxnDateSpecified = true; + //salesReceipt.DepartmentRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesReceipt.CurrencyRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesReceipt.ExchangeRate = new Decimal(100.00); + //salesReceipt.ExchangeRateSpecified = true; + //salesReceipt.PrivateNote = "PrivateNote"; + //salesReceipt.TxnStatus = "TxnStatus"; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //salesReceipt.LinkedTxn = linkedTxnList.ToArray(); + + List lineList = new List(); + Line line = new Line(); + line.LineNum = "1"; + line.Description = "Description"; + line.Amount = new Decimal(100.00); + line.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + line.DetailType = LineDetailTypeEnum.SalesItemLineDetail; + line.DetailTypeSpecified = true; + //Item item = Helper.FindOrAdd(context, new Item()); + QueryService service1 = new QueryService(context); + var item = service1.ExecuteIdsQuery("select * from Item where Type='Service'").FirstOrDefault(); + TaxCode findOrAddResult = Helper.FindOrAdd(context, new TaxCode()); + TaxCode taxCode = Helper.FindAll(context, new TaxCode())[0]; + line.AnyIntuitObject = new SalesItemLineDetail() + { + Qty = 1, + QtySpecified = true, + + ItemRef = new ReferenceType() + { + name = item.Name, + Value = item.Id + }, + TaxCodeRef = new ReferenceType() + { + name = taxCode.Name, + Value = taxCode.Id + } + }; + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //line.LineEx = + lineList.Add(line); + salesReceipt.Line = lineList.ToArray(); + //TxnTaxDetail txnTaxDetail = new TxnTaxDetail(); + //txnTaxDetail.DefaultTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TxnTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TotalTax = new Decimal(100.00); + //txnTaxDetail.TotalTaxSpecified = true; + + //List taxLineList = new List(); + //Line taxLine = new Line(); + //taxLine.LineNum = "LineNum"; + //taxLine.Description = "Description"; + //taxLine.Amount = new Decimal(100.00); + //taxLine.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + //taxLine.DetailType = LineDetailTypeEnum.; + //taxLine.AnyIntuitObject = + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //taxLine.LineEx = + + //taxLineList.Add(taxLine); + //txnTaxDetail.TaxLine = taxLineList.ToArray(); + //salesReceipt.TxnTaxDetail = txnTaxDetail; + return salesReceipt; + } + + + + internal static SalesReceipt UpdateSalesReceipt(ServiceContext context, SalesReceipt entity) + { + //SalesReceipt e1 = new SalesReceipt(); + //e1.Id = "1476"; + //e1.PaymentRefNum = "38"; + //e1.sparse = true; + //e1.sparseSpecified = true; + //e1.EmailStatus = EmailStatusEnum.NeedToSend; + //e1.EmailStatusSpecified = true; + //e1.BillEmail = new EmailAddress() { Address = "address@email.com" }; + //e1.SyncToken = "1"; + //return e1; + entity.PaymentRefNum = "33"; + entity.PrintStatus = PrintStatusEnum.NeedToPrint; + entity.PrintStatusSpecified = true; + entity.EmailStatus = EmailStatusEnum.NeedToSend; + entity.EmailStatusSpecified = true; + entity.BillEmail = new EmailAddress() { Address = "address@email.com" }; + return entity; + } + + + internal static SalesReceipt SparseUpdateSalesReceipt(ServiceContext context, string Id, string syncToken) + { + SalesReceipt entity = new SalesReceipt(); + entity.Id = Id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.PrintStatus = PrintStatusEnum.PrintComplete; + entity.PrintStatusSpecified = true; + return entity; + } + + + + internal static Estimate CreateEstimate(ServiceContext context) + { + Estimate estimate = new Estimate(); + estimate.ExpirationDate = DateTime.UtcNow.Date.AddDays(15); + estimate.ExpirationDateSpecified = true; + estimate.TxnDate = DateTime.UtcNow.Date; + estimate.TxnDateSpecified = true; + //estimate.AcceptedBy = "AcceptedBy"; + //estimate.AcceptedDate = DateTime.UtcNow.Date; + //estimate.AcceptedDateSpecified = true; + //estimate.EstimateEx = + //estimate.AutoDocNumber = true; + //estimate.AutoDocNumberSpecified = true; + Customer customer = Helper.FindOrAdd(context, new Customer()); + estimate.CustomerRef = new ReferenceType() + { + name = customer.DisplayName, + Value = customer.Id + }; + //MemoRef customerMemo = new MemoRef(); + //customerMemo.id = "id"; + //customerMemo.Value = "Value"; + //estimate.CustomerMemo = customerMemo; + //PhysicalAddress billAddr = new PhysicalAddress(); + //billAddr.Line1 = "Line1"; + //billAddr.Line2 = "Line2"; + //billAddr.Line3 = "Line3"; + //billAddr.Line4 = "Line4"; + //billAddr.Line5 = "Line5"; + //billAddr.City = "City"; + //billAddr.Country = "Country"; + //billAddr.CountryCode = "CountryCode"; + //billAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //billAddr.PostalCode = "PostalCode"; + //billAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //billAddr.Lat = "Lat"; + //billAddr.Long = "Long"; + //billAddr.Tag = "Tag"; + //billAddr.Note = "Note"; + //estimate.BillAddr = billAddr; + //PhysicalAddress shipAddr = new PhysicalAddress(); + //shipAddr.Line1 = "Line1"; + //shipAddr.Line2 = "Line2"; + //shipAddr.Line3 = "Line3"; + //shipAddr.Line4 = "Line4"; + //shipAddr.Line5 = "Line5"; + //shipAddr.City = "City"; + //shipAddr.Country = "Country"; + //shipAddr.CountryCode = "CountryCode"; + //shipAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //shipAddr.PostalCode = "PostalCode"; + //shipAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //shipAddr.Lat = "Lat"; + //shipAddr.Long = "Long"; + //shipAddr.Tag = "Tag"; + //shipAddr.Note = "Note"; + //estimate.ShipAddr = shipAddr; + //estimate.RemitToRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //estimate.ClassRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //estimate.SalesTermRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //estimate.DueDate = DateTime.UtcNow.Date; + //estimate.DueDateSpecified = true; + //estimate.SalesRepRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //estimate.PONumber = "PONumber"; + //estimate.FOB = "FOB"; + //estimate.ShipMethodRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //estimate.ShipDate = DateTime.UtcNow.Date; + //estimate.ShipDateSpecified = true; + //estimate.TrackingNum = "TrackingNum"; + //estimate.GlobalTaxCalculation = GlobalTaxCalculationEnum.; + //estimate.GlobalTaxCalculationSpecified = true; + estimate.TotalAmt = new Decimal(100.00); + estimate.TotalAmtSpecified = true; + //estimate.HomeTotalAmt = new Decimal(100.00); + //estimate.HomeTotalAmtSpecified = true; + //estimate.ApplyTaxAfterDiscount = true; + //estimate.ApplyTaxAfterDiscountSpecified = true; + //estimate.TemplateRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //estimate.PrintStatus = PrintStatusEnum.; + //estimate.PrintStatusSpecified = true; + //estimate.EmailStatus = EmailStatusEnum.; + //estimate.EmailStatusSpecified = true; + //EmailAddress billEmail = new EmailAddress(); + //billEmail.Address = "Address"; + //billEmail.Default = true; + //billEmail.DefaultSpecified = true; + //billEmail.Tag = "Tag"; + //estimate.BillEmail = billEmail; + //estimate.ARAccountRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //estimate.Balance = new Decimal(100.00); + //estimate.BalanceSpecified = true; + //estimate.FinanceCharge = true; + //estimate.FinanceChargeSpecified = true; + //estimate.PaymentMethodRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //estimate.PaymentRefNum = "PaymentRefNum"; + //estimate.PaymentType = PaymentTypeEnum.; + //estimate.PaymentTypeSpecified = true; + //estimate.AnyIntuitObject = + Account depositAccount = Helper.FindOrAddAccount(context, AccountTypeEnum.Bank, AccountClassificationEnum.Asset); + estimate.DepositToAccountRef = new ReferenceType() + { + name = depositAccount.Name, + Value = depositAccount.Id + }; + //estimate.DocNumber = "DocNumber"; + + //estimate.TxnDateSpecified = true; + //estimate.DepartmentRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //estimate.CurrencyRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //estimate.ExchangeRate = new Decimal(100.00); + //estimate.ExchangeRateSpecified = true; + //estimate.PrivateNote = "PrivateNote"; + //estimate.TxnStatus = "TxnStatus"; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //estimate.LinkedTxn = linkedTxnList.ToArray(); + //Item item = Helper.FindOrAdd(context, new Item()); + QueryService service1 = new QueryService(context); + var item = service1.ExecuteIdsQuery("select * from Item where Type='Service'").FirstOrDefault(); + estimate.TotalAmt = new Decimal(100.00); + TaxCode findOrAddResult = Helper.FindOrAdd(context, new TaxCode()); + TaxCode taxcode = Helper.FindAll(context, new TaxCode())[0]; + if (taxcode.SalesTaxRateList != null) + { + TaxRate taxRateToFind = new TaxRate(); + taxRateToFind.Id = taxcode.SalesTaxRateList.TaxRateDetail[0].TaxRateRef.Value; + TaxRate taxRate = Helper.FindById(context, taxRateToFind); + estimate.TotalAmt += estimate.TotalAmt * (taxRate.RateValue / 100); + } + estimate.TotalAmtSpecified = true; + + List lineList = new List(); + Line line = new Line(); + line.LineNum = "1"; + line.Description = "Description"; + line.Amount = new Decimal(100.00); + line.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + line.DetailType = LineDetailTypeEnum.SalesItemLineDetail; + line.DetailTypeSpecified = true; + line.AnyIntuitObject = new SalesItemLineDetail() + { + ItemRef = new ReferenceType() { name = item.Name, Value = item.Id }, + TaxCodeRef = new ReferenceType() { name = taxcode.Name, Value = taxcode.Id } + }; + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //line.LineEx = + lineList.Add(line); + estimate.Line = lineList.ToArray(); + //TxnTaxDetail txnTaxDetail = new TxnTaxDetail(); + //txnTaxDetail.DefaultTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TxnTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TotalTax = new Decimal(100.00); + //txnTaxDetail.TotalTaxSpecified = true; + + //List taxLineList = new List(); + //Line taxLine = new Line(); + //taxLine.LineNum = "LineNum"; + //taxLine.Description = "Description"; + //taxLine.Amount = new Decimal(100.00); + //taxLine.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + //taxLine.DetailType = LineDetailTypeEnum.; + //taxLine.AnyIntuitObject = + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //taxLine.LineEx = + + //taxLineList.Add(taxLine); + //txnTaxDetail.TaxLine = taxLineList.ToArray(); + //estimate.TxnTaxDetail = txnTaxDetail; + return estimate; + } + + + + internal static Estimate UpdateEstimate(ServiceContext context, Estimate entity) + { + //update the properties of entity + entity.ExpirationDate = DateTime.UtcNow.Date.AddDays(15); + entity.ExpirationDateSpecified = true; + entity.TxnDate = DateTime.UtcNow.Date; + entity.TxnDateSpecified = true; + return entity; + } + + internal static Estimate SparseUpdateEstimate(ServiceContext context, string Id, string syncToken) + { + Estimate entity = new Estimate(); + entity.Id = Id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.ExpirationDate = DateTime.UtcNow.Date.AddDays(15); + entity.ExpirationDateSpecified = true; + entity.TxnDate = DateTime.UtcNow.Date; + entity.TxnDateSpecified = true; + return entity; + } + + + + internal static FixedAsset CreateFixedAsset(ServiceContext context) + { + FixedAsset fixedAsset = new FixedAsset(); + fixedAsset.Name = "Name" + Helper.GetGuid().Substring(0, 5); + fixedAsset.Active = true; + fixedAsset.ActiveSpecified = true; + fixedAsset.AcquiredAs = AcquiredAsEnum.New; + fixedAsset.AcquiredAsSpecified = true; + fixedAsset.PurchaseDesc = "PurchaseDesc"; + fixedAsset.PurchaseDate = DateTime.UtcNow.Date; + fixedAsset.PurchaseDateSpecified = true; + fixedAsset.PurchaseCost = new Decimal(100.00); + fixedAsset.PurchaseCostSpecified = true; + //fixedAsset.Vendor = "Vendor"; + //fixedAsset.AssetAccountRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + fixedAsset.SalesDesc = "SalesDesc"; + fixedAsset.SalesDate = DateTime.UtcNow.Date; + fixedAsset.SalesDateSpecified = true; + fixedAsset.SalesPrice = new Decimal(100.00); + fixedAsset.SalesPriceSpecified = true; + fixedAsset.SalesExpense = new Decimal(100.00); + fixedAsset.SalesExpenseSpecified = true; + fixedAsset.Location = "Loc_" + Helper.GetGuid().Substring(0, 5); + fixedAsset.PONumber = "797090"; + fixedAsset.SerialNumber = "SerialNumber"; + fixedAsset.WarrantyExpDate = DateTime.UtcNow.Date; + fixedAsset.WarrantyExpDateSpecified = true; + fixedAsset.Description = "Description"; + fixedAsset.Notes = "Notes"; + Int32 int32 = new Int32(); + fixedAsset.AssetNum = int32; + fixedAsset.AssetNumSpecified = true; + fixedAsset.CostBasis = new Decimal(100.00); + fixedAsset.CostBasisSpecified = true; + fixedAsset.Depreciation = new Decimal(100.00); + fixedAsset.DepreciationSpecified = true; + fixedAsset.BookValue = new Decimal(100.00); + fixedAsset.BookValueSpecified = true; + //fixedAsset.FixedAssetEx = + return fixedAsset; + } + + + + internal static FixedAsset UpdateFixedAsset(ServiceContext context, FixedAsset entity) + { + //update the properties of entity + entity.Name = "name_updated" + Helper.GetGuid().Substring(0, 5); + entity.SalesDesc = "sales desc updated"; + + return entity; + } + + + internal static FixedAsset UpdateFixedAssetSparse(ServiceContext context, string id, string syncToken) + { + FixedAsset entity = new FixedAsset(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.Name = "name_sparseupdated" + Helper.GetGuid().Substring(0, 5); + entity.SalesDesc = "sales desc sparse updated"; + + return entity; + } + + + internal static TaxCode CreateTaxCode(ServiceContext context) + { + TaxCode taxCode = new TaxCode(); + taxCode.Name = "VAT" + Helper.GetGuid().Substring(0, 10); + taxCode.Description = "Value Added Tax"; + taxCode.Active = true; + taxCode.ActiveSpecified = true; + taxCode.Taxable = true; + taxCode.TaxableSpecified = true; + taxCode.TaxGroup = true; + taxCode.TaxGroupSpecified = true; + //TaxRateList salesTaxRateList = new TaxRateList(); + + //List taxRateDetailList = new List(); + //TaxRateDetail taxRateDetail = new TaxRateDetail(); + //taxRateDetail.TaxRateRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //taxRateDetail.TaxTypeApplicable = TaxTypeApplicablityEnum.; + //taxRateDetail.TaxTypeApplicableSpecified = true; + //taxRateDetail.TaxOrder = int32; + //Int32 int32 = new Int32(); + + //taxRateDetail.TaxOrderSpecified = true; + //taxRateDetail.TaxOnTaxOrder = int32; + //Int32 int32 = new Int32(); + + //taxRateDetail.TaxOnTaxOrderSpecified = true; + //taxRateDetailList.Add(taxRateDetail); + //taxRateList.TaxRateDetail = taxRateDetailList.ToArray(); + //salesTaxRateList.originatingGroupId = "originatingGroupId"; + //taxCode.SalesTaxRateList = salesTaxRateList; + //TaxRateList purchaseTaxRateList = new TaxRateList(); + + //List taxRateDetailList = new List(); + //TaxRateDetail taxRateDetail = new TaxRateDetail(); + //taxRateDetail.TaxRateRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //taxRateDetail.TaxTypeApplicable = TaxTypeApplicablityEnum.; + //taxRateDetail.TaxTypeApplicableSpecified = true; + //taxRateDetail.TaxOrder = int32; + //Int32 int32 = new Int32(); + + //taxRateDetail.TaxOrderSpecified = true; + //taxRateDetail.TaxOnTaxOrder = int32; + //Int32 int32 = new Int32(); + + //taxRateDetail.TaxOnTaxOrderSpecified = true; + //taxRateDetailList.Add(taxRateDetail); + //taxRateList.TaxRateDetail = taxRateDetailList.ToArray(); + //purchaseTaxRateList.originatingGroupId = "originatingGroupId"; + //taxCode.PurchaseTaxRateList = purchaseTaxRateList; + //TaxRateList adjustmentTaxRateList = new TaxRateList(); + + //List taxRateDetailList = new List(); + //TaxRateDetail taxRateDetail = new TaxRateDetail(); + //taxRateDetail.TaxRateRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //taxRateDetail.TaxTypeApplicable = TaxTypeApplicablityEnum.; + //taxRateDetail.TaxTypeApplicableSpecified = true; + //taxRateDetail.TaxOrder = int32; + //Int32 int32 = new Int32(); + + //taxRateDetail.TaxOrderSpecified = true; + //taxRateDetail.TaxOnTaxOrder = int32; + //Int32 int32 = new Int32(); + + //taxRateDetail.TaxOnTaxOrderSpecified = true; + //taxRateDetailList.Add(taxRateDetail); + //taxRateList.TaxRateDetail = taxRateDetailList.ToArray(); + //adjustmentTaxRateList.originatingGroupId = "originatingGroupId"; + //taxCode.AdjustmentTaxRateList = adjustmentTaxRateList; + //taxCode.TaxCodeEx = + return taxCode; + } + + + + internal static TaxCode UpdateTaxCode(ServiceContext context, TaxCode entity) + { + entity.Name = "VAT" + Helper.GetGuid().Substring(0, 10); + entity.Description = "Value Added Tax"; + return entity; + } + + internal static TaxCode SparseUpdateTaxCode(ServiceContext context, string Id, string syncToken) + { + TaxCode entity = new TaxCode(); + entity.Id = Id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.Name = "VAT" + Helper.GetGuid().Substring(0, 10); + entity.Description = "Value Added Tax"; + return entity; + } + + + + internal static TaxRate CreateTaxRate(ServiceContext context) + { + TaxRate taxRate = new TaxRate(); + taxRate.Name = "Name"; + taxRate.Description = "Description"; + taxRate.Active = true; + taxRate.ActiveSpecified = true; + taxRate.RateValue = new Decimal(100.00); + taxRate.RateValueSpecified = true; + //taxRate.AgencyRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //taxRate.TaxReturnLineRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + + //List effectiveTaxRateList = new List(); + //EffectiveTaxRate effectiveTaxRate = new EffectiveTaxRate(); + //effectiveTaxRate.RateValue = new Decimal(100.00); + //effectiveTaxRate.RateValueSpecified = true; + //effectiveTaxRate.EffectiveDate = DateTime.UtcNow.Date; + //effectiveTaxRate.EffectiveDateSpecified = true; + //effectiveTaxRate.EndDate = DateTime.UtcNow.Date; + //effectiveTaxRate.EndDateSpecified = true; + //effectiveTaxRate.EffectiveTaxRateEx = + //effectiveTaxRateList.Add(effectiveTaxRate); + //taxRate.EffectiveTaxRate = effectiveTaxRateList.ToArray(); + taxRate.SpecialTaxType = SpecialTaxTypeEnum.ADJUSTMENT_RATE; + taxRate.SpecialTaxTypeSpecified = true; + taxRate.DisplayType = TaxRateDisplayTypeEnum.ReadOnly; + taxRate.DisplayTypeSpecified = true; + //taxRate.TaxRateEx = + return taxRate; + } + + + + internal static TaxRate UpdateTaxRate(ServiceContext context, TaxRate entity) + { + entity.Name = "UpdatedName"; + entity.Description = "UpdatedDescription"; + return entity; + } + + + internal static TaxRate SparseUpdateTaxRate(ServiceContext context, string Id, string syncToken) + { + TaxRate entity = new TaxRate(); + entity.Id = Id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.Name = "SparseUpdatedName"; + entity.Description = "SparseUpdatedDescription"; + return entity; + } + + + + internal static Account CreateAccount(ServiceContext context, AccountTypeEnum accountType, AccountClassificationEnum classification) + { + Account account = new Account(); + + String guid = Helper.GetGuid(); + account.Name = "Name_" + guid; + //account.SubAccount = true; + //account.SubAccountSpecified = true; + //account.ParentRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //account.Description = "Description"; + account.FullyQualifiedName = account.Name; + //account.Active = true; + //account.ActiveSpecified = true; + account.Classification = classification; + account.ClassificationSpecified = true; + account.AccountType = accountType; + account.AccountTypeSpecified = true; + //account.AccountSubType = "AccountSubType"; + //account.AcctNum = "AcctNum"; + //account.BankNum = "BankNum"; + if (accountType != AccountTypeEnum.Expense && accountType != AccountTypeEnum.AccountsPayable && accountType != AccountTypeEnum.AccountsReceivable) + { + //TestComment: Opening Balances not working for QBO Item tests + //account.OpeningBalance = new Decimal(100.00); + //account.OpeningBalanceSpecified = true; + //account.OpeningBalanceDate = DateTime.UtcNow.Date; + //account.OpeningBalanceDateSpecified = true; + } + //account.CurrentBalance = new Decimal(100.00); + //account.CurrentBalanceSpecified = true; + //account.CurrentBalanceWithSubAccounts = new Decimal(100.00); + //account.CurrentBalanceWithSubAccountsSpecified = true; + account.CurrencyRef = new ReferenceType() + { + name = "United States Dollar", + Value = "USD" + }; + //account.TaxAccount = true; + //account.TaxAccountSpecified = true; + //account.TaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //account.AccountEx = + return account; + } + + //France + internal static Account CreateAccountFrance(ServiceContext context, AccountTypeEnum accountType, AccountClassificationEnum classification) + { + Account account = new Account(); + + String guid = Helper.GetGuid(); + account.Name = "Nam_" + Helper.GetGuid().Substring(0, 3); + + //newly added field + account.AccountAlias = "al_" + Helper.GetGuid().Substring(0, 3); + account.TxnLocationType = "WithinFrance"; + //WithinFrance + //FranceOverseas + //OutsideFranceWithEU + //OutsideEU + account.AcctNum = "6" + "01212"; + // 6 for expense account + + account.FullyQualifiedName = account.Name; + account.Classification = classification; + account.ClassificationSpecified = true; + account.AccountType = accountType; + account.AccountTypeSpecified = true; + + return account; + } + + + + internal static Account UpdateAccount(ServiceContext context, Account entity) + { + //update the properties of entity + entity.Name = "Name_" + Helper.GetGuid().Substring(0, 5); + entity.FullyQualifiedName = entity.Name; + return entity; + } + + + internal static Account SparseUpdateAccount(ServiceContext context, string Id, string syncToken) + { + Account entity = new Account(); + entity.Id = Id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.Name = "Update Name_" + Helper.GetGuid().Substring(0, 5); + entity.FullyQualifiedName = entity.Name; + return entity; + } + + + + internal static Purchase CreatePurchase(ServiceContext context, PaymentTypeEnum paymentType) + { + Purchase purchase = new Purchase(); + + Account account = null; + + switch (paymentType) + { + case PaymentTypeEnum.Cash: + account = Helper.FindOrAddAccount(context, AccountTypeEnum.Bank, AccountClassificationEnum.Expense); + break; + case PaymentTypeEnum.Check: + account = Helper.FindOrAddAccount(context, AccountTypeEnum.Bank, AccountClassificationEnum.Expense); + break; + case PaymentTypeEnum.CreditCard: + account = Helper.FindOrAddAccount(context, AccountTypeEnum.CreditCard, AccountClassificationEnum.Expense); + break; + case PaymentTypeEnum.Other: + break; + default: + break; + } + + Customer customer = Helper.FindOrAdd(context, new Customer()); + + purchase.AccountRef = new ReferenceType() + { + //type = Enum.GetName(typeof(objectNameEnumType), objectNameEnumType.Account), + name = account.Name, + Value = account.Id + }; + //purchase.PaymentMethodRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //purchase.PaymentRefNum = "PaymentRefNum"; + purchase.PaymentType = paymentType; + purchase.PaymentTypeSpecified = true; + //purchase.AnyIntuitObject = ; + purchase.EntityRef = new ReferenceType() + { + name = customer.DisplayName, + type = Enum.GetName(typeof(objectNameEnumType), objectNameEnumType.Customer), + Value = customer.Id + }; + if (paymentType == PaymentTypeEnum.CreditCard || paymentType == PaymentTypeEnum.Cash) + { + purchase.Credit = false; + purchase.CreditSpecified = true; + } + //PhysicalAddress remitToAddr = new PhysicalAddress(); + //remitToAddr.Line1 = "Line1"; + //remitToAddr.Line2 = "Line2"; + //remitToAddr.Line3 = "Line3"; + //remitToAddr.Line4 = "Line4"; + //remitToAddr.Line5 = "Line5"; + //remitToAddr.City = "City"; + //remitToAddr.Country = "Country"; + //remitToAddr.CountryCode = "CountryCode"; + //remitToAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //remitToAddr.PostalCode = "PostalCode"; + //remitToAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //remitToAddr.Lat = "Lat"; + //remitToAddr.Long = "Long"; + //remitToAddr.Tag = "Tag"; + //remitToAddr.Note = "Note"; + //purchase.RemitToAddr = remitToAddr; + purchase.TotalAmt = new Decimal(1000.00); + purchase.TotalAmtSpecified = true; + //purchase.TxnId = "TxnId"; + //purchase.TxnNum = "TxnNum"; + //purchase.Memo = "Memo"; + if (paymentType != PaymentTypeEnum.CreditCard) + { + purchase.PrintStatus = PrintStatusEnum.NotSet; + purchase.PrintStatusSpecified = true; + } + //purchase.GlobalTaxCalculation = GlobalTaxCalculationEnum.; + //purchase.GlobalTaxCalculationSpecified = true; + //purchase.PurchaseEx = + + //purchase.DocNumber = "DocNumber"; + purchase.TxnDate = DateTime.UtcNow.Date; + purchase.TxnDateSpecified = true; + //purchase.DepartmentRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //purchase.CurrencyRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //purchase.ExchangeRate = new Decimal(100.00); + //purchase.ExchangeRateSpecified = true; + //purchase.PrivateNote = "PrivateNote"; + //purchase.TxnStatus = "TxnStatus"; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //purchase.LinkedTxn = linkedTxnList.ToArray(); + + List lineList = new List(); + Line line = new Line(); + //line.LineNum = "LineNum"; + line.Description = "Description for Line"; + line.Amount = new Decimal(1000.00); + line.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + line.DetailType = LineDetailTypeEnum.AccountBasedExpenseLineDetail; + line.DetailTypeSpecified = true; + AccountBasedExpenseLineDetail lineDetail = new AccountBasedExpenseLineDetail(); + Account lineAccount = Helper.FindOrAddAccount(context, AccountTypeEnum.Expense, AccountClassificationEnum.Expense); + lineDetail.AccountRef = new ReferenceType { type = Enum.GetName(typeof(objectNameEnumType), objectNameEnumType.Account), name = lineAccount.Name, Value = lineAccount.Id }; + lineDetail.BillableStatus = BillableStatusEnum.NotBillable; + lineDetail.TaxAmount = new Decimal(10.00); + lineDetail.TaxAmountSpecified = true; + line.AnyIntuitObject = lineDetail; + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //line.LineEx = + + lineList.Add(line); + purchase.Line = lineList.ToArray(); + //TxnTaxDetail txnTaxDetail = new TxnTaxDetail(); + //txnTaxDetail.DefaultTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TxnTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TotalTax = new Decimal(100.00); + //txnTaxDetail.TotalTaxSpecified = true; + + //List taxLineList = new List(); + //Line taxLine = new Line(); + //taxLine.LineNum = "LineNum"; + //taxLine.Description = "Description"; + //taxLine.Amount = new Decimal(100.00); + //taxLine.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + //taxLine.DetailType = LineDetailTypeEnum.; + //taxLine.AnyIntuitObject = + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //taxLine.LineEx = + + //taxLineList.Add(taxLine); + //txnTaxDetail.TaxLine = taxLineList.ToArray(); + //purchase.TxnTaxDetail = txnTaxDetail; + return purchase; + } + + + + internal static Purchase UpdatePurchase(ServiceContext context, Purchase entity) + { + //update the properties of entity + Line[] line = entity.Line; + line[0].Amount = new Decimal(1001.00); + + entity.TotalAmt = new Decimal(1001.00); + return entity; + } + + + internal static Purchase SparseUpdatePurchase(ServiceContext context, string Id, PaymentTypeEnum paymentType, string syncToken) + { + Purchase entity = new Purchase(); + entity.Id = Id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.PaymentType = paymentType; + entity.PaymentTypeSpecified = true; + + List lineList = new List(); + Line line = new Line(); + line.Description = "Sparse Update Desc"; + line.Amount = new Decimal(1002.00); + line.AmountSpecified = true; + + line.DetailType = LineDetailTypeEnum.AccountBasedExpenseLineDetail; + line.DetailTypeSpecified = true; + + AccountBasedExpenseLineDetail lineDetail = new AccountBasedExpenseLineDetail(); + Account lineAccount = Helper.FindOrAddAccount(context, AccountTypeEnum.Expense, AccountClassificationEnum.Expense); + lineDetail.AccountRef = new ReferenceType { type = Enum.GetName(typeof(objectNameEnumType), objectNameEnumType.Account), name = lineAccount.Name, Value = lineAccount.Id }; + lineDetail.BillableStatus = BillableStatusEnum.NotBillable; + lineDetail.TaxAmount = new Decimal(10.00); + lineDetail.TaxAmountSpecified = true; + line.AnyIntuitObject = lineDetail; + + lineList.Add(line); + entity.Line = lineList.ToArray(); + + entity.TotalAmt = new Decimal(1002.00); + entity.TotalAmtSpecified = true; + return entity; + } + + + + internal static PurchaseByVendor CreatePurchaseByVendor(ServiceContext context) + { + PurchaseByVendor purchaseByVendor = new PurchaseByVendor(); + //purchaseByVendor.VendorRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //purchaseByVendor.APAccountRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //purchaseByVendor.TotalAmt = new Decimal(100.00); + //purchaseByVendor.TotalAmtSpecified = true; + //EmailAddress billEmail = new EmailAddress(); + //billEmail.Address = "Address"; + //billEmail.Default = true; + //billEmail.DefaultSpecified = true; + //billEmail.Tag = "Tag"; + //purchaseByVendor.BillEmail = billEmail; + //EmailAddress replyEmail = new EmailAddress(); + //replyEmail.Address = "Address"; + //replyEmail.Default = true; + //replyEmail.DefaultSpecified = true; + //replyEmail.Tag = "Tag"; + //purchaseByVendor.ReplyEmail = replyEmail; + //purchaseByVendor.Memo = "Memo"; + //purchaseByVendor.GlobalTaxCalculation = GlobalTaxCalculationEnum.; + //purchaseByVendor.GlobalTaxCalculationSpecified = true; + //purchaseByVendor.DocNumber = "DocNumber"; + //purchaseByVendor.TxnDate = DateTime.UtcNow.Date; + //purchaseByVendor.TxnDateSpecified = true; + //purchaseByVendor.DepartmentRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //purchaseByVendor.CurrencyRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //purchaseByVendor.ExchangeRate = new Decimal(100.00); + //purchaseByVendor.ExchangeRateSpecified = true; + //purchaseByVendor.PrivateNote = "PrivateNote"; + //purchaseByVendor.TxnStatus = "TxnStatus"; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //purchaseByVendor.LinkedTxn = linkedTxnList.ToArray(); + + //List lineList = new List(); + //Line line = new Line(); + //line.LineNum = "LineNum"; + //line.Description = "Description"; + //line.Amount = new Decimal(100.00); + //line.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + //line.DetailType = LineDetailTypeEnum.; + //line.AnyIntuitObject = + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //line.LineEx = + //lineList.Add(line); + //purchaseByVendor.Line = lineList.ToArray(); + //TxnTaxDetail txnTaxDetail = new TxnTaxDetail(); + //txnTaxDetail.DefaultTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TxnTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TotalTax = new Decimal(100.00); + //txnTaxDetail.TotalTaxSpecified = true; + + //List taxLineList = new List(); + //Line taxLine = new Line(); + //taxLine.LineNum = "LineNum"; + //taxLine.Description = "Description"; + //taxLine.Amount = new Decimal(100.00); + //taxLine.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + //taxLine.DetailType = LineDetailTypeEnum.; + //taxLine.AnyIntuitObject = + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //taxLine.LineEx = + + //taxLineList.Add(taxLine); + //txnTaxDetail.TaxLine = taxLineList.ToArray(); + //purchaseByVendor.TxnTaxDetail = txnTaxDetail; + return purchaseByVendor; + } + + + + internal static PurchaseByVendor UpdatePurchaseByVendor(ServiceContext context, PurchaseByVendor entity) + { + entity.Memo = "Memo_Update"; + return entity; + } + + + internal static PurchaseByVendor UpdatePurchaseByVendorSparse(ServiceContext context, string id, string syncToken) + { + PurchaseByVendor entity = new PurchaseByVendor(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.Memo = "Memo_SparseUpdate"; + return entity; + } + + + internal static Budget CreateBudget(ServiceContext context) + { + Budget budget = new Budget(); + return budget; + } + + internal static Budget UpdateBudget(ServiceContext context, Budget entity) + { + Budget budget = new Budget(); + return budget; + } + + internal static Budget UpdateBudgetSparse(ServiceContext context, string Id, string SyncToken) + { + Budget budget = new Budget(); + return budget; + } + + + internal static void VerifyBudget(Budget expected, Budget actual) + { + //Assert.AreEqual(expected.PayerRef.name, actual.PayerRef.name); + //Assert.AreEqual(expected.PayerRef.type, actual.PayerRef.type); + + } + + internal static void VerifyBudgetSparse(Budget expected, Budget actual) + { + //Assert.AreEqual(expected.PayerRef.name, actual.PayerRef.name); + //Assert.AreEqual(expected.PayerRef.type, actual.PayerRef.type); + + } + + + internal static Bill CreateBill(ServiceContext context) + { + + Vendor vendors = Helper.FindOrAdd(context, new Vendor()); + Account account = Helper.FindOrAddAccount(context, AccountTypeEnum.AccountsPayable, AccountClassificationEnum.Liability); + Account accountExpense = Helper.FindOrAddAccount(context, AccountTypeEnum.Expense, AccountClassificationEnum.Expense); + Customer customer = Helper.FindOrAdd(context, new Customer()); + + Bill bill = new Bill(); + //bill.PayerRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //bill.SalesTermRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + bill.DueDate = DateTime.UtcNow.Date; + bill.DueDateSpecified = true; + //PhysicalAddress remitToAddr = new PhysicalAddress(); + //remitToAddr.Line1 = "Line1"; + //remitToAddr.Line2 = "Line2"; + //remitToAddr.Line3 = "Line3"; + //remitToAddr.Line4 = "Line4"; + //remitToAddr.Line5 = "Line5"; + //remitToAddr.City = "City"; + //remitToAddr.Country = "Country"; + //remitToAddr.CountryCode = "CountryCode"; + //remitToAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //remitToAddr.PostalCode = "PostalCode"; + //remitToAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //remitToAddr.Lat = "Lat"; + //remitToAddr.Long = "Long"; + //remitToAddr.Tag = "Tag"; + //remitToAddr.Note = "Note"; + //bill.RemitToAddr = remitToAddr; + //PhysicalAddress shipAddr = new PhysicalAddress(); + //shipAddr.Line1 = "Line1"; + //shipAddr.Line2 = "Line2"; + //shipAddr.Line3 = "Line3"; + //shipAddr.Line4 = "Line4"; + //shipAddr.Line5 = "Line5"; + //shipAddr.City = "City"; + //shipAddr.Country = "Country"; + //shipAddr.CountryCode = "CountryCode"; + //shipAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //shipAddr.PostalCode = "PostalCode"; + //shipAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //shipAddr.Lat = "Lat"; + //shipAddr.Long = "Long"; + //shipAddr.Tag = "Tag"; + //shipAddr.Note = "Note"; + //bill.ShipAddr = shipAddr; + //bill.Balance = new Decimal(100.00); + //bill.BalanceSpecified = true; + //bill.BillEx = + + bill.VendorRef = new ReferenceType() + { + //type = Enum.GetName(typeof(objectNameEnumType), objectNameEnumType.Vendor), + name = vendors.DisplayName, + Value = vendors.Id + }; + bill.APAccountRef = new ReferenceType() + { + //type = Enum.GetName(typeof(objectNameEnumType), objectNameEnumType.Account), + name = account.Name, + Value = account.Id + }; + bill.TotalAmt = new Decimal(100.00); + bill.TotalAmtSpecified = true; + bill.Balance = new Decimal(100.00); + bill.BalanceSpecified = true; + //EmailAddress billEmail = new EmailAddress(); + //billEmail.Address = "test@testing.com"; + //billEmail.Default = true; + //billEmail.DefaultSpecified = true; + //billEmail.Tag = "Tag"; + //bill.BillEmail = billEmail; + //EmailAddress replyEmail = new EmailAddress(); + //replyEmail.Address = "Address"; + //replyEmail.Default = true; + //replyEmail.DefaultSpecified = true; + //replyEmail.Tag = "Tag"; + //bill.ReplyEmail = replyEmail; + //bill.Memo = "Memo"; + //bill.GlobalTaxCalculation = GlobalTaxCalculationEnum.; + //bill.GlobalTaxCalculationSpecified = true; + //bill.DocNumber = "DocNumber"; + bill.TxnDate = DateTime.UtcNow.Date; + bill.TxnDateSpecified = true; + //bill.DepartmentRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //bill.CurrencyRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //bill.ExchangeRate = new Decimal(100.00); + //bill.ExchangeRateSpecified = true; + //bill.PrivateNote = "PrivateNote"; + //bill.TxnStatus = "TxnStatus"; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //bill.LinkedTxn = linkedTxnList.ToArray(); + + List lineList = new List(); + Line line = new Line(); + //line.LineNum = "LineNum"; + line.Description = "Description"; + line.Amount = new Decimal(100.00); + line.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + // linkedTxn.TxnId = "TxnId"; + // linkedTxn.TxnType = "TxnType"; + // linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + line.DetailType = LineDetailTypeEnum.AccountBasedExpenseLineDetail; + line.DetailTypeSpecified = true; + + AccountBasedExpenseLineDetail detail = new AccountBasedExpenseLineDetail(); + detail.CustomerRef = new ReferenceType { type = Enum.GetName(typeof(objectNameEnumType), objectNameEnumType.Customer), name = customer.DisplayName, Value = customer.Id }; + detail.AccountRef = new ReferenceType { type = Enum.GetName(typeof(objectNameEnumType), objectNameEnumType.Account), name = accountExpense.Name, Value = accountExpense.Id }; + detail.BillableStatus = BillableStatusEnum.NotBillable; + + line.AnyIntuitObject = detail; + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + // customField.DefinitionId = "DefinitionId"; + // customField.Name = "Name"; + // customField.Type = CustomFieldTypeEnum.; + // customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //line.LineEx = + + lineList.Add(line); + bill.Line = lineList.ToArray(); + //TxnTaxDetail txnTaxDetail = new TxnTaxDetail(); + //txnTaxDetail.DefaultTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TxnTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TotalTax = new Decimal(100.00); + //txnTaxDetail.TotalTaxSpecified = true; + + //List taxLineList = new List(); + //Line taxLine = new Line(); + //taxLine.LineNum = "LineNum"; + //taxLine.Description = "Description"; + //taxLine.Amount = new Decimal(100.00); + //taxLine.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + //taxLine.DetailType = LineDetailTypeEnum.; + //taxLine.AnyIntuitObject = + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //taxLine.LineEx = + + //taxLineList.Add(taxLine); + //txnTaxDetail.TaxLine = taxLineList.ToArray(); + //bill.TxnTaxDetail = txnTaxDetail; + return bill; + } + + + + internal static Bill UpdateBill(ServiceContext context, Bill entity) + { + //update the properties of entity + entity.DocNumber = "docNo" + Helper.GetGuid().Substring(0, 5); + return entity; + } + + internal static Bill UpdateBillSparse(ServiceContext context, string Id, string SyncToken) + { + //update the properties of entity + Bill entity = new Bill(); + entity.Id = Id; + entity.SyncToken = SyncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.DocNumber = "docNo" + Helper.GetGuid().Substring(0, 5); + + Vendor vendors = Helper.FindOrAdd(context, new Vendor()); + entity.VendorRef = new ReferenceType() + { + name = vendors.DisplayName, + Value = vendors.Id + }; + return entity; + } + + + + internal static VendorCredit CreateVendorCredit(ServiceContext context) + { + VendorCredit vendorCredit = new VendorCredit(); + //vendorCredit.VendorCreditEx = + Vendor vendor = Helper.FindOrAdd(context, new Vendor()); + vendorCredit.VendorRef = new ReferenceType() + { + name = vendor.DisplayName, + Value = vendor.Id + }; + Account liabilityAccount = Helper.FindOrAddAccount(context, AccountTypeEnum.AccountsPayable, AccountClassificationEnum.Asset); + vendorCredit.APAccountRef = new ReferenceType() + { + name = liabilityAccount.Name, + Value = liabilityAccount.Id + }; + + vendorCredit.TotalAmt = new Decimal(50.00); + vendorCredit.TotalAmtSpecified = true; + //EmailAddress billEmail = new EmailAddress(); + //billEmail.Address = "Address"; + //billEmail.Default = true; + //billEmail.DefaultSpecified = true; + //billEmail.Tag = "Tag"; + //vendorCredit.BillEmail = billEmail; + //EmailAddress replyEmail = new EmailAddress(); + //replyEmail.Address = "Address"; + //replyEmail.Default = true; + //replyEmail.DefaultSpecified = true; + //replyEmail.Tag = "Tag"; + //vendorCredit.ReplyEmail = replyEmail; + //vendorCredit.Memo = "Memo"; + //vendorCredit.GlobalTaxCalculation = GlobalTaxCalculationEnum.; + //vendorCredit.GlobalTaxCalculationSpecified = true; + //vendorCredit.DocNumber = "DocNumber"; + vendorCredit.TxnDate = DateTime.UtcNow.Date; + vendorCredit.TxnDateSpecified = true; + //vendorCredit.DepartmentRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //vendorCredit.CurrencyRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //vendorCredit.ExchangeRate = new Decimal(100.00); + //vendorCredit.ExchangeRateSpecified = true; + vendorCredit.PrivateNote = "PrivateNote"; + //vendorCredit.TxnStatus = "TxnStatus"; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //vendorCredit.LinkedTxn = linkedTxnList.ToArray(); + + List lineList = new List(); + Line line = new Line(); + //line.LineNum = "LineNum"; + line.Description = "Description"; + line.Amount = new Decimal(50.00); + line.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + line.DetailType = LineDetailTypeEnum.AccountBasedExpenseLineDetail; + line.DetailTypeSpecified = true; + + + //Account expenseAccount = QBOHelper.CreateAccount(context, AccountTypeEnum.Expense, AccountClassificationEnum.Expense); + Account expenseAccount = Helper.FindOrAddAccount(context, AccountTypeEnum.Expense, AccountClassificationEnum.Expense); + line.AnyIntuitObject = new AccountBasedExpenseLineDetail() + { + AccountRef = new ReferenceType() { name = expenseAccount.Name, Value = expenseAccount.Id } + }; + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //line.LineEx = + lineList.Add(line); + vendorCredit.Line = lineList.ToArray(); + //TxnTaxDetail txnTaxDetail = new TxnTaxDetail(); + //txnTaxDetail.DefaultTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TxnTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TotalTax = new Decimal(100.00); + //txnTaxDetail.TotalTaxSpecified = true; + + //List taxLineList = new List(); + //Line taxLine = new Line(); + //taxLine.LineNum = "LineNum"; + //taxLine.Description = "Description"; + //taxLine.Amount = new Decimal(100.00); + //taxLine.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + //taxLine.DetailType = LineDetailTypeEnum.; + //taxLine.AnyIntuitObject = + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //taxLine.LineEx = + + //taxLineList.Add(taxLine); + //txnTaxDetail.TaxLine = taxLineList.ToArray(); + //vendorCredit.TxnTaxDetail = txnTaxDetail; + return vendorCredit; + } + + + + internal static VendorCredit UpdateVendorCredit(ServiceContext context, VendorCredit entity) + { + //update the properties of entity + entity.TxnDate = DateTime.UtcNow.Date.AddDays(2); + entity.TxnDateSpecified = true; + entity.PrivateNote = "UpdatedPrivateNote"; + return entity; + } + + internal static VendorCredit UpdateVendorCreditSparse(ServiceContext context, string id, string syncToken, ReferenceType vendorRef) + { + VendorCredit entity = new VendorCredit(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.TxnDate = DateTime.UtcNow.Date.AddDays(2); + entity.TxnDateSpecified = true; + entity.PrivateNote = "UpdatedPrivateNote"; + entity.VendorRef = vendorRef; //Required for sparse update + return entity; + } + + internal static StatementCharge CreateStatementCharge(ServiceContext context) + { + StatementCharge statementCharge = new StatementCharge(); + //statementCharge.Credit = true; + //statementCharge.CreditSpecified = true; + Customer customer = Helper.FindOrAdd(context, new Customer()); + statementCharge.CustomerRef = new ReferenceType() + { + name = customer.DisplayName, + Value = customer.Id + }; + //statementCharge.RemitToRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + Account arBankAccount = Helper.FindOrAdd(context, new Account()); + statementCharge.ARAccountRef = new ReferenceType() + { + name = arBankAccount.Name, + Value = arBankAccount.Id + }; + Class class1 = Helper.FindOrAdd(context, new Class()); + statementCharge.ClassRef = new ReferenceType() + { + name = class1.Name, + Value = class1.Id + }; + statementCharge.DueDate = DateTime.UtcNow.Date.AddDays(45); + statementCharge.DueDateSpecified = true; + statementCharge.BilledDate = DateTime.UtcNow.Date; + statementCharge.BilledDateSpecified = true; + statementCharge.TotalAmt = new Decimal(100.00); + statementCharge.TotalAmtSpecified = true; + //statementCharge.StatementChargeEx = + //statementCharge.DocNumber = "DocNumber"; + statementCharge.TxnDate = DateTime.UtcNow.Date; + statementCharge.TxnDateSpecified = true; + //statementCharge.DepartmentRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //statementCharge.CurrencyRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //statementCharge.ExchangeRate = new Decimal(100.00); + //statementCharge.ExchangeRateSpecified = true; + //statementCharge.PrivateNote = "PrivateNote"; + //statementCharge.TxnStatus = "TxnStatus"; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //statementCharge.LinkedTxn = linkedTxnList.ToArray(); + + //List lineList = new List(); + //Line line = new Line(); + //line.LineNum = "LineNum"; + //line.Description = "Description"; + //line.Amount = new Decimal(100.00); + //line.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + //line.DetailType = LineDetailTypeEnum.; + //line.AnyIntuitObject = + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //line.LineEx = + //lineList.Add(line); + //statementCharge.Line = lineList.ToArray(); + //TxnTaxDetail txnTaxDetail = new TxnTaxDetail(); + //txnTaxDetail.DefaultTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TxnTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TotalTax = new Decimal(100.00); + //txnTaxDetail.TotalTaxSpecified = true; + + //List taxLineList = new List(); + //Line taxLine = new Line(); + //taxLine.LineNum = "LineNum"; + //taxLine.Description = "Description"; + //taxLine.Amount = new Decimal(100.00); + //taxLine.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + //taxLine.DetailType = LineDetailTypeEnum.; + //taxLine.AnyIntuitObject = + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //taxLine.LineEx = + + //taxLineList.Add(taxLine); + //txnTaxDetail.TaxLine = taxLineList.ToArray(); + //statementCharge.TxnTaxDetail = txnTaxDetail; + return statementCharge; + } + + + + internal static StatementCharge UpdateStatementCharge(ServiceContext context, StatementCharge entity) + { + //update the properties of entity + + entity.DueDate = DateTime.UtcNow.Date.AddDays(30); + entity.DueDateSpecified = true; + entity.BilledDate = DateTime.UtcNow.Date.AddDays(1); + entity.BilledDateSpecified = true; + entity.TotalAmt = new Decimal(100.00); + entity.TotalAmtSpecified = true; + return entity; + } + + + internal static StatementCharge UpdateStatementChargeSparse(ServiceContext context, string id, string syncToken) + { + StatementCharge entity = new StatementCharge(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.DueDate = DateTime.UtcNow.Date.AddDays(30); + entity.DueDateSpecified = true; + entity.BilledDate = DateTime.UtcNow.Date.AddDays(1); + entity.BilledDateSpecified = true; + entity.TotalAmt = new Decimal(100.00); + entity.TotalAmtSpecified = true; + return entity; + } + + + internal static Class CreateClass(ServiceContext context) + { + Class class1 = new Class(); + class1.Name = "ClassName" + Helper.GetGuid().Substring(0, 20); + class1.SubClass = true; + class1.SubClassSpecified = true; + //class.ParentRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + class1.FullyQualifiedName = class1.Name; + class1.Active = true; + class1.ActiveSpecified = true; + //class.ClassEx = + return class1; + } + + + + internal static Class UpdateClass(ServiceContext context, Class entity) + { + entity.Name = "UpdatedName" + Helper.GetGuid().Substring(0, 16); + entity.FullyQualifiedName = entity.Name; + return entity; + } + + + internal static Class SparseUpdateClass(ServiceContext context, string Id, string syncToken) + { + Class entity = new Class(); + entity.Id = Id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.Name = "UpdatedName" + Helper.GetGuid().Substring(0, 16); + entity.FullyQualifiedName = entity.Name; + return entity; + } + + internal static Payment CreatePaymentCheck(ServiceContext context) + { + Payment payment = new Payment(); + payment.TxnDate = DateTime.UtcNow.Date; + payment.TxnDateSpecified = true; + Account depositAccount = Helper.FindOrAddAccount(context, AccountTypeEnum.Bank, AccountClassificationEnum.Asset); + payment.DepositToAccountRef = new ReferenceType() + { + name = depositAccount.Name, + Value = depositAccount.Id + }; + PaymentMethod paymentMethod = Helper.FindOrAdd(context, new PaymentMethod()); + payment.PaymentMethodRef = new ReferenceType() + { + name = paymentMethod.Name, + Value = paymentMethod.Id + }; + Customer customer = Helper.FindOrAdd(context, new Customer()); + payment.CustomerRef = new ReferenceType() + { + name = customer.DisplayName, + Value = customer.Id + }; + + payment.PaymentType = PaymentTypeEnum.Check; + CheckPayment checkPayment = new CheckPayment(); + checkPayment.AcctNum = "Acctnum" + Helper.GetGuid().Substring(0, 5); + checkPayment.BankName = "BankName" + Helper.GetGuid().Substring(0, 5); + checkPayment.CheckNum = "CheckNum" + Helper.GetGuid().Substring(0, 5); + checkPayment.NameOnAcct = "Name" + Helper.GetGuid().Substring(0, 5); + checkPayment.Status = "Status" + Helper.GetGuid().Substring(0, 5); + payment.AnyIntuitObject = checkPayment; + + payment.TotalAmt = new Decimal(100.00); + payment.TotalAmtSpecified = true; + payment.UnappliedAmt = new Decimal(100.00); + payment.UnappliedAmtSpecified = true; + return payment; + } + + internal static Payment CreatePaymentCreditCard(ServiceContext context) + { + Payment payment = new Payment(); + payment.TxnDate = DateTime.UtcNow.Date; + payment.TxnDateSpecified = true; + Account depositAccount = Helper.FindOrAddAccount(context, AccountTypeEnum.Bank, AccountClassificationEnum.Asset); + payment.DepositToAccountRef = new ReferenceType() + { + name = depositAccount.Name, + Value = depositAccount.Id + }; + PaymentMethod paymentMethod = Helper.FindOrAdd(context, new PaymentMethod()); + payment.PaymentMethodRef = new ReferenceType() + { + name = paymentMethod.Name, + Value = paymentMethod.Id + }; + Customer customer = Helper.FindOrAdd(context, new Customer()); + payment.CustomerRef = new ReferenceType() + { + name = customer.DisplayName, + Value = customer.Id + }; + + payment.PaymentType = PaymentTypeEnum.CreditCard; + + CreditCardPayment creditCardPayment = new CreditCardPayment(); + CreditChargeInfo creditChargeInfo = new CreditChargeInfo(); + creditChargeInfo.BillAddrStreet = "BillAddrStreet" + Helper.GetGuid().Substring(0, 5); + creditChargeInfo.CcExpiryMonth = 10; + creditChargeInfo.CcExpiryMonthSpecified = true; + creditChargeInfo.CcExpiryYear = DateTime.Today.Year; + creditChargeInfo.CcExpiryYearSpecified = true; + creditChargeInfo.CCTxnMode = CCTxnModeEnum.CardNotPresent; + creditChargeInfo.CCTxnModeSpecified = true; + creditChargeInfo.CCTxnType = CCTxnTypeEnum.Charge; + creditChargeInfo.CCTxnTypeSpecified = true; + creditChargeInfo.CommercialCardCode = "Cardcode" + Helper.GetGuid().Substring(0, 5); + creditChargeInfo.NameOnAcct = "Name" + Helper.GetGuid().Substring(0, 5); + creditChargeInfo.Number = Helper.GetGuid().Substring(0, 5); + creditChargeInfo.PostalCode = Helper.GetGuid().Substring(0, 5); + creditCardPayment.CreditChargeInfo = creditChargeInfo; + + payment.AnyIntuitObject = creditCardPayment; + payment.TotalAmt = new Decimal(100.00); + payment.TotalAmtSpecified = true; + payment.UnappliedAmt = new Decimal(100.00); + payment.UnappliedAmtSpecified = true; + return payment; + } + + internal static Payment CreatePayment(ServiceContext context) + { + Payment payment = new Payment(); + payment.TxnDate = DateTime.UtcNow.Date; + payment.TxnDateSpecified = true; + + Account ARAccount = Helper.FindOrAddAccount(context, AccountTypeEnum.AccountsReceivable, AccountClassificationEnum.Asset); + payment.ARAccountRef = new ReferenceType() + { + name = ARAccount.Name, + Value = ARAccount.Id + }; + + Account depositAccount = Helper.FindOrAddAccount(context, AccountTypeEnum.Bank, AccountClassificationEnum.Asset); + payment.DepositToAccountRef = new ReferenceType() + { + name = depositAccount.Name, + Value = depositAccount.Id + }; + PaymentMethod paymentMethod = Helper.FindOrAdd(context, new PaymentMethod()); + payment.PaymentMethodRef = new ReferenceType() + { + name = paymentMethod.Name, + Value = paymentMethod.Id + }; + Customer customer = Helper.FindOrAdd(context, new Customer()); + payment.CustomerRef = new ReferenceType() + { + name = customer.DisplayName, + Value = customer.Id + }; + + payment.PaymentType = PaymentTypeEnum.Check; + CheckPayment checkPayment = new CheckPayment(); + checkPayment.AcctNum = "Acctnum" + Helper.GetGuid().Substring(0, 5); + checkPayment.BankName = "BankName" + Helper.GetGuid().Substring(0, 5); + checkPayment.CheckNum = "CheckNum" + Helper.GetGuid().Substring(0, 5); + checkPayment.NameOnAcct = "Name" + Helper.GetGuid().Substring(0, 5); + checkPayment.Status = "Status" + Helper.GetGuid().Substring(0, 5); + checkPayment.CheckPaymentEx = new IntuitAnyType(); + payment.AnyIntuitObject = checkPayment; + + payment.TotalAmt = new Decimal(100.00); + payment.TotalAmtSpecified = true; + payment.UnappliedAmt = new Decimal(100.00); + payment.UnappliedAmtSpecified = true; + return payment; + } + + + + internal static Payment UpdatePayment(ServiceContext context, Payment entity) + { + //update the properties of entity + entity.TxnDate = DateTime.UtcNow.Date.AddDays(10); + entity.TxnDateSpecified = true; + return entity; + } + + internal static Payment SparseUpdatePayment(ServiceContext context, string Id, string syncToken) + { + Payment entity = new Payment(); + entity.Id = Id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.PrivateNote = "updated Private Note"; + return entity; + } + + + internal static PaymentMethod CreatePaymentMethod(ServiceContext context) + { + PaymentMethod paymentMethod = new PaymentMethod(); + paymentMethod.Name = "CreditCard" + Helper.GetGuid().Substring(0, 13); + paymentMethod.Active = true; + paymentMethod.ActiveSpecified = true; + paymentMethod.Type = "CREDIT_CARD"; //Need to be replaced by PaymentTyprEnum + //paymentMethod.PaymentMethodEx = + return paymentMethod; + } + + + + internal static PaymentMethod UpdatePaymentMethod(ServiceContext context, PaymentMethod entity) + { + entity.Name = "Cash" + Helper.GetGuid().Substring(0, 13); + entity.Type = "NON_CREDIT_CARD"; + return entity; + } + + + + internal static PaymentMethod SparseUpdatePaymentMethod(ServiceContext context, string Id, string syncToken) + { + PaymentMethod entity = new PaymentMethod(); + entity.Id = Id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.Name = "Sparse Cash" + Helper.GetGuid().Substring(0, 13); + entity.Type = "NON_CREDIT_CARD"; + return entity; + } + + + + internal static Department CreateDepartment(ServiceContext context) + { + Department department = new Department(); + department.Name = "DeptName" + Helper.GetGuid().Substring(0, 13); + department.SubDepartment = true; + department.SubDepartmentSpecified = true; + //department.ParentRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + department.FullyQualifiedName = department.Name; + department.Active = true; + department.ActiveSpecified = true; + //department.DepartmentEx = + return department; + } + + + + internal static Department UpdateDepartment(ServiceContext context, Department entity) + { + entity.Name = "DeptName" + Helper.GetGuid().Substring(0, 13); + entity.FullyQualifiedName = entity.Name; + return entity; + } + + + internal static Department UpdateDepartmentSparse(ServiceContext context, string Id, string SyncToken) + { + Department entity = new Department(); + entity.Id = Id; + entity.SyncToken = SyncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.Name = "DeptName" + Helper.GetGuid().Substring(0, 13); + entity.FullyQualifiedName = entity.Name; + return entity; + } + + + internal static Item CreateItem(ServiceContext context) + { + + Item item = new Item(); + + + item.Name = "Name" + Helper.GetGuid().Substring(0, 5); ; + item.Description = "Description"; + item.Type = ItemTypeEnum.NonInventory; + item.TypeSpecified = true; + + item.Active = true; + item.ActiveSpecified = true; + + + //item.SubItem = true; + //item.SubItemSpecified = true; + //item.ParentRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //item.Level = int32; + //Int32 int32 = new Int32(); + + //item.LevelSpecified = true; + //item.FullyQualifiedName = "FullyQualifiedName"; + item.Taxable = false; + item.TaxableSpecified = true; + //item.SalesTaxIncluded = true; + //item.SalesTaxIncludedSpecified = true; + //item.PercentBased = true; + //item.PercentBasedSpecified = true; + item.UnitPrice = new Decimal(100.00); + item.UnitPriceSpecified = true; + //item.RatePercent = new Decimal(100.00); + //item.RatePercentSpecified = true; + //item.TypeSpecified = true; + //item.PaymentMethodRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //item.UOMSetRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + Account incomeAccount = Helper.FindOrAddAccount(context, AccountTypeEnum.Income, AccountClassificationEnum.Revenue); + item.IncomeAccountRef = new ReferenceType() + { + name = incomeAccount.Name, + Value = incomeAccount.Id + }; + //item.PurchaseDesc = "PurchaseDesc"; + //item.PurchaseTaxIncluded = true; + //item.PurchaseTaxIncludedSpecified = true; + item.PurchaseCost = new Decimal(100.00); + item.PurchaseCostSpecified = true; + Account expenseAccount = Helper.FindOrAddAccount(context, AccountTypeEnum.Expense, AccountClassificationEnum.Expense); + item.ExpenseAccountRef = new ReferenceType() + { + name = expenseAccount.Name, + Value = expenseAccount.Id + }; + //item.COGSAccountRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //item.AssetAccountRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //item.PrefVendorRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //item.AvgCost = new Decimal(100.00); + //item.AvgCostSpecified = true; + item.TrackQtyOnHand = false; + item.TrackQtyOnHandSpecified = true; + //item.QtyOnHand = new Decimal(100.00); + //item.QtyOnHandSpecified = true; + //item.QtyOnPurchaseOrder = new Decimal(100.00); + //item.QtyOnPurchaseOrderSpecified = true; + //item.QtyOnSalesOrder = new Decimal(100.00); + //item.QtyOnSalesOrderSpecified = true; + //item.ReorderPoint = new Decimal(100.00); + //item.ReorderPointSpecified = true; + //item.ManPartNum = "ManPartNum"; + //item.DepositToAccountRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //item.SalesTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //item.PurchaseTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //item.InvStartDate = DateTime.UtcNow.Date; + //item.InvStartDateSpecified = true; + //item.BuildPoint = new Decimal(100.00); + //item.BuildPointSpecified = true; + //item.PrintGroupedItems = true; + //item.PrintGroupedItemsSpecified = true; + //item.SpecialItem = true; + //item.SpecialItemSpecified = true; + //item.SpecialItemType = SpecialItemTypeEnum.; + //item.SpecialItemTypeSpecified = true; + + //List itemGroupDetailList = new List(); + //ItemComponentLine itemGroupDetail = new ItemComponentLine(); + //itemGroupDetail.ItemRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //itemGroupDetail.Qty = new Decimal(100.00); + //itemGroupDetail.QtySpecified = true; + //UOMRef uOMRef = new UOMRef(); + //itemGroupDetail.uOMRef.Unit = "Unit"; + //itemGroupDetail.uOMRef.UOMSetRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //itemComponentLine.UOMRef = uOMRef; + //itemGroupDetailList.Add(itemGroupDetail); + //item.ItemGroupDetail = itemGroupDetailList.ToArray(); + + //List itemAssemblyDetailList = new List(); + //ItemComponentLine itemAssemblyDetail = new ItemComponentLine(); + //itemAssemblyDetail.ItemRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //itemAssemblyDetail.Qty = new Decimal(100.00); + //itemAssemblyDetail.QtySpecified = true; + //UOMRef uOMRef = new UOMRef(); + //itemAssemblyDetail.uOMRef.Unit = "Unit"; + //itemAssemblyDetail.uOMRef.UOMSetRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //itemComponentLine.UOMRef = uOMRef; + //itemAssemblyDetailList.Add(itemAssemblyDetail); + //item.ItemAssemblyDetail = itemAssemblyDetailList.ToArray(); + //item.ItemEx = + + return item; + + } + + internal static Item CreateItemFrance(ServiceContext context) + { + + Item item = new Item(); + item.Name = "Name" + Helper.GetGuid().Substring(0, 5); ; + item.Description = "Description_Check"; + item.Active = true; + item.ActiveSpecified = true; + + item.Type = ItemTypeEnum.Service; + item.TypeSpecified = true; + item.ItemCategoryType = "Service"; + + //item.SubItem = true; + //item.SubItemSpecified = true; + //item.ParentRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //item.Level = int32; + //Int32 int32 = new Int32(); + + //item.LevelSpecified = true; + //item.FullyQualifiedName = "FullyQualifiedName"; + item.Taxable = false; + item.TaxableSpecified = true; + //item.SalesTaxIncluded = true; + //item.SalesTaxIncludedSpecified = true; + //item.PercentBased = true; + //item.PercentBasedSpecified = true; + item.UnitPrice = new Decimal(100.00); + item.UnitPriceSpecified = true; + //item.RatePercent = new Decimal(100.00); + //item.RatePercentSpecified = true; + //item.Type = ItemTypeEnum.; + //item.TypeSpecified = true; + //item.PaymentMethodRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //item.UOMSetRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + Account incomeAccount = Helper.FindOrAddAccount(context, AccountTypeEnum.Income, AccountClassificationEnum.Revenue); + item.IncomeAccountRef = new ReferenceType() + { + name = incomeAccount.Name, + Value = incomeAccount.Id + }; + //item.PurchaseDesc = "PurchaseDesc"; + //item.PurchaseTaxIncluded = true; + //item.PurchaseTaxIncludedSpecified = true; + item.PurchaseCost = new Decimal(100.00); + item.PurchaseCostSpecified = true; + Account expenseAccount = Helper.FindOrAddAccount(context, AccountTypeEnum.Expense, AccountClassificationEnum.Expense); + item.ExpenseAccountRef = new ReferenceType() + { + name = expenseAccount.Name, + Value = expenseAccount.Id + }; + //item.COGSAccountRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //item.AssetAccountRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //item.PrefVendorRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //item.AvgCost = new Decimal(100.00); + //item.AvgCostSpecified = true; + item.TrackQtyOnHand = false; + item.TrackQtyOnHandSpecified = true; + //item.QtyOnHand = new Decimal(100.00); + //item.QtyOnHandSpecified = true; + //item.QtyOnPurchaseOrder = new Decimal(100.00); + //item.QtyOnPurchaseOrderSpecified = true; + //item.QtyOnSalesOrder = new Decimal(100.00); + //item.QtyOnSalesOrderSpecified = true; + //item.ReorderPoint = new Decimal(100.00); + //item.ReorderPointSpecified = true; + //item.ManPartNum = "ManPartNum"; + //item.DepositToAccountRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //item.SalesTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //item.PurchaseTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //item.InvStartDate = DateTime.UtcNow.Date; + //item.InvStartDateSpecified = true; + //item.BuildPoint = new Decimal(100.00); + //item.BuildPointSpecified = true; + //item.PrintGroupedItems = true; + //item.PrintGroupedItemsSpecified = true; + //item.SpecialItem = true; + //item.SpecialItemSpecified = true; + //item.SpecialItemType = SpecialItemTypeEnum.; + //item.SpecialItemTypeSpecified = true; + + //List itemGroupDetailList = new List(); + //ItemComponentLine itemGroupDetail = new ItemComponentLine(); + //itemGroupDetail.ItemRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //itemGroupDetail.Qty = new Decimal(100.00); + //itemGroupDetail.QtySpecified = true; + //UOMRef uOMRef = new UOMRef(); + //itemGroupDetail.uOMRef.Unit = "Unit"; + //itemGroupDetail.uOMRef.UOMSetRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //itemComponentLine.UOMRef = uOMRef; + //itemGroupDetailList.Add(itemGroupDetail); + //item.ItemGroupDetail = itemGroupDetailList.ToArray(); + + //List itemAssemblyDetailList = new List(); + //ItemComponentLine itemAssemblyDetail = new ItemComponentLine(); + //itemAssemblyDetail.ItemRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //itemAssemblyDetail.Qty = new Decimal(100.00); + //itemAssemblyDetail.QtySpecified = true; + //UOMRef uOMRef = new UOMRef(); + //itemAssemblyDetail.uOMRef.Unit = "Unit"; + //itemAssemblyDetail.uOMRef.UOMSetRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //itemComponentLine.UOMRef = uOMRef; + //itemAssemblyDetailList.Add(itemAssemblyDetail); + //item.ItemAssemblyDetail = itemAssemblyDetailList.ToArray(); + //item.ItemEx = + return item; + } + + + internal static Item UpdateItem(ServiceContext context, Item entity) + { + //update the properties of entity + entity.Name = "updatedName" + Helper.GetGuid().Substring(0, 5); + entity.Description = "updatedDescription"; + return entity; + } + + + internal static Item UpdateItemFrance(ServiceContext context, Item entity) + { + //update the properties of entity + entity.Name = "updatedName" + Helper.GetGuid().Substring(0, 5); + entity.Description = "updatedDescription"; + + Account incomeAccount = Helper.FindOrAddAccount(context, AccountTypeEnum.Income, AccountClassificationEnum.Revenue); + entity.IncomeAccountRef = new ReferenceType() + { + name = incomeAccount.Name, + Value = incomeAccount.Id + }; + return entity; + } + + + internal static Item SparseUpdateItem(ServiceContext context, string Id, string syncToken) + { + Item entity = new Item(); + entity.Id = Id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.Name = "sparseupdatedName" + Helper.GetGuid().Substring(0, 5); + entity.Description = "sparseupdatedDescription"; + return entity; + } + + + internal static Term CreateTerm(ServiceContext context) + { + Term term = new Term(); + term.Name = "Name" + Helper.GetGuid().Substring(0, 15); + term.Active = true; + term.ActiveSpecified = true; + term.Type = "STANDARD"; + term.DiscountPercent = new Decimal(50.00); + term.DiscountPercentSpecified = true; + term.AnyIntuitObjects = new Object[] { 10 }; + term.ItemsElementName = new ItemsChoiceType[] { ItemsChoiceType.DueDays }; + return term; + } + + + internal static Term UpdateTerm(ServiceContext context, Term entity) + { + entity.Name = "UpdateName" + Helper.GetGuid().Substring(0, 15); + entity.Active = true; + entity.ActiveSpecified = true; + return entity; + } + + + internal static Term SparseUpdateTerm(ServiceContext context, string Id, string syncToken) + { + Term entity = new Term(); + entity.Id = Id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.Name = "SparseUpdateName" + Helper.GetGuid().Substring(0, 15); + entity.Active = true; + entity.ActiveSpecified = true; + return entity; + } + + + internal static BillPayment CreateBillPaymentCheck(ServiceContext context) + { + BillPayment billPayment = new BillPayment(); + VendorCredit vendorCredit = Helper.Add(context, QBOHelper.CreateVendorCredit(context)); + billPayment.PayType = BillPaymentTypeEnum.Check; + billPayment.PayTypeSpecified = true; + //billPayment.AnyIntuitObject = + billPayment.TotalAmt = vendorCredit.TotalAmt; + billPayment.TotalAmtSpecified = true; + //billPayment.BillPaymentEx = + //billPayment.DocNumber = "DocNumber"; + billPayment.TxnDate = DateTime.UtcNow.Date; + billPayment.TxnDateSpecified = true; + //billPayment.ExchangeRate = new Decimal(100.00); + //billPayment.ExchangeRateSpecified = true; + billPayment.PrivateNote = "PrivateNote"; + //billPayment.TxnStatus = "TxnStatus"; + + //Account liabilityAccount = Helper.FindOrAddAccount(context, AccountTypeEnum.AccountsPayable, AccountClassificationEnum.Liability); + //billPayment.APAccountRef = new ReferenceType() + //{ + // name = liabilityAccount.Name, + // Value = liabilityAccount.Id + //}; + + Vendor vendor = Helper.FindOrAdd(context, new Vendor()); + billPayment.VendorRef = new ReferenceType() + { + name = vendor.DisplayName, + type = "Vendor", + Value = vendor.Id + }; + + Account bankAccount = Helper.FindOrAddAccount(context, AccountTypeEnum.Bank, AccountClassificationEnum.Asset); + BillPaymentCheck billPaymentCheck = new BillPaymentCheck(); + billPaymentCheck.BankAccountRef = new ReferenceType() + { + name = bankAccount.Name, + Value = bankAccount.Id + }; + + CheckPayment checkPayment = new CheckPayment(); + checkPayment.AcctNum = "AcctNum" + Helper.GetGuid().Substring(0, 5); + checkPayment.BankName = "BankName" + Helper.GetGuid().Substring(0, 5); + checkPayment.CheckNum = "CheckNum" + Helper.GetGuid().Substring(0, 5); + checkPayment.NameOnAcct = "Name" + Helper.GetGuid().Substring(0, 5); + checkPayment.Status = "Status" + Helper.GetGuid().Substring(0, 5); + billPaymentCheck.CheckDetail = checkPayment; + + PhysicalAddress payeeAddr = new PhysicalAddress(); + payeeAddr.Line1 = "Line 1"; + payeeAddr.Line2 = "Line 2"; + payeeAddr.City = "Mountain View"; + payeeAddr.CountrySubDivisionCode = "CA"; + payeeAddr.PostalCode = "94043"; + billPaymentCheck.PayeeAddr = payeeAddr; + billPaymentCheck.PrintStatus = PrintStatusEnum.NeedToPrint; + billPaymentCheck.PrintStatusSpecified = true; + billPayment.AnyIntuitObject = billPaymentCheck; + + List lineList = new List(); + + Line line1 = new Line(); + //line.LineNum = "LineNum"; + //line.Description = "Description"; + + Bill bill = Helper.Add(context, QBOHelper.CreateBill(context)); + line1.Amount = bill.TotalAmt; + line1.AmountSpecified = true; + List LinkedTxnList1 = new List(); + LinkedTxn linkedTxn1 = new LinkedTxn(); + linkedTxn1.TxnId = bill.Id; + linkedTxn1.TxnType = TxnTypeEnum.Bill.ToString(); + LinkedTxnList1.Add(linkedTxn1); + line1.LinkedTxn = LinkedTxnList1.ToArray(); + + lineList.Add(line1); + + Line line = new Line(); + //line.LineNum = "LineNum"; + //line.Description = "Description"; + + line.Amount = vendorCredit.TotalAmt; + line.AmountSpecified = true; + + List LinkedTxnList = new List(); + LinkedTxn linkedTxn = new LinkedTxn(); + linkedTxn.TxnId = vendorCredit.Id; + linkedTxn.TxnType = TxnTypeEnum.VendorCredit.ToString(); + LinkedTxnList.Add(linkedTxn); + line.LinkedTxn = LinkedTxnList.ToArray(); + + lineList.Add(line); + + billPayment.Line = lineList.ToArray(); + + return billPayment; + } + + internal static BillPayment CreateBillPaymentCreditCard(ServiceContext context) + { + BillPayment billPayment = new BillPayment(); + VendorCredit vendorCredit = Helper.Add(context, QBOHelper.CreateVendorCredit(context)); + billPayment.PayType = BillPaymentTypeEnum.Check; + billPayment.PayTypeSpecified = true; + //billPayment.AnyIntuitObject = + billPayment.TotalAmt = vendorCredit.TotalAmt; + billPayment.TotalAmtSpecified = true; + //billPayment.BillPaymentEx = + //billPayment.DocNumber = "DocNumber"; + billPayment.TxnDate = DateTime.UtcNow.Date; + billPayment.TxnDateSpecified = true; + //billPayment.ExchangeRate = new Decimal(100.00); + //billPayment.ExchangeRateSpecified = true; + billPayment.PrivateNote = "PrivateNote"; + //billPayment.TxnStatus = "TxnStatus"; + + //Account liabilityAccount = Helper.FindOrAddAccount(context, AccountTypeEnum.AccountsPayable, AccountClassificationEnum.Liability); + //billPayment.APAccountRef = new ReferenceType() + //{ + // name = liabilityAccount.Name, + // Value = liabilityAccount.Id + //}; + + Vendor vendor = Helper.FindOrAdd(context, new Vendor()); + billPayment.VendorRef = new ReferenceType() + { + name = vendor.DisplayName, + type = "Vendor", + Value = vendor.Id + }; + + Account bankAccount = Helper.FindOrAddAccount(context, AccountTypeEnum.CreditCard, AccountClassificationEnum.Expense); + BillPaymentCreditCard billPaymentCreditCard = new BillPaymentCreditCard(); + billPaymentCreditCard.CCAccountRef = new ReferenceType() + { + name = bankAccount.Name, + Value = bankAccount.Id + }; + + CreditCardPayment creditCardPayment = new CreditCardPayment(); + creditCardPayment.CreditChargeInfo = new CreditChargeInfo() + { + Amount = new Decimal(10.00), + AmountSpecified = true, + Number = "124124124", + NameOnAcct = bankAccount.Name, + CcExpiryMonth = 10, + CcExpiryMonthSpecified = true, + CcExpiryYear = 2015, + CcExpiryYearSpecified = true, + BillAddrStreet = "BillAddrStreetba7cca47", + PostalCode = "560045", + CommercialCardCode = "CardCodeba7cca47", + CCTxnMode = CCTxnModeEnum.CardPresent, + CCTxnType = CCTxnTypeEnum.Charge + }; + + billPaymentCreditCard.CCDetail = creditCardPayment; + billPayment.AnyIntuitObject = billPaymentCreditCard; + + List lineList = new List(); + + Line line1 = new Line(); + //line.LineNum = "LineNum"; + //line.Description = "Description"; + + Bill bill = Helper.Add(context, QBOHelper.CreateBill(context)); + line1.Amount = bill.TotalAmt; + line1.AmountSpecified = true; + List LinkedTxnList1 = new List(); + LinkedTxn linkedTxn1 = new LinkedTxn(); + linkedTxn1.TxnId = bill.Id; + linkedTxn1.TxnType = TxnTypeEnum.Bill.ToString(); + LinkedTxnList1.Add(linkedTxn1); + line1.LinkedTxn = LinkedTxnList1.ToArray(); + + lineList.Add(line1); + + Line line = new Line(); + //line.LineNum = "LineNum"; + //line.Description = "Description"; + + line.Amount = vendorCredit.TotalAmt; + line.AmountSpecified = true; + + List LinkedTxnList = new List(); + LinkedTxn linkedTxn = new LinkedTxn(); + linkedTxn.TxnId = vendorCredit.Id; + linkedTxn.TxnType = TxnTypeEnum.VendorCredit.ToString(); + LinkedTxnList.Add(linkedTxn); + line.LinkedTxn = LinkedTxnList.ToArray(); + + lineList.Add(line); + + billPayment.Line = lineList.ToArray(); + + return billPayment; + } + + internal static BillPayment UpdateBillPayment(ServiceContext context, BillPayment entity) + { + //update the properties of entity + entity.PrivateNote = "Updated PrivateNote"; + + Account bankAccount = Helper.FindOrAddAccount(context, AccountTypeEnum.Bank, AccountClassificationEnum.Asset); + BillPaymentCheck billPaymentCheck = new BillPaymentCheck(); + billPaymentCheck.BankAccountRef = new ReferenceType() + { + name = bankAccount.Name, + Value = bankAccount.Id + }; + + CheckPayment checkPayment = new CheckPayment(); + checkPayment.AcctNum = "AcctNum" + Helper.GetGuid().Substring(0, 5); + checkPayment.BankName = "BankName" + Helper.GetGuid().Substring(0, 5); + checkPayment.CheckNum = "CheckNum" + Helper.GetGuid().Substring(0, 5); + checkPayment.NameOnAcct = "Name" + Helper.GetGuid().Substring(0, 5); + checkPayment.Status = "Status" + Helper.GetGuid().Substring(0, 5); + billPaymentCheck.CheckDetail = checkPayment; + + PhysicalAddress payeeAddr = new PhysicalAddress(); + payeeAddr.Line1 = "Line 1"; + payeeAddr.Line2 = "Line 2"; + payeeAddr.City = "Mountain View"; + payeeAddr.CountrySubDivisionCode = "CA"; + payeeAddr.PostalCode = "94043"; + billPaymentCheck.PayeeAddr = payeeAddr; + billPaymentCheck.PrintStatus = PrintStatusEnum.NeedToPrint; + billPaymentCheck.PrintStatusSpecified = true; + entity.AnyIntuitObject = billPaymentCheck; + return entity; + } + + internal static BillPayment UpdateBillPaymentSparse(ServiceContext context, string id, string syncToken) + { + BillPayment entity = new BillPayment(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.PrivateNote = "Updated PrivateNote"; + return entity; + } + + internal static Deposit CreateDeposit(ServiceContext context) + { + Deposit deposit = new Deposit(); + Account bankAccount = Helper.FindOrAddAccount(context, AccountTypeEnum.Bank, AccountClassificationEnum.Asset); + deposit.DepositToAccountRef = new ReferenceType() + { + name = bankAccount.Name, + Value = bankAccount.Id + }; + + deposit.TotalAmt = new Decimal(100.00); + deposit.TotalAmtSpecified = true; + + deposit.TxnDate = DateTime.UtcNow.Date; + deposit.TxnDateSpecified = true; + //deposit.DepartmentRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //deposit.CurrencyRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + deposit.ExchangeRate = new Decimal(1.00); + deposit.ExchangeRateSpecified = true; + deposit.PrivateNote = "PrivateNote" + Helper.GetGuid().Substring(0, 8); ; + //deposit.TxnStatus = "TxnStatus"; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //deposit.LinkedTxn = linkedTxnList.ToArray(); + + List lineList = new List(); + Line line = new Line(); + //line.LineNum = "LineNum"; + line.Description = "Description"; + line.Amount = new Decimal(100.00); + line.AmountSpecified = true; + + line.DetailType = LineDetailTypeEnum.DepositLineDetail; + line.DetailTypeSpecified = true; + + DepositLineDetail lineDepositLineDetail = new DepositLineDetail(); + + Customer customer = Helper.FindOrAdd(context, new Customer()); + lineDepositLineDetail.Entity = new ReferenceType() + { + //add customer/job detail + name = customer.DisplayName, + Value = customer.Id + }; + + Account incomeAccount = Helper.FindOrAddAccount(context, AccountTypeEnum.Income, AccountClassificationEnum.Revenue); + lineDepositLineDetail.AccountRef = new ReferenceType() + { + //add account detail + name = incomeAccount.Name, + Value = incomeAccount.Id + }; + + PaymentMethod paymentMethod = Helper.FindOrAddPaymentMethod(context, PaymentMethodEnum.Cash.ToString()); + lineDepositLineDetail.PaymentMethodRef = new ReferenceType() + { + //add paymentMethod + name = paymentMethod.Name, + Value = paymentMethod.Id + + }; + + line.AnyIntuitObject = lineDepositLineDetail; + lineList.Add(line); + deposit.Line = lineList.ToArray(); + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + //line.DetailType = LineDetailTypeEnum.; + //line.AnyIntuitObject = + + + return deposit; + } + + + + internal static Deposit UpdateDeposit(ServiceContext context, Deposit entity) + { + //update the properties of entity + entity.PrivateNote = "upd_Note" + Helper.GetGuid().Substring(0, 8); + + return entity; + } + + + internal static Deposit UpdateDepositSparse(ServiceContext context, string id, string syncToken) + { + Deposit entity = new Deposit(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.PrivateNote = "spa_Note" + Helper.GetGuid().Substring(0, 8); + Account bankAccount = Helper.FindOrAddAccount(context, AccountTypeEnum.Bank, AccountClassificationEnum.Asset); + entity.DepositToAccountRef = new ReferenceType() + { + name = bankAccount.Name, + Value = bankAccount.Id + }; + + + return entity; + } + + internal static Transfer CreateTransfer(ServiceContext context) + { + Transfer transfer = new Transfer(); + Account depositAccount = Helper.FindOrAddAccount(context, AccountTypeEnum.Bank, AccountClassificationEnum.Asset); + transfer.FromAccountRef = new ReferenceType() + { + name = depositAccount.Name, + Value = depositAccount.Id + }; + Account creditAccount = Helper.FindOrAddAccount(context, AccountTypeEnum.CreditCard, AccountClassificationEnum.Liability); + transfer.ToAccountRef = new ReferenceType() + { + name = creditAccount.Name, + Value = creditAccount.Id + }; + transfer.Amount = new Decimal(100.00); + transfer.AmountSpecified = true; + //transfer.ClassRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //transfer.TransferEx = + //transfer.DocNumber = "DocNumber"; + //transfer.TxnDate = DateTime.UtcNow.Date; + //transfer.TxnDateSpecified = true; + //transfer.DepartmentRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //transfer.CurrencyRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //transfer.ExchangeRate = new Decimal(100.00); + //transfer.ExchangeRateSpecified = true; + //transfer.PrivateNote = "PrivateNote"; + //transfer.TxnStatus = "TxnStatus"; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //transfer.LinkedTxn = linkedTxnList.ToArray(); + + //List lineList = new List(); + //Line line = new Line(); + //line.LineNum = "LineNum"; + //line.Description = "Description"; + //line.Amount = new Decimal(100.00); + //line.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + //line.DetailType = LineDetailTypeEnum.; + //line.AnyIntuitObject = + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //line.LineEx = + //lineList.Add(line); + //transfer.Line = lineList.ToArray(); + //TxnTaxDetail txnTaxDetail = new TxnTaxDetail(); + //txnTaxDetail.DefaultTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TxnTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TotalTax = new Decimal(100.00); + //txnTaxDetail.TotalTaxSpecified = true; + + //List taxLineList = new List(); + //Line taxLine = new Line(); + //taxLine.LineNum = "LineNum"; + //taxLine.Description = "Description"; + //taxLine.Amount = new Decimal(100.00); + //taxLine.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + //taxLine.DetailType = LineDetailTypeEnum.; + //taxLine.AnyIntuitObject = + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //taxLine.LineEx = + + //taxLineList.Add(taxLine); + //txnTaxDetail.TaxLine = taxLineList.ToArray(); + //transfer.TxnTaxDetail = txnTaxDetail; + return transfer; + } + + + + internal static Transfer UpdateTransfer(ServiceContext context, Transfer entity) + { + //update the properties of entity + entity.Amount = new Decimal(200.00); + entity.AmountSpecified = true; + + return entity; + } + + internal static Transfer UpdateTransferSparse(ServiceContext context, string id, string syncToken) + { + Transfer entity = new Transfer(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.Amount = new Decimal(200.00); + entity.AmountSpecified = true; + + return entity; + } + + + + internal static PurchaseOrder CreatePurchaseOrder(ServiceContext context) + { + Vendor vendors = Helper.FindOrAdd(context, new Vendor()); + Account accountsForDetail = Helper.FindOrAddAccount(context, AccountTypeEnum.Expense, AccountClassificationEnum.Expense); + + PurchaseOrder purchaseOrder = new PurchaseOrder(); + //purchaseOrder.TaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //purchaseOrder.ClassRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //purchaseOrder.ReimbursableInfoRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //purchaseOrder.SalesTermRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //purchaseOrder.DueDate = DateTime.UtcNow.Date; + //purchaseOrder.DueDateSpecified = true; + //purchaseOrder.ExpectedDate = DateTime.UtcNow.Date; + //purchaseOrder.ExpectedDateSpecified = true; + //PhysicalAddress vendorAddr = new PhysicalAddress(); + //vendorAddr.Line1 = "Line1"; + //vendorAddr.Line2 = "Line2"; + //vendorAddr.Line3 = "Line3"; + //vendorAddr.Line4 = "Line4"; + //vendorAddr.Line5 = "Line5"; + //vendorAddr.City = "City"; + //vendorAddr.Country = "Country"; + //vendorAddr.CountryCode = "CountryCode"; + //vendorAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //vendorAddr.PostalCode = "PostalCode"; + //vendorAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //vendorAddr.Lat = "Lat"; + //vendorAddr.Long = "Long"; + //vendorAddr.Tag = "Tag"; + //vendorAddr.Note = "Note"; + //purchaseOrder.VendorAddr = vendorAddr; + //purchaseOrder.AnyIntuitObject = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //purchaseOrder.ItemElementName = itemChoiceType1; + //ItemChoiceType1 itemChoiceType1 = new ItemChoiceType1(); + + //PhysicalAddress shipAddr = new PhysicalAddress(); + //shipAddr.Line1 = "Line1"; + //shipAddr.Line2 = "Line2"; + //shipAddr.Line3 = "Line3"; + //shipAddr.Line4 = "Line4"; + //shipAddr.Line5 = "Line5"; + //shipAddr.City = "City"; + //shipAddr.Country = "Country"; + //shipAddr.CountryCode = "CountryCode"; + //shipAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //shipAddr.PostalCode = "PostalCode"; + //shipAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //shipAddr.Lat = "Lat"; + //shipAddr.Long = "Long"; + //shipAddr.Tag = "Tag"; + //shipAddr.Note = "Note"; + //purchaseOrder.ShipAddr = shipAddr; + //purchaseOrder.ShipMethodRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //purchaseOrder.FOB = "FOB"; + //EmailAddress pOEmail = new EmailAddress(); + //pOEmail.Address = "Address"; + //pOEmail.Default = true; + //pOEmail.DefaultSpecified = true; + //pOEmail.Tag = "Tag"; + //purchaseOrder.POEmail = pOEmail; + //purchaseOrder.TemplateRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //purchaseOrder.PrintStatus = PrintStatusEnum.; + //purchaseOrder.PrintStatusSpecified = true; + //purchaseOrder.EmailStatus = EmailStatusEnum.; + //purchaseOrder.EmailStatusSpecified = true; + //purchaseOrder.ManuallyClosed = true; + //purchaseOrder.ManuallyClosedSpecified = true; + //purchaseOrder.POStatus = PurchaseOrderStatusEnum.; + //purchaseOrder.POStatusSpecified = true; + //purchaseOrder.PurchaseOrderEx = + + purchaseOrder.VendorRef = new ReferenceType() + { + //type = Enum.GetName(typeof(objectNameEnumType), objectNameEnumType.Vendor), + name = vendors.DisplayName, + Value = vendors.Id + }; + //purchaseOrder.APAccountRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + purchaseOrder.TotalAmt = new Decimal(10.00); + purchaseOrder.TotalAmtSpecified = true; + //EmailAddress billEmail = new EmailAddress(); + //billEmail.Address = "Address"; + //billEmail.Default = true; + //billEmail.DefaultSpecified = true; + //billEmail.Tag = "Tag"; + //purchaseOrder.BillEmail = billEmail; + //EmailAddress replyEmail = new EmailAddress(); + //replyEmail.Address = "Address"; + //replyEmail.Default = true; + //replyEmail.DefaultSpecified = true; + //replyEmail.Tag = "Tag"; + //purchaseOrder.ReplyEmail = replyEmail; + //purchaseOrder.Memo = "Memo"; + //purchaseOrder.GlobalTaxCalculation = GlobalTaxCalculationEnum.; + //purchaseOrder.GlobalTaxCalculationSpecified = true; + //purchaseOrder.DocNumber = "DocNumber"; + purchaseOrder.TxnDate = DateTime.UtcNow.Date; + purchaseOrder.TxnDateSpecified = true; + //purchaseOrder.DepartmentRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //purchaseOrder.CurrencyRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //purchaseOrder.ExchangeRate = new Decimal(100.00); + //purchaseOrder.ExchangeRateSpecified = true; + //purchaseOrder.PrivateNote = "PrivateNote"; + //purchaseOrder.TxnStatus = "TxnStatus"; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //purchaseOrder.LinkedTxn = linkedTxnList.ToArray(); + + List lineList = new List(); + Line line = new Line(); + line.LineNum = "1"; + //line.Description = "Description"; + line.Amount = new Decimal(10.00); + line.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + line.DetailType = LineDetailTypeEnum.AccountBasedExpenseLineDetail; + line.DetailTypeSpecified = true; + AccountBasedExpenseLineDetail accountBasedExpenseDetails = new AccountBasedExpenseLineDetail(); + accountBasedExpenseDetails.AccountRef = new ReferenceType { type = Enum.GetName(typeof(objectNameEnumType), objectNameEnumType.Account), name = accountsForDetail.Name, Value = accountsForDetail.Id }; + + line.AnyIntuitObject = accountBasedExpenseDetails; + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //line.LineEx = + + lineList.Add(line); + purchaseOrder.Line = lineList.ToArray(); + //TxnTaxDetail txnTaxDetail = new TxnTaxDetail(); + //txnTaxDetail.DefaultTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TxnTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TotalTax = new Decimal(100.00); + //txnTaxDetail.TotalTaxSpecified = true; + + //List taxLineList = new List(); + //Line taxLine = new Line(); + //taxLine.LineNum = "LineNum"; + //taxLine.Description = "Description"; + //taxLine.Amount = new Decimal(100.00); + //taxLine.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + //taxLine.DetailType = LineDetailTypeEnum.; + //taxLine.AnyIntuitObject = + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //taxLine.LineEx = + + //taxLineList.Add(taxLine); + //txnTaxDetail.TaxLine = taxLineList.ToArray(); + //purchaseOrder.TxnTaxDetail = txnTaxDetail; + return purchaseOrder; + } + + + + internal static PurchaseOrder UpdatePurchaseOrder(ServiceContext context, PurchaseOrder entity) + { + //update the properties of entity + entity.DocNumber = Helper.GetGuid().Substring(0, 13); + return entity; + } + + internal static PurchaseOrder UpdatePurchaseOrderSparse(ServiceContext context, string Id, string SyncToken) + { + PurchaseOrder entity = new PurchaseOrder(); + entity.Id = Id; + entity.SyncToken = SyncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.DocNumber = Helper.GetGuid().Substring(0, 13); + return entity; + } + + + internal static SalesOrder CreateSalesOrder(ServiceContext context) + { + SalesOrder salesOrder = new SalesOrder(); + salesOrder.ManuallyClosed = true; + salesOrder.ManuallyClosedSpecified = true; + //salesOrder.SalesOrderEx = + + salesOrder.AutoDocNumber = true; + salesOrder.AutoDocNumberSpecified = true; + //salesOrder.CustomerRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //MemoRef customerMemo = new MemoRef(); + //customerMemo.id = "id"; + //customerMemo.Value = "Value"; + //salesOrder.CustomerMemo = customerMemo; + PhysicalAddress billAddr = new PhysicalAddress(); + billAddr.Line1 = "Line1"; + billAddr.Line2 = "Line2"; + //billAddr.Line3 = "Line3"; + //billAddr.Line4 = "Line4"; + //billAddr.Line5 = "Line5"; + billAddr.City = "City"; + billAddr.Country = "Country"; + //billAddr.CountryCode = "CountryCode"; + //billAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //billAddr.PostalCode = "PostalCode"; + //billAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //billAddr.Lat = "Lat"; + //billAddr.Long = "Long"; + //billAddr.Tag = "Tag"; + //billAddr.Note = "Note"; + salesOrder.BillAddr = billAddr; + PhysicalAddress shipAddr = new PhysicalAddress(); + shipAddr.Line1 = "Line1"; + shipAddr.Line2 = "Line2"; + //shipAddr.Line3 = "Line3"; + //shipAddr.Line4 = "Line4"; + //shipAddr.Line5 = "Line5"; + shipAddr.City = "City"; + shipAddr.Country = "Country"; + shipAddr.CountryCode = "CountryCode"; + //shipAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + shipAddr.PostalCode = "PostalCode"; + //shipAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //shipAddr.Lat = "Lat"; + //shipAddr.Long = "Long"; + //shipAddr.Tag = "Tag"; + //shipAddr.Note = "Note"; + salesOrder.ShipAddr = shipAddr; + //salesOrder.RemitToRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesOrder.ClassRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesOrder.SalesTermRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + salesOrder.DueDate = DateTime.UtcNow.Date; + salesOrder.DueDateSpecified = true; + //salesOrder.SalesRepRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesOrder.PONumber = "PONumber"; + //salesOrder.FOB = "FOB"; + //salesOrder.ShipMethodRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + salesOrder.ShipDate = DateTime.UtcNow.Date; + salesOrder.ShipDateSpecified = true; + salesOrder.TrackingNum = "TrackingNum"; + salesOrder.GlobalTaxCalculation = GlobalTaxCalculationEnum.TaxInclusive; + salesOrder.GlobalTaxCalculationSpecified = true; + salesOrder.TotalAmt = new Decimal(100.00); + salesOrder.TotalAmtSpecified = true; + salesOrder.HomeTotalAmt = new Decimal(100.00); + salesOrder.HomeTotalAmtSpecified = true; + salesOrder.ApplyTaxAfterDiscount = true; + salesOrder.ApplyTaxAfterDiscountSpecified = true; + //salesOrder.TemplateRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesOrder.PrintStatus = PrintStatusEnum.; + //salesOrder.PrintStatusSpecified = true; + //salesOrder.EmailStatus = EmailStatusEnum.; + //salesOrder.EmailStatusSpecified = true; + //EmailAddress billEmail = new EmailAddress(); + //billEmail.Address = "Address"; + //billEmail.Default = true; + //billEmail.DefaultSpecified = true; + //billEmail.Tag = "Tag"; + //salesOrder.BillEmail = billEmail; + //salesOrder.ARAccountRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + salesOrder.Balance = new Decimal(100.00); + salesOrder.BalanceSpecified = true; + salesOrder.FinanceCharge = true; + salesOrder.FinanceChargeSpecified = true; + //salesOrder.PaymentMethodRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesOrder.PaymentRefNum = "PaymentRefNum"; + salesOrder.PaymentType = PaymentTypeEnum.CreditCard; + salesOrder.PaymentTypeSpecified = true; + //salesOrder.AnyIntuitObject = + //salesOrder.DepositToAccountRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + salesOrder.DocNumber = "DocNumber"; + salesOrder.TxnDate = DateTime.UtcNow.Date; + salesOrder.TxnDateSpecified = true; + //salesOrder.DepartmentRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesOrder.CurrencyRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + salesOrder.ExchangeRate = new Decimal(100.00); + salesOrder.ExchangeRateSpecified = true; + salesOrder.PrivateNote = "PrivateNote"; + salesOrder.TxnStatus = "TxnStatus"; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //salesOrder.LinkedTxn = linkedTxnList.ToArray(); + + //List lineList = new List(); + //Line line = new Line(); + //line.LineNum = "LineNum"; + //line.Description = "Description"; + //line.Amount = new Decimal(100.00); + //line.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + //line.DetailType = LineDetailTypeEnum.; + //line.AnyIntuitObject = + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //line.LineEx = + //lineList.Add(line); + //salesOrder.Line = lineList.ToArray(); + //TxnTaxDetail txnTaxDetail = new TxnTaxDetail(); + //txnTaxDetail.DefaultTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TxnTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TotalTax = new Decimal(100.00); + //txnTaxDetail.TotalTaxSpecified = true; + + //List taxLineList = new List(); + //Line taxLine = new Line(); + //taxLine.LineNum = "LineNum"; + //taxLine.Description = "Description"; + //taxLine.Amount = new Decimal(100.00); + //taxLine.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + //taxLine.DetailType = LineDetailTypeEnum.; + //taxLine.AnyIntuitObject = + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //taxLine.LineEx = + + //taxLineList.Add(taxLine); + //txnTaxDetail.TaxLine = taxLineList.ToArray(); + //salesOrder.TxnTaxDetail = txnTaxDetail; + return salesOrder; + } + + + + internal static SalesOrder UpdateSalesOrder(ServiceContext context, SalesOrder entity) + { + //update the properties of entity + entity.TrackingNum = "trackingNum_updated"; + entity.DocNumber = "DocNumber_updated"; + return entity; + } + + + internal static SalesOrder UpdateSalesOrderSparse(ServiceContext context, string id, string syncToken) + { + SalesOrder entity = new SalesOrder(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.TrackingNum = "trackingNum_Sparseupdated"; + entity.DocNumber = "DocNumber_Sparseupdated"; + return entity; + } + + + internal static CreditMemo CreateCreditMemo(ServiceContext context) + { + CreditMemo creditMemo = new CreditMemo(); + //creditMemo.RemainingCredit = new Decimal(100.00); + //creditMemo.RemainingCreditSpecified = true; + //creditMemo.CreditMemoEx = + //creditMemo.AutoDocNumber = true; + //creditMemo.AutoDocNumberSpecified = true; + Customer customer = Helper.FindOrAdd(context, new Customer()); + creditMemo.CustomerRef = new ReferenceType() + { + name = customer.DisplayName, + Value = customer.Id + }; + //MemoRef customerMemo = new MemoRef(); + //customerMemo.id = "id"; + //customerMemo.Value = "Value"; + //creditMemo.CustomerMemo = customerMemo; + //PhysicalAddress billAddr = new PhysicalAddress(); + //billAddr.Line1 = "Line1"; + //billAddr.Line2 = "Line2"; + //billAddr.Line3 = "Line3"; + //billAddr.Line4 = "Line4"; + //billAddr.Line5 = "Line5"; + //billAddr.City = "City"; + //billAddr.Country = "Country"; + //billAddr.CountryCode = "CountryCode"; + //billAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //billAddr.PostalCode = "PostalCode"; + //billAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //billAddr.Lat = "Lat"; + //billAddr.Long = "Long"; + //billAddr.Tag = "Tag"; + //billAddr.Note = "Note"; + //creditMemo.BillAddr = billAddr; + //PhysicalAddress shipAddr = new PhysicalAddress(); + //shipAddr.Line1 = "Line1"; + //shipAddr.Line2 = "Line2"; + //shipAddr.Line3 = "Line3"; + //shipAddr.Line4 = "Line4"; + //shipAddr.Line5 = "Line5"; + //shipAddr.City = "City"; + //shipAddr.Country = "Country"; + //shipAddr.CountryCode = "CountryCode"; + //shipAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //shipAddr.PostalCode = "PostalCode"; + //shipAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //shipAddr.Lat = "Lat"; + //shipAddr.Long = "Long"; + //shipAddr.Tag = "Tag"; + //shipAddr.Note = "Note"; + //creditMemo.ShipAddr = shipAddr; + //creditMemo.RemitToRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //creditMemo.ClassRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //creditMemo.SalesTermRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //creditMemo.DueDate = DateTime.UtcNow.Date; + //creditMemo.DueDateSpecified = true; + //creditMemo.SalesRepRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //creditMemo.PONumber = "PONumber"; + //creditMemo.FOB = "FOB"; + //creditMemo.ShipMethodRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //creditMemo.ShipDate = DateTime.UtcNow.Date; + //creditMemo.ShipDateSpecified = true; + //creditMemo.TrackingNum = "TrackingNum"; + //creditMemo.GlobalTaxCalculation = GlobalTaxCalculationEnum.; + //creditMemo.GlobalTaxCalculationSpecified = true; + creditMemo.TotalAmt = new Decimal(100.00); + creditMemo.TotalAmtSpecified = true; + //creditMemo.HomeTotalAmt = new Decimal(100.00); + //creditMemo.HomeTotalAmtSpecified = true; + creditMemo.ApplyTaxAfterDiscount = true; + creditMemo.ApplyTaxAfterDiscountSpecified = true; + //creditMemo.TemplateRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //creditMemo.PrintStatus = PrintStatusEnum.; + //creditMemo.PrintStatusSpecified = true; + //creditMemo.EmailStatus = EmailStatusEnum.; + //creditMemo.EmailStatusSpecified = true; + //EmailAddress billEmail = new EmailAddress(); + //billEmail.Address = "Address"; + //billEmail.Default = true; + //billEmail.DefaultSpecified = true; + //billEmail.Tag = "Tag"; + //creditMemo.BillEmail = billEmail; + //creditMemo.ARAccountRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //creditMemo.Balance = new Decimal(100.00); + //creditMemo.BalanceSpecified = true; + //creditMemo.FinanceCharge = true; + //creditMemo.FinanceChargeSpecified = true; + //creditMemo.PaymentMethodRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //creditMemo.PaymentRefNum = "PaymentRefNum"; + //creditMemo.PaymentType = PaymentTypeEnum.; + //creditMemo.PaymentTypeSpecified = true; + //creditMemo.AnyIntuitObject = + Account depositAccount = Helper.FindOrAddAccount(context, AccountTypeEnum.Bank, AccountClassificationEnum.Asset); + creditMemo.DepositToAccountRef = new ReferenceType() + { + name = depositAccount.Name, + Value = depositAccount.Id + }; + creditMemo.DocNumber = "DocNumber" + Helper.GetGuid().Substring(0, 3); ; + creditMemo.TxnDate = DateTime.UtcNow.Date; + creditMemo.TxnDateSpecified = true; + //creditMemo.DepartmentRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //creditMemo.CurrencyRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //creditMemo.ExchangeRate = new Decimal(100.00); + //creditMemo.ExchangeRateSpecified = true; + //creditMemo.PrivateNote = "PrivateNote"; + //creditMemo.TxnStatus = "TxnStatus"; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //creditMemo.LinkedTxn = linkedTxnList.ToArray(); + + List lineList = new List(); + Line line1 = new Line(); + line1.LineNum = "1"; + line1.Description = "Description"; + line1.Amount = new Decimal(100.00); + line1.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + line1.DetailType = LineDetailTypeEnum.SalesItemLineDetail; + line1.DetailTypeSpecified = true; + //Item item = Helper.FindOrAdd(context, new Item()); + QueryService service1 = new QueryService(context); + var item = service1.ExecuteIdsQuery("select * from Item where Type='Service'").FirstOrDefault(); + DataService.DataService service = new DataService.DataService(context); + var compinfo = service.FindAll(new CompanyInfo()); + + TaxCode taxcode = Helper.FindOrAdd(context, new TaxCode()); + line1.AnyIntuitObject = new SalesItemLineDetail() + { + ItemRef = new ReferenceType() { name = item.Name, Value = item.Id }, + TaxCodeRef = new ReferenceType() { name = taxcode.Name, Value = taxcode.Id } + }; + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //line.LineEx = + Line line2 = new Line(); + line2.Amount = new Decimal(100.00); + line2.DetailType = LineDetailTypeEnum.SubTotalLineDetail; + line2.DetailTypeSpecified = true; + lineList.Add(line1); + lineList.Add(line2); + creditMemo.Line = lineList.ToArray(); + //TxnTaxDetail txnTaxDetail = new TxnTaxDetail(); + //txnTaxDetail.DefaultTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TxnTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TotalTax = new Decimal(100.00); + //txnTaxDetail.TotalTaxSpecified = true; + + //List taxLineList = new List(); + //Line taxLine = new Line(); + //taxLine.LineNum = "LineNum"; + //taxLine.Description = "Description"; + //taxLine.Amount = new Decimal(100.00); + //taxLine.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + //taxLine.DetailType = LineDetailTypeEnum.; + //taxLine.AnyIntuitObject = + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //taxLine.LineEx = + + //taxLineList.Add(taxLine); + //txnTaxDetail.TaxLine = taxLineList.ToArray(); + //creditMemo.TxnTaxDetail = txnTaxDetail; + return creditMemo; + } + + internal static CreditMemo UpdateCreditMemo(ServiceContext context, CreditMemo entity) + { + //update the properties of entity + entity.DocNumber = "UpdatedDocNum" + Helper.GetGuid().Substring(0, 3); ; + entity.TxnDate = DateTime.UtcNow.Date.AddDays(2); + entity.TxnDateSpecified = true; + return entity; + } + + internal static CreditMemo UpdateCreditMemoSparse(ServiceContext context, string Id, string SyncToken) + { + //update the properties of entity + CreditMemo entity = new CreditMemo(); + entity.Id = Id; + entity.SyncToken = SyncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.DocNumber = "UpdatedDocNum" + Helper.GetGuid().Substring(0, 3); ; + entity.TxnDate = DateTime.UtcNow.Date.AddDays(2); + entity.TxnDateSpecified = true; + return entity; + } + + internal static RefundReceipt CreateRefundReceipt(ServiceContext context) + { + RefundReceipt refundReceipt = new RefundReceipt(); + //refundReceipt.RemainingCredit = new Decimal(100.00); + //refundReceipt.RemainingCreditSpecified = true; + ////refundReceipt.RefundReceiptEx = + //refundReceipt.AutoDocNumber = true; + //refundReceipt.AutoDocNumberSpecified = true; + Customer customer = Helper.FindOrAdd(context, new Customer()); + refundReceipt.CustomerRef = new ReferenceType() + { + name = customer.DisplayName, + type = Enum.GetName(typeof(objectNameEnumType), objectNameEnumType.Customer), + Value = customer.Id + }; + //MemoRef customerMemo = new MemoRef(); + //customerMemo.id = "id"; + //customerMemo.Value = "Value"; + //refundReceipt.CustomerMemo = customerMemo; + //PhysicalAddress billAddr = new PhysicalAddress(); + //billAddr.Line1 = "Line1"; + //billAddr.Line2 = "Line2"; + //billAddr.Line3 = "Line3"; + //billAddr.Line4 = "Line4"; + //billAddr.Line5 = "Line5"; + //billAddr.City = "City"; + //billAddr.Country = "Country"; + //billAddr.CountryCode = "CountryCode"; + //billAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //billAddr.PostalCode = "PostalCode"; + //billAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //billAddr.Lat = "Lat"; + //billAddr.Long = "Long"; + //billAddr.Tag = "Tag"; + //billAddr.Note = "Note"; + //refundReceipt.BillAddr = billAddr; + //PhysicalAddress shipAddr = new PhysicalAddress(); + //shipAddr.Line1 = "Line1"; + //shipAddr.Line2 = "Line2"; + //shipAddr.Line3 = "Line3"; + //shipAddr.Line4 = "Line4"; + //shipAddr.Line5 = "Line5"; + //shipAddr.City = "City"; + //shipAddr.Country = "Country"; + //shipAddr.CountryCode = "CountryCode"; + //shipAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //shipAddr.PostalCode = "PostalCode"; + //shipAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //shipAddr.Lat = "Lat"; + //shipAddr.Long = "Long"; + //shipAddr.Tag = "Tag"; + //shipAddr.Note = "Note"; + //refundReceipt.ShipAddr = shipAddr; + //refundReceipt.RemitToRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //refundReceipt.ClassRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //refundReceipt.SalesTermRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //refundReceipt.DueDate = DateTime.UtcNow.Date; + //refundReceipt.DueDateSpecified = true; + //refundReceipt.SalesRepRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //refundReceipt.PONumber = "PONumber"; + //refundReceipt.FOB = "FOB"; + //refundReceipt.ShipMethodRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //refundReceipt.ShipDate = DateTime.UtcNow.Date; + //refundReceipt.ShipDateSpecified = true; + //refundReceipt.TrackingNum = "TrackingNum"; + + //refundReceipt.TotalAmt = new Decimal(100.00); + //refundReceipt.TotalAmtSpecified = true; + //refundReceipt.HomeTotalAmt = new Decimal(100.00); + //refundReceipt.HomeTotalAmtSpecified = true; + + //refundReceipt.GlobalTaxCalculation = GlobalTaxCalculationEnum.TaxInclusive; + //refundReceipt.GlobalTaxCalculationSpecified = true; + refundReceipt.ApplyTaxAfterDiscount = true; + refundReceipt.ApplyTaxAfterDiscountSpecified = true; + //refundReceipt.TemplateRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + refundReceipt.PrintStatus = PrintStatusEnum.NotSet; + refundReceipt.PrintStatusSpecified = true; + //refundReceipt.EmailStatus = EmailStatusEnum.EmailSent; + //refundReceipt.EmailStatusSpecified = true; + EmailAddress billEmail = new EmailAddress(); + billEmail.Address = "Address@Intuit.com"; + billEmail.Default = true; + billEmail.DefaultSpecified = true; + billEmail.Tag = "Tag"; + refundReceipt.BillEmail = billEmail; + //refundReceipt.ARAccountRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //refundReceipt.Balance = new Decimal(100.00); + refundReceipt.BalanceSpecified = true; + //refundReceipt.FinanceCharge = true; + //refundReceipt.FinanceChargeSpecified = true; + //refundReceipt.PaymentMethodRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + refundReceipt.PaymentRefNum = "PaymentRefNum"; + refundReceipt.PaymentType = PaymentTypeEnum.CreditCard; + refundReceipt.PaymentTypeSpecified = true; + //refundReceipt.AnyIntuitObject = + //refundReceipt.DepositToAccountRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + refundReceipt.DocNumber = "DocNumber"; + refundReceipt.TxnDate = DateTime.UtcNow.Date; + refundReceipt.TxnDateSpecified = true; + //refundReceipt.DepartmentRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //refundReceipt.CurrencyRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //refundReceipt.ExchangeRate = new Decimal(100.00); + //refundReceipt.ExchangeRateSpecified = true; + refundReceipt.PrivateNote = "PrivateNote"; + //refundReceipt.TxnStatus = "TxnStatus"; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //refundReceipt.LinkedTxn = linkedTxnList.ToArray(); + + List lineList = new List(); + Line line = new Line(); + + line.Description = "Description12"; + line.Amount = new Decimal(100.00); + line.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + line.DetailType = LineDetailTypeEnum.SalesItemLineDetail; + line.DetailTypeSpecified = true; + //Item item = Helper.FindOrAdd(context, new Item()); + QueryService service1 = new QueryService(context); + var item = service1.ExecuteIdsQuery("select * from Item where Type='Service'").FirstOrDefault(); + TaxCode taxCode = Helper.FindOrAdd(context, new TaxCode()); + line.AnyIntuitObject = new SalesItemLineDetail() + { + ItemRef = new ReferenceType() + { + name = item.Name, + Value = item.Id + }, + TaxCodeRef = new ReferenceType() + { + name = taxCode.Name, + Value = taxCode.Id + } + }; + Line line2 = new Line(); + line2.Amount = new Decimal(100.00); + line2.DetailType = LineDetailTypeEnum.SubTotalLineDetail; + line2.DetailTypeSpecified = true; + line2.AnyIntuitObject = new SubTotalLineDetail() + { + }; + + TxnTaxDetail txnTaxDetail = new TxnTaxDetail(); + txnTaxDetail.TxnTaxCodeRef = new ReferenceType() + { + name = taxCode.Name, + Value = taxCode.Id + + }; + txnTaxDetail.TotalTax = new Decimal(100.00); + txnTaxDetail.TotalTaxSpecified = true; + + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //line.LineEx = + lineList.Add(line); + refundReceipt.Line = lineList.ToArray(); + + + Account account = Helper.FindOrAddAccount(context, AccountTypeEnum.Bank, AccountClassificationEnum.Liability); + refundReceipt.DepositToAccountRef = new ReferenceType() + { + name = account.Name, + Value = account.Id + }; + //txnTaxDetail.DefaultTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + + + //List taxLineList = new List(); + //Line taxLine = new Line(); + //taxLine.LineNum = "LineNum"; + //taxLine.Description = "Description"; + //taxLine.Amount = new Decimal(100.00); + //taxLine.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + //taxLine.DetailType = LineDetailTypeEnum.; + //taxLine.AnyIntuitObject = + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //taxLine.LineEx = + + //taxLineList.Add(taxLine); + //txnTaxDetail.TaxLine = taxLineList.ToArray(); + //refundReceipt.TxnTaxDetail = txnTaxDetail; + return refundReceipt; + } + + + + internal static RefundReceipt UpdateRefundReceipt(ServiceContext context, RefundReceipt entity) + { + entity.PrintStatus = PrintStatusEnum.NeedToPrint; + entity.PrintStatusSpecified = true; + //entity.EmailStatus = EmailStatusEnum.NotSet; + //entity.EmailStatusSpecified = true; + return entity; + } + + + internal static RefundReceipt UpdateRefundReceiptSparse(ServiceContext context, string id, string syncToken) + { + RefundReceipt entity = new RefundReceipt(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.PrintStatus = PrintStatusEnum.NeedToPrint; + entity.PrintStatusSpecified = true; + //entity.EmailStatus = EmailStatusEnum.NotSet; + //entity.EmailStatusSpecified = true; + return entity; + } + + + internal static CompanyCurrency CreateCompanyCurrency(ServiceContext context) + { + CompanyCurrency companyCurrency = new CompanyCurrency(); + + companyCurrency.Active = true; + companyCurrency.ActiveSpecified = true; + + + companyCurrency.Code = "MEM"; + // companyCurrency.Name = "Euro"; + + + //currency.Name = "Name" + Helper.GetGuid().Substring(0, 5); + //currency.Active = true; + //currency.ActiveSpecified = true; + + //currencyCode currencyCode = new currencyCode(); + //currency.Code = currencyCode.AMD; + + //currency.CodeSpecified = true; + //currency.Separator = "Separator" + Helper.GetGuid().Substring(0, 5); + //currency.Format = "####"; + //currency.DecimalPlaces = "DecimalPlaces"; + //currency.DecimalSeparator = ","; + //currency.Symbol = "Symbol"; + //currency.SymbolPosition = SymbolPositionEnum.Leading; + //currency.SymbolPositionSpecified = true; + //currency.UserDefined = true; + //currency.UserDefinedSpecified = true; + //currency.ExchangeRate = new Decimal(100.00); + //currency.ExchangeRateSpecified = true; + //currency.AsOfDate = DateTime.UtcNow.Date; + //currency.AsOfDateSpecified = true; + //currency.CurrencyEx = + return companyCurrency; + } + + + + internal static CompanyCurrency UpdateCompanyCurrency(ServiceContext context, CompanyCurrency entity) + { + //update the properties of entity + entity.Name = "Name_updated" + Helper.GetGuid().Substring(0, 5); + return entity; + } + + + + internal static CompanyCurrency UpdateCompanyCurrencySparse(ServiceContext context, string id, string syncToken) + { + CompanyCurrency entity = new CompanyCurrency(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.Name = "Name_sparseupdated" + Helper.GetGuid().Substring(0, 5); + return entity; + } + + + + + internal static ExchangeRate UpdateExchangeRate(ServiceContext context, ExchangeRate entity) + { + //update the properties of entity + entity.RateSpecified = true; + entity.Rate = 34.00m; + entity.AsOfDateSpecified = true; + entity.AsOfDate = DateTime.Now; + return entity; + } + + + + internal static ExchangeRate UpdateExchangeRateSparse(ServiceContext context, string id, string syncToken) + { + ExchangeRate entity = new ExchangeRate(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.RateSpecified = true; + entity.Rate = 34.00m; + entity.AsOfDateSpecified = true; + entity.AsOfDate = DateTime.Now; + return entity; + } + + internal static SalesRep CreateSalesRep(ServiceContext context) + { + SalesRep salesRep = new SalesRep(); + salesRep.NameOf = SalesRepTypeEnum.Employee; + salesRep.NameOfSpecified = true; + salesRep.Active = true; + salesRep.ActiveSpecified = true; + //salesRep.AnyIntuitObject = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + ItemChoiceType2 itemChoiceType2 = new ItemChoiceType2(); + salesRep.ItemElementName = itemChoiceType2; + + salesRep.Initials = "Initials"; + //salesRep.SalesRepEx = + return salesRep; + } + + + + internal static SalesRep UpdateSalesRep(ServiceContext context, SalesRep entity) + { + //update the properties of entity + entity.Initials = "Initials_updated"; + return entity; + } + + + internal static SalesRep UpdateSalesRepSparse(ServiceContext context, string id, string syncToken) + { + SalesRep entity = new SalesRep(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.Initials = "Initials_updated"; + return entity; + } + + internal static PriceLevel CreatePriceLevel(ServiceContext context) + { + PriceLevel priceLevel = new PriceLevel(); + //priceLevel.Name = object; + //Object object = new Object(); + + priceLevel.Name = "Name" + Helper.GetGuid().Substring(0, 5); + priceLevel.Active = true; + priceLevel.PriceLevelType = PriceLevelTypeEnum.FixedPercentage; + + priceLevel.CurrencyRef = new ReferenceType() + { + name = "United States Dollar", + Value = "USD" + }; + //priceLevel.PriceLevelEx = + return priceLevel; + } + + + + internal static PriceLevel UpdatePriceLevel(ServiceContext context, PriceLevel entity) + { + //update the properties of entity + entity.Name = "updated_name" + Helper.GetGuid().Substring(0, 5); + return entity; + } + + internal static PriceLevel UpdatePriceLevelSparse(ServiceContext context, string id, string syncToken) + { + PriceLevel entity = new PriceLevel(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.Name = "sparseupdated_name" + Helper.GetGuid().Substring(0, 5); + return entity; + } + + + internal static PriceLevelPerItem CreatePriceLevelPerItem(ServiceContext context) + { + PriceLevelPerItem priceLevelPerItem = new PriceLevelPerItem(); + //priceLevelPerItem.ItemRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //priceLevelPerItem.AnyIntuitObject = new Decimal(100.00); + //priceLevelPerItem.ItemElementName = itemChoiceType7; + //ItemChoiceType7 itemChoiceType7 = new ItemChoiceType7(); + + //priceLevelPerItem.PriceLevelPerItemEx = + return priceLevelPerItem; + } + + + + internal static PriceLevelPerItem UpdatePriceLevelPerItem(ServiceContext context, PriceLevelPerItem entity) + { + //update the properties of entity + entity.Overview = "Overview_sparse"; + return entity; + } + + + internal static PriceLevelPerItem UpdatePriceLevelPerItemSparse(ServiceContext context, string id, string syncToken) + { + PriceLevelPerItem entity = new PriceLevelPerItem(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.Overview = "Overview_sparse"; + return entity; + } + + + internal static CustomerMsg CreateCustomerMsg(ServiceContext context) + { + CustomerMsg customerMsg = new CustomerMsg(); + customerMsg.Name = "Name" + Helper.GetGuid().Substring(0, 5); + customerMsg.Active = true; + customerMsg.ActiveSpecified = true; + //customerMsg.CustomerMsgEx = + return customerMsg; + } + + + + internal static CustomerMsg UpdateCustomerMsg(ServiceContext context, CustomerMsg entity) + { + //update the properties of entity + entity.Name = "Name_updated" + Helper.GetGuid().Substring(0, 5); + + return entity; + } + + internal static CustomerMsg UpdateCustomerMsgSparse(ServiceContext context, string id, string syncToken) + { + CustomerMsg entity = new CustomerMsg(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.Name = "Name_updated" + Helper.GetGuid().Substring(0, 5); + + return entity; + } + + + internal static JournalCode CreateJournalCode(ServiceContext context, JournalCodeTypeEnum journalCodeType) + { + JournalCode journalCode = new JournalCode(); + journalCode.Name = "JC" + Helper.GetGuid().Substring(0, 5); + //journalCode.Description = "Desc " + journalCodeType.ToString(); + journalCode.Type = journalCodeType.ToString(); + + return journalCode; + } + + + + internal static JournalEntry CreateJournalEntry(ServiceContext context) + { + JournalEntry journalEntry = new JournalEntry(); + journalEntry.Adjustment = true; + journalEntry.AdjustmentSpecified = true; + //journalEntry.JournalEntryEx = + + journalEntry.DocNumber = "DocNumber" + Helper.GetGuid().Substring(0, 5); + journalEntry.TxnDate = DateTime.UtcNow.Date; + journalEntry.TxnDateSpecified = true; + //journalEntry.DepartmentRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //journalEntry.CurrencyRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //journalEntry.PrivateNote = "PrivateNote"; + //journalEntry.TxnStatus = "TxnStatus"; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //journalEntry.LinkedTxn = linkedTxnList.ToArray(); + + List lineList = new List(); + + Line debitLine = new Line(); + debitLine.Description = "nov portion of rider insurance"; + debitLine.Amount = new Decimal(100.00); + debitLine.AmountSpecified = true; + debitLine.DetailType = LineDetailTypeEnum.JournalEntryLineDetail; + debitLine.DetailTypeSpecified = true; + JournalEntryLineDetail journalEntryLineDetail = new JournalEntryLineDetail(); + journalEntryLineDetail.PostingType = PostingTypeEnum.Debit; + journalEntryLineDetail.PostingTypeSpecified = true; + Account expenseAccount = Helper.FindOrAddAccount(context, AccountTypeEnum.Expense, AccountClassificationEnum.Expense); + journalEntryLineDetail.AccountRef = new ReferenceType() { type = Enum.GetName(typeof(objectNameEnumType), objectNameEnumType.Account), name = expenseAccount.Name, Value = expenseAccount.Id }; + debitLine.AnyIntuitObject = journalEntryLineDetail; + lineList.Add(debitLine); + + Line creditLine = new Line(); + creditLine.Description = "nov portion of rider insurance"; + creditLine.Amount = new Decimal(100.00); + creditLine.AmountSpecified = true; + creditLine.DetailType = LineDetailTypeEnum.JournalEntryLineDetail; + creditLine.DetailTypeSpecified = true; + JournalEntryLineDetail journalEntryLineDetailCredit = new JournalEntryLineDetail(); + journalEntryLineDetailCredit.PostingType = PostingTypeEnum.Credit; + journalEntryLineDetailCredit.PostingTypeSpecified = true; + Account assetAccount = Helper.FindOrAddAccount(context, AccountTypeEnum.OtherCurrentAsset, AccountClassificationEnum.Asset); + journalEntryLineDetailCredit.AccountRef = new ReferenceType() { type = Enum.GetName(typeof(objectNameEnumType), objectNameEnumType.Account), name = assetAccount.Name, Value = assetAccount.Id }; + creditLine.AnyIntuitObject = journalEntryLineDetailCredit; + lineList.Add(creditLine); + + journalEntry.Line = lineList.ToArray(); + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + //line.DetailType = LineDetailTypeEnum.; + //line.AnyIntuitObject = + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //line.LineEx = + //lineList.Add(line); + //journalEntry.Line = lineList.ToArray(); + //TxnTaxDetail txnTaxDetail = new TxnTaxDetail(); + //txnTaxDetail.DefaultTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TxnTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //txnTaxDetail.TotalTax = new Decimal(100.00); + //txnTaxDetail.TotalTaxSpecified = true; + + //List taxLineList = new List(); + //Line taxLine = new Line(); + //taxLine.LineNum = "LineNum"; + //taxLine.Description = "Description"; + //taxLine.Amount = new Decimal(100.00); + //taxLine.AmountSpecified = true; + + //List linkedTxnList = new List(); + //LinkedTxn linkedTxn = new LinkedTxn(); + //linkedTxn.TxnId = "TxnId"; + //linkedTxn.TxnType = "TxnType"; + //linkedTxn.TxnLineId = "TxnLineId"; + //linkedTxnList.Add(linkedTxn); + //line.LinkedTxn = linkedTxnList.ToArray(); + //taxLine.DetailType = LineDetailTypeEnum.; + //taxLine.AnyIntuitObject = + + //List customFieldList = new List(); + //CustomField customField = new CustomField(); + //customField.DefinitionId = "DefinitionId"; + //customField.Name = "Name"; + //customField.Type = CustomFieldTypeEnum.; + //customField.AnyIntuitObject = + //customFieldList.Add(customField); + //line.CustomField = customFieldList.ToArray(); + //taxLine.LineEx = + + //taxLineList.Add(taxLine); + //txnTaxDetail.TaxLine = taxLineList.ToArray(); + //journalEntry.TxnTaxDetail = txnTaxDetail; + return journalEntry; + } + + + internal static JournalCode UpdateJournalCode(ServiceContext context, JournalCode journalCode) + { + //update the properties of JournalCode + journalCode.Description = "Updated" + Helper.GetGuid().Substring(0, 5); + + return journalCode; + } + + internal static JournalCode UpdateJournalCodeSparse(ServiceContext context, string id, string syncToken) + { + JournalCode entity = new JournalCode(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.Name = "JC_Sparse" + Helper.GetGuid().Substring(0, 5); + entity.Description = "sparseupdated" + Helper.GetGuid().Substring(0, 5); + + return entity; + } + + + + internal static JournalEntry UpdateJournalEntry(ServiceContext context, JournalEntry entity) + { + //update the properties of entity + entity.DocNumber = "udpated" + Helper.GetGuid().Substring(0, 5); + + return entity; + } + + + internal static JournalEntry UpdateJournalEntrySparse(ServiceContext context, string id, string syncToken) + { + JournalEntry entity = new JournalEntry(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.DocNumber = "sparseudpated" + Helper.GetGuid().Substring(0, 5); + + return entity; + } + + + + + internal static TimeActivity CreateTimeActivity(ServiceContext context) + { + TimeActivity timeActivity = new TimeActivity(); + //timeActivity.TimeZone = "PST"; + timeActivity.TxnDate = DateTime.UtcNow.Date; + timeActivity.TxnDateSpecified = true; + timeActivity.NameOf = TimeActivityTypeEnum.Vendor; + timeActivity.NameOfSpecified = true; + //OtherName otherName = Helper.FindOrAdd(context, new OtherName()); + //ReferenceType otherNameRef = new ReferenceType(); + //otherNameRef.name = otherName.DisplayName; + //otherNameRef.Value = otherName.Id; + //Employee emp = Helper.FindOrAdd(context, new Employee()); + Vendor vendor = Helper.FindOrAdd(context, new Vendor()); + + timeActivity.AnyIntuitObject = new ReferenceType() { name = vendor.DisplayName, Value = vendor.Id }; + timeActivity.ItemElementName = ItemChoiceType5.VendorRef; + + Customer cust = Helper.FindOrAdd(context, new Customer()); + timeActivity.CustomerRef = new ReferenceType() + { + name = cust.DisplayName, + Value = cust.Id + }; + + Item item = Helper.FindOrAdd(context, new Item()); + timeActivity.ItemRef = new ReferenceType() + { + name = item.Name, + Value = item.Id + }; + + //timeActivity.ClassRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //timeActivity.PayrollItemRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + timeActivity.BillableStatus = BillableStatusEnum.NotBillable; + timeActivity.BillableStatusSpecified = true; + timeActivity.Taxable = false; + timeActivity.TaxableSpecified = true; + timeActivity.HourlyRate = new Decimal(0.00); + timeActivity.HourlyRateSpecified = true; + timeActivity.Hours = 10; + + timeActivity.HoursSpecified = true; + timeActivity.Minutes = 0; + + timeActivity.MinutesSpecified = true; + //timeActivity.BreakHours = int32; + //Int32 int32 = new Int32(); + + //timeActivity.BreakHoursSpecified = true; + //timeActivity.BreakMinutes = int32; + //Int32 int32 = new Int32(); + + //timeActivity.BreakMinutesSpecified = true; + //timeActivity.StartTime = DateTime.UtcNow.Date; + //timeActivity.StartTimeSpecified = true; + //timeActivity.EndTime = DateTime.UtcNow.Date; + //timeActivity.EndTimeSpecified = true; + timeActivity.Description = "Description" + Helper.GetGuid().Substring(0, 5); + //timeActivity.TimeActivityEx = + return timeActivity; + } + + + + internal static TimeActivity UpdateTimeActivity(ServiceContext context, TimeActivity entity) + { + //update the properties of entity + entity.Description = "UpdatedDesc" + Helper.GetGuid().Substring(0, 3); + return entity; + } + + internal static TimeActivity UpdateTimeActivitySparse(ServiceContext context, string Id, string syncToken) + { + //update the properties of entity + TimeActivity entity = new TimeActivity(); + entity.Id = Id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.Description = "UpdatedDesc" + Helper.GetGuid().Substring(0, 3); + return entity; + } + + internal static InventorySite CreateInventorySite(ServiceContext context) + { + InventorySite inventorySite = new InventorySite(); + inventorySite.Name = "Name" + Helper.GetGuid().Substring(0, 5); + inventorySite.Active = true; + inventorySite.ActiveSpecified = true; + inventorySite.DefaultSite = true; + inventorySite.DefaultSiteSpecified = true; + inventorySite.Description = "description about inventory site"; + inventorySite.Contact = "Contact"; + + List addrList = new List(); + PhysicalAddress addr = new PhysicalAddress(); + addr.Line1 = "address_inventory"; + addr.Line2 = "address_inverntory"; + //addr.Line3 = "Line3"; + //addr.Line4 = "Line4"; + //addr.Line5 = "Line5"; + addr.City = "Bangalore"; + addr.Country = "karnataka"; + //addr.CountryCode = "CountryCode"; + //addr.CountrySubDivisionCode = "CountrySubDivisionCode"; + addr.PostalCode = "Code" + Helper.GetGuid().Substring(0, 5); + //addr.PostalCodeSuffix = "PostalCodeSuffix"; + //addr.Lat = "Lat"; + //addr.Long = "Long"; + //addr.Tag = "Tag"; + //addr.Note = "Note"; + addrList.Add(addr); + inventorySite.Addr = addrList.ToArray(); + + //List contactInfoList = new List(); + //ContactInfo contactInfo = new ContactInfo(); + //contactInfo.Type = ContactTypeEnum.; + //contactInfo.TypeSpecified = true; + //contactInfo.AnyIntuitObject = + //contactInfoList.Add(contactInfo); + //inventorySite.ContactInfo = contactInfoList.ToArray(); + //inventorySite.InventorySiteEx = + return inventorySite; + } + + + + internal static InventorySite UpdateInventorySite(ServiceContext context, InventorySite entity) + { + //update the properties of entity + entity.Name = "UPdated" + Helper.GetGuid().Substring(0, 5); + entity.Description = "description" + Helper.GetGuid().Substring(0, 5); + return entity; + } + + + internal static InventorySite UpdateInventorySiteSparse(ServiceContext context, string id, string syncToken) + { + InventorySite entity = new InventorySite(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.Name = "sparseUPdated" + Helper.GetGuid().Substring(0, 5); + entity.Description = "description" + Helper.GetGuid().Substring(0, 5); + return entity; + } + + + internal static ShipMethod CreateShipMethod(ServiceContext context) + { + ShipMethod shipMethod = new ShipMethod(); + shipMethod.Name = "Name" + Helper.GetGuid().Substring(0, 5); ; + shipMethod.Active = true; + //shipMethod.ShipMethodEx = + return shipMethod; + } + + + + internal static ShipMethod UpdateShipMethod(ServiceContext context, ShipMethod entity) + { + //update the properties of entity + entity.Name = "updated" + Helper.GetGuid().Substring(0, 5); + return entity; + } + + + internal static ShipMethod UpdateShipMethodSparse(ServiceContext context, string id, string syncToken) + { + ShipMethod entity = new ShipMethod(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.Name = "updated" + Helper.GetGuid().Substring(0, 5); + return entity; + } + + internal static Task CreateTask(ServiceContext context) + { + Task task = new Task(); + //task.Notes = "Notes"; + task.From = "Quality"; + task.Active = true; + task.ActiveSpecified = true; + task.Done = true; + task.DoneSpecified = true; + task.ReminderDate = DateTime.UtcNow.Date; + task.ReminderDateSpecified = true; + //task.TaskEx = + return task; + } + + + + internal static Task UpdateTask(ServiceContext context, Task entity) + { + //update the properties of entity + entity.From = "Quality"; + return entity; + } + + + + internal static Task UpdateTaskSparse(ServiceContext context, string id, string syncToken) + { + Task entity = new Task(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.From = "Quality"; + return entity; + } + + + + internal static Preferences CreatePreferences(ServiceContext context) + { + Preferences preferences = new Preferences(); + + //CompanyAccountingPrefs accountingInfoPrefs = new CompanyAccountingPrefs(); + // accountingInfoPrefs.UseAccountNumbers = true; + // accountingInfoPrefs.UseAccountNumbersSpecified = true; + + //accountingInfoPrefs.DefaultARAccount = new ReferenceType() + // { + //name = + //type = + //Value = + //}; + //accountingInfoPrefs.DefaultAPAccount = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //accountingInfoPrefs.RequiresAccounts = true; + //accountingInfoPrefs.RequiresAccountsSpecified = true; + //accountingInfoPrefs.TrackDepartments = true; + //accountingInfoPrefs.TrackDepartmentsSpecified = true; + //accountingInfoPrefs.DepartmentTerminology = "DepartmentTerminology"; + //accountingInfoPrefs.ClassTrackingPerTxn = true; + //accountingInfoPrefs.ClassTrackingPerTxnSpecified = true; + //accountingInfoPrefs.ClassTrackingPerTxnLine = true; + //accountingInfoPrefs.ClassTrackingPerTxnLineSpecified = true; + //accountingInfoPrefs.AutoJournalEntryNumber = true; + //accountingInfoPrefs.AutoJournalEntryNumberSpecified = true; + //accountingInfoPrefs.FirstMonthOfFiscalYear = MonthEnum.; + //accountingInfoPrefs.FirstMonthOfFiscalYearSpecified = true; + //accountingInfoPrefs.TaxYearMonth = MonthEnum.; + //accountingInfoPrefs.TaxYearMonthSpecified = true; + //accountingInfoPrefs.TaxForm = "TaxForm"; + //accountingInfoPrefs.BookCloseDate = DateTime.UtcNow.Date; + //accountingInfoPrefs.BookCloseDateSpecified = true; + + //List otherContactInfoList = new List(); + //ContactInfo otherContactInfo = new ContactInfo(); + // otherContactInfo.Type = ContactTypeEnum.TelephoneNumber; + // otherContactInfo.TypeSpecified = true; + // //otherContactInfo.AnyIntuitObject = + //otherContactInfoList.Add(otherContactInfo); + //accountingInfoPrefs.OtherContactInfo = otherContactInfoList.ToArray(); + //accountingInfoPrefs.CustomerTerminology = "CustomerTerminology"; + //preferences.AccountingInfoPrefs = accountingInfoPrefs; + //AdvancedInventoryPrefs advancedInventoryPrefs = new AdvancedInventoryPrefs(); + //advancedInventoryPrefs.MLIAvailable = true; + //advancedInventoryPrefs.MLIAvailableSpecified = true; + //advancedInventoryPrefs.MLIEnabled = true; + //advancedInventoryPrefs.MLIEnabledSpecified = true; + //advancedInventoryPrefs.EnhancedInventoryReceivingEnabled = true; + //advancedInventoryPrefs.EnhancedInventoryReceivingEnabledSpecified = true; + //advancedInventoryPrefs.TrackingSerialOrLotNumber = true; + //advancedInventoryPrefs.TrackingSerialOrLotNumberSpecified = true; + //advancedInventoryPrefs.TrackingOnSalesTransactionsEnabled = true; + //advancedInventoryPrefs.TrackingOnSalesTransactionsEnabledSpecified = true; + //advancedInventoryPrefs.TrackingOnPurchaseTransactionsEnabled = true; + //advancedInventoryPrefs.TrackingOnPurchaseTransactionsEnabledSpecified = true; + //advancedInventoryPrefs.TrackingOnInventoryAdjustmentEnabled = true; + //advancedInventoryPrefs.TrackingOnInventoryAdjustmentEnabledSpecified = true; + //advancedInventoryPrefs.TrackingOnBuildAssemblyEnabled = true; + //advancedInventoryPrefs.TrackingOnBuildAssemblyEnabledSpecified = true; + //advancedInventoryPrefs.FIFOEnabled = true; + //advancedInventoryPrefs.FIFOEnabledSpecified = true; + //advancedInventoryPrefs.FIFOEffectiveDate = DateTime.UtcNow.Date; + //advancedInventoryPrefs.FIFOEffectiveDateSpecified = true; + //advancedInventoryPrefs.RowShelfBinEnabled = true; + //advancedInventoryPrefs.RowShelfBinEnabledSpecified = true; + //advancedInventoryPrefs.BarcodeEnabled = true; + //advancedInventoryPrefs.BarcodeEnabledSpecified = true; + //preferences.AdvancedInventoryPrefs = advancedInventoryPrefs; + ProductAndServicesPrefs productAndServicesPrefs = new ProductAndServicesPrefs(); + productAndServicesPrefs.ForSales = true; + productAndServicesPrefs.ForSalesSpecified = true; + productAndServicesPrefs.ForPurchase = true; + productAndServicesPrefs.ForPurchaseSpecified = true; + productAndServicesPrefs.InventoryAndPurchaseOrder = true; + productAndServicesPrefs.InventoryAndPurchaseOrderSpecified = true; + productAndServicesPrefs.QuantityWithPriceAndRate = true; + productAndServicesPrefs.QuantityWithPriceAndRateSpecified = true; + productAndServicesPrefs.QuantityOnHand = true; + productAndServicesPrefs.QuantityOnHandSpecified = true; + productAndServicesPrefs.UOM = UOMFeatureTypeEnum.SinglePerItem; + productAndServicesPrefs.UOMSpecified = true; + preferences.ProductAndServicesPrefs = productAndServicesPrefs; + SalesFormsPrefs salesFormsPrefs = new SalesFormsPrefs(); + salesFormsPrefs.UsingProgressInvoicing = true; + salesFormsPrefs.UsingProgressInvoicingSpecified = true; + + //List customFieldList = new List(); + //CustomFieldDefinition customField = new CustomFieldDefinition(); + //customField.EntityType = "EntityType"; + //customField.Name = "Name"; + //customField.Hidden = true; + //customField.Required = true; + //customFieldList.Add(customField); + //salesFormsPrefs.CustomField = customFieldList.ToArray(); + salesFormsPrefs.CustomTxnNumbers = true; + salesFormsPrefs.CustomTxnNumbersSpecified = true; + salesFormsPrefs.DelayedCharges = true; + salesFormsPrefs.DelayedChargesSpecified = true; + salesFormsPrefs.AllowDeposit = true; + salesFormsPrefs.AllowDepositSpecified = true; + salesFormsPrefs.AllowDiscount = true; + salesFormsPrefs.AllowDiscountSpecified = true; + salesFormsPrefs.DefaultDiscountAccount = "DefaultDiscountAccount"; + salesFormsPrefs.AllowEstimates = true; + salesFormsPrefs.AllowEstimatesSpecified = true; + salesFormsPrefs.IPNSupportEnabled = true; + salesFormsPrefs.IPNSupportEnabledSpecified = true; + salesFormsPrefs.InvoiceMessage = "InvoiceMessage"; + salesFormsPrefs.AllowServiceDate = true; + salesFormsPrefs.AllowServiceDateSpecified = true; + salesFormsPrefs.AllowShipping = true; + salesFormsPrefs.AllowShippingSpecified = true; + //salesFormsPrefs.DefaultShippingAccount = "DefaultShippingAccount"; + //salesFormsPrefs.DefaultItem = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesFormsPrefs.DefaultTerms = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesFormsPrefs.DefaultDeliveryMethod = "DefaultDeliveryMethod"; + //salesFormsPrefs.AutoApplyCredit = true; + //salesFormsPrefs.AutoApplyCreditSpecified = true; + //salesFormsPrefs.AutoApplyPayments = true; + //salesFormsPrefs.AutoApplyPaymentsSpecified = true; + //salesFormsPrefs.PrintItemWithZeroAmount = true; + //salesFormsPrefs.PrintItemWithZeroAmountSpecified = true; + //salesFormsPrefs.DefaultShipMethodRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //salesFormsPrefs.DefaultMarkup = new Decimal(100.00); + //salesFormsPrefs.DefaultMarkupSpecified = true; + //salesFormsPrefs.TrackReimbursableExpensesAsIncome = true; + //salesFormsPrefs.TrackReimbursableExpensesAsIncomeSpecified = true; + //salesFormsPrefs.UsingSalesOrders = true; + //salesFormsPrefs.UsingSalesOrdersSpecified = true; + //salesFormsPrefs.UsingPriceLevels = true; + //salesFormsPrefs.UsingPriceLevelsSpecified = true; + //salesFormsPrefs.DefaultFOB = "DefaultFOB"; + //salesFormsPrefs.DefaultCustomerMessage = "DefaultCustomerMessage"; + preferences.SalesFormsPrefs = salesFormsPrefs; + + //List emailMessagesPrefsList = new List(); + //NameValue emailMessagesPrefs = new NameValue(); + //emailMessagesPrefs.Name = "Name"; + //emailMessagesPrefs.Value = "Value"; + //emailMessagesPrefsList.Add(emailMessagesPrefs); + //preferences.EmailMessagesPrefs = emailMessagesPrefsList.ToArray(); + + //List printDocumentPrefsList = new List(); + //NameValue printDocumentPrefs = new NameValue(); + //printDocumentPrefs.Name = "Name"; + //printDocumentPrefs.Value = "Value"; + //printDocumentPrefsList.Add(printDocumentPrefs); + //preferences.PrintDocumentPrefs = printDocumentPrefsList.ToArray(); + VendorAndPurchasesPrefs vendorAndPurchasesPrefs = new VendorAndPurchasesPrefs(); + vendorAndPurchasesPrefs.EnableBills = true; + vendorAndPurchasesPrefs.EnableBillsSpecified = true; + vendorAndPurchasesPrefs.TrackingByCustomer = true; + vendorAndPurchasesPrefs.TrackingByCustomerSpecified = true; + vendorAndPurchasesPrefs.BillableExpenseTracking = true; + vendorAndPurchasesPrefs.BillableExpenseTrackingSpecified = true; + //vendorAndPurchasesPrefs.DefaultTerms = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //vendorAndPurchasesPrefs.DefaultMarkup = new Decimal(100.00); + //vendorAndPurchasesPrefs.DefaultMarkupSpecified = true; + //vendorAndPurchasesPrefs.DefaultMarkupAccount = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //vendorAndPurchasesPrefs.AutomaticBillPayment = true; + //vendorAndPurchasesPrefs.AutomaticBillPaymentSpecified = true; + + //List pOCustomFieldList = new List(); + //CustomFieldDefinition pOCustomField = new CustomFieldDefinition(); + //pOCustomField.EntityType = "EntityType"; + //pOCustomField.Name = "Name"; + //pOCustomField.Hidden = true; + //pOCustomField.Required = true; + //pOCustomFieldList.Add(pOCustomField); + //vendorAndPurchasesPrefs.POCustomField = pOCustomFieldList.ToArray(); + //vendorAndPurchasesPrefs.MsgToVendors = "MsgToVendors"; + //vendorAndPurchasesPrefs.UsingInventory = true; + //vendorAndPurchasesPrefs.UsingInventorySpecified = true; + //vendorAndPurchasesPrefs.UsingMultiLocationInventory = true; + //vendorAndPurchasesPrefs.UsingMultiLocationInventorySpecified = true; + //vendorAndPurchasesPrefs.DaysBillsAreDue = int32; + //Int32 int32 = new Int32(); + //vendorAndPurchasesPrefs.DaysBillsAreDueSpecified = true; + //vendorAndPurchasesPrefs.DiscountAccountRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + preferences.VendorAndPurchasesPrefs = vendorAndPurchasesPrefs; + //TimeTrackingPrefs timeTrackingPrefs = new TimeTrackingPrefs(); + //timeTrackingPrefs.UseServices = true; + //timeTrackingPrefs.UseServicesSpecified = true; + //timeTrackingPrefs.DefaultTimeItem = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //timeTrackingPrefs.BillCustomers = true; + //timeTrackingPrefs.BillCustomersSpecified = true; + //timeTrackingPrefs.ShowBillRateToAll = true; + //timeTrackingPrefs.ShowBillRateToAllSpecified = true; + //timeTrackingPrefs.WorkWeekStartDate = WeekEnum.; + //timeTrackingPrefs.WorkWeekStartDateSpecified = true; + //timeTrackingPrefs.TimeTrackingEnabled = true; + //timeTrackingPrefs.TimeTrackingEnabledSpecified = true; + //timeTrackingPrefs.MarkTimeEntriesBillable = true; + //timeTrackingPrefs.MarkTimeEntriesBillableSpecified = true; + //timeTrackingPrefs.MarkExpensesAsBillable = true; + //timeTrackingPrefs.MarkExpensesAsBillableSpecified = true; + //preferences.TimeTrackingPrefs = timeTrackingPrefs; + TaxPrefs taxPrefs = new TaxPrefs(); + taxPrefs.UsingSalesTax = true; + taxPrefs.UsingSalesTaxSpecified = true; + //taxPrefs.AnyIntuitObject = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //taxPrefs.ItemElementName = itemChoiceType3; + //ItemChoiceType3 itemChoiceType3 = new ItemChoiceType3(); + + taxPrefs.PaySalesTax = PaySalesTaxEnum.Annually; + taxPrefs.PaySalesTaxSpecified = true; + //taxPrefs.NonTaxableSalesTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //taxPrefs.TaxableSalesTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + preferences.TaxPrefs = taxPrefs; + //FinanceChargePrefs financeChargesPrefs = new FinanceChargePrefs(); + //financeChargesPrefs.AnnualInterestRate = new Decimal(100.00); + //financeChargesPrefs.AnnualInterestRateSpecified = true; + //financeChargesPrefs.MinFinChrg = new Decimal(100.00); + //financeChargesPrefs.MinFinChrgSpecified = true; + //financeChargesPrefs.GracePeriod = "GracePeriod"; + //financeChargesPrefs.CalcFinChrgFromTxnDate = true; + //financeChargesPrefs.CalcFinChrgFromTxnDateSpecified = true; + //financeChargesPrefs.AssessFinChrgForOverdueCharges = true; + //financeChargesPrefs.AssessFinChrgForOverdueChargesSpecified = true; + //financeChargesPrefs.FinChrgAccountRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //preferences.FinanceChargesPrefs = financeChargesPrefs; + CurrencyPrefs currencyPrefs = new CurrencyPrefs(); + currencyPrefs.MultiCurrencyEnabled = true; + currencyPrefs.MultiCurrencyEnabledSpecified = true; + //currencyPrefs.HomeCurrency = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + preferences.CurrencyPrefs = currencyPrefs; + //ReportPrefs reportPrefs = new ReportPrefs(); + //reportPrefs.ReportBasis = ReportBasisEnum.; + //reportPrefs.ReportBasisSpecified = true; + //reportPrefs.CalcAgingReportFromTxnDate = true; + //reportPrefs.CalcAgingReportFromTxnDateSpecified = true; + //preferences.ReportPrefs = reportPrefs; + + //List otherPrefsList = new List(); + //NameValue otherPrefs = new NameValue(); + //otherPrefs.Name = "Name"; + //otherPrefs.Value = "Value"; + //otherPrefsList.Add(otherPrefs); + //preferences.OtherPrefs = otherPrefsList.ToArray(); + return preferences; + } + + + + internal static Preferences UpdatePreferences(ServiceContext context, Preferences entity) + { + //update the properties of entity + SalesFormsPrefs salesFormsPrefs = new SalesFormsPrefs(); + salesFormsPrefs.UsingProgressInvoicing = true; + salesFormsPrefs.UsingProgressInvoicingSpecified = true; + + + salesFormsPrefs.CustomTxnNumbers = false; + salesFormsPrefs.CustomTxnNumbersSpecified = true; + salesFormsPrefs.AllowDeposit = false; + salesFormsPrefs.AllowDepositSpecified = true; + salesFormsPrefs.AllowDiscount = false; + salesFormsPrefs.AllowDiscountSpecified = true; + salesFormsPrefs.AllowEstimates = true; + salesFormsPrefs.AllowEstimatesSpecified = true; + salesFormsPrefs.IPNSupportEnabled = false; + salesFormsPrefs.IPNSupportEnabledSpecified = true; + + entity.SalesFormsPrefs = salesFormsPrefs; + + //Output only field. Need to set to null for Update operation. + entity.OtherPrefs = null; + + return entity; + } + + + + internal static Preferences SparseUpdatePreferences(ServiceContext context, string Id, string syncToken) + { + Preferences entity = new Preferences(); + entity.Id = Id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + var emailMessagesPrefs = new EmailMessagesPrefs(); + emailMessagesPrefs.InvoiceMessage = new EmailMessage() { Subject = "InvoiceMessage_sparseupdated" }; + + entity.EmailMessagesPrefs = emailMessagesPrefs; + return entity; + } + + + + internal static UOM CreateUOM(ServiceContext context) + { + UOM uOM = new UOM(); + uOM.Name = "Name" + Helper.GetGuid().Substring(0, 5); + uOM.Abbrv = "Abbrv"; + uOM.BaseType = UOMBaseTypeEnum.Area; + uOM.BaseTypeSpecified = true; + + List convUnitList = new List(); + UOMConvUnit convUnit = new UOMConvUnit(); + convUnit.Name = "Name"; + convUnit.Abbrv = "Abbrv"; + convUnit.ConvRatio = new Decimal(50.00); + convUnit.ConvRatioSpecified = true; + convUnitList.Add(convUnit); + uOM.ConvUnit = convUnitList.ToArray(); + return uOM; + } + + + + internal static UOM UpdateUOM(ServiceContext context, UOM entity) + { + //update the properties of entity + entity.Name = "Name" + Helper.GetGuid().Substring(0, 5); + entity.Abbrv = "Abbrv"; + return entity; + } + + internal static UOM UpdateUOMSparse(ServiceContext context, string id, string syncToken) + { + UOM entity = new UOM(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.Name = "Name" + Helper.GetGuid().Substring(0, 5); + entity.Abbrv = "Abbrv"; + return entity; + } + + internal static TemplateName CreateTemplateName(ServiceContext context) + { + TemplateName templateName = new TemplateName(); + templateName.Name = "Name" + Helper.GetGuid().Substring(0, 5); + templateName.Active = true; + templateName.ActiveSpecified = true; + templateName.Type = TemplateTypeEnum.PurchaseOrder; + templateName.TypeSpecified = true; + return templateName; + } + + + + internal static TemplateName UpdateTemplateName(ServiceContext context, TemplateName entity) + { + //update the properties of entity + + entity.Type = TemplateTypeEnum.SalesOrder; + entity.TypeSpecified = true; + return entity; + } + + + internal static TemplateName UpdateTemplateNameSparse(ServiceContext context, string id, string syncToken) + { + TemplateName entity = new TemplateName(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.Type = TemplateTypeEnum.SalesOrder; + entity.TypeSpecified = true; + return entity; + } + + + + internal static Attachable CreateAttachable(ServiceContext context) + { + Attachable attachable = new Attachable(); + //attachable.FileName = "FileName"; + //attachable.FileAccessUri = "FileAccessUri"; + //attachable.TempDownloadUri = "TempDownloadUri"; + //attachable.Size = int64; + //Int64 int64 = new Int64(); + + //attachable.SizeSpecified = true; + //attachable.ContentType = "ContentType"; + //attachable.Category = "Category"; + attachable.Lat = "25.293112341223"; + attachable.Long = "-21.3253249834"; + attachable.PlaceName = "Fake Place"; + attachable.Note = "Attachable note " + Helper.GetGuid().Substring(0, 5); ; + attachable.Tag = "Attachable tag " + Helper.GetGuid().Substring(0, 5); ; + //attachable.ThumbnailFileAccessUri = "ThumbnailFileAccessUri"; + //attachable.ThumbnailTempDownloadUri = "ThumbnailTempDownloadUri"; + //attachable.AttachableEx = + + Customer customer = Helper.FindOrAdd(context, new Customer()); + ReferenceType customerRef = new ReferenceType(); + customerRef.name = customer.DisplayName; + customerRef.Value = customer.Id; + customerRef.type = "Customer"; + + Vendor vendor = Helper.FindOrAdd(context, new Vendor()); + ReferenceType vendorRef = new ReferenceType(); + vendorRef.name = vendor.DisplayName; + vendorRef.Value = vendor.Id; + vendorRef.type = "Vendor"; + + AttachableRef attachableRef1 = new AttachableRef(); + attachableRef1.EntityRef = customerRef; + AttachableRef attachableRef2 = new AttachableRef(); + attachableRef2.EntityRef = vendorRef; + + List list = new List(); + list.Add(attachableRef1); + list.Add(attachableRef2); + + attachable.AttachableRef = list.ToArray(); + return attachable; + } + + internal static Attachable CreateAttachableUpload(ServiceContext context) + { + Attachable attachable = new Attachable(); + //attachable.FileName = "Test.jpg"; + //attachable.FileAccessUri = "FileAccessUri"; + //attachable.TempDownloadUri = "TempDownloadUri"; + //attachable.Size = int64; + //Int64 int64 = new Int64(); + + //attachable.SizeSpecified = true; + //attachable.ContentType = "image/jpeg"; + //attachable.Category = "Category"; + attachable.Lat = "25.293112341223"; + attachable.Long = "-21.3253249834"; + attachable.PlaceName = "Fake Place"; + attachable.Note = "Attachable note " + Helper.GetGuid().Substring(0, 5); ; + attachable.Tag = "Attachable tag " + Helper.GetGuid().Substring(0, 5); ; + //attachable.ThumbnailFileAccessUri = "ThumbnailFileAccessUri"; + //attachable.ThumbnailTempDownloadUri = "ThumbnailTempDownloadUri"; + //attachable.AttachableEx = + + return attachable; + } + + + internal static Attachable UpdateAttachable(ServiceContext context, Attachable entity) + { + //update the properties of entity + entity.Note = "Attachable note " + Helper.GetGuid().Substring(0, 5); ; + entity.Tag = "Attachable tag " + Helper.GetGuid().Substring(0, 5); ; + + return entity; + } + + + internal static Attachable SparseUpdateAttachable(ServiceContext context, string Id, string syncToken) + { + Attachable entity = new Attachable(); + entity.Id = Id; + entity.SyncToken = syncToken; + entity.Note = "Sparse Attachable note " + Helper.GetGuid().Substring(0, 5); ; + entity.Tag = "Sparse Attachable tag " + Helper.GetGuid().Substring(0, 5); ; + + return entity; + } + + + internal static StringTypeCustomFieldDefinition CreateStringTypeCustomFieldDefinition(ServiceContext context) + { + StringTypeCustomFieldDefinition stringTypeCustomFieldDefinition = new StringTypeCustomFieldDefinition(); + //stringTypeCustomFieldDefinition.DefaultString = "DefaultString"; + //stringTypeCustomFieldDefinition.RegularExpression = "RegularExpression"; + //stringTypeCustomFieldDefinition.MaxLength = int32; + //Int32 int32 = new Int32(); + + //stringTypeCustomFieldDefinition.MaxLengthSpecified = true; + //stringTypeCustomFieldDefinition.EntityType = "EntityType"; + //stringTypeCustomFieldDefinition.Name = "Name"; + //stringTypeCustomFieldDefinition.Hidden = true; + //stringTypeCustomFieldDefinition.Required = true; + return stringTypeCustomFieldDefinition; + } + + + + internal static StringTypeCustomFieldDefinition UpdateStringTypeCustomFieldDefinition(ServiceContext context, StringTypeCustomFieldDefinition entity) + { + //update the properties of entity + return entity; + } + + + + internal static NumberTypeCustomFieldDefinition CreateNumberTypeCustomFieldDefinition(ServiceContext context) + { + NumberTypeCustomFieldDefinition numberTypeCustomFieldDefinition = new NumberTypeCustomFieldDefinition(); + //numberTypeCustomFieldDefinition.DefaultValue = new Decimal(100.00); + //numberTypeCustomFieldDefinition.DefaultValueSpecified = true; + //numberTypeCustomFieldDefinition.MinValue = new Decimal(100.00); + //numberTypeCustomFieldDefinition.MinValueSpecified = true; + //numberTypeCustomFieldDefinition.MaxValue = new Decimal(100.00); + //numberTypeCustomFieldDefinition.MaxValueSpecified = true; + //numberTypeCustomFieldDefinition.EntityType = "EntityType"; + //numberTypeCustomFieldDefinition.Name = "Name"; + //numberTypeCustomFieldDefinition.Hidden = true; + //numberTypeCustomFieldDefinition.Required = true; + return numberTypeCustomFieldDefinition; + } + + + + internal static NumberTypeCustomFieldDefinition UpdateNumberTypeCustomFieldDefinition(ServiceContext context, NumberTypeCustomFieldDefinition entity) + { + //update the properties of entity + return entity; + } + + + + internal static DateTypeCustomFieldDefinition CreateDateTypeCustomFieldDefinition(ServiceContext context) + { + DateTypeCustomFieldDefinition dateTypeCustomFieldDefinition = new DateTypeCustomFieldDefinition(); + //dateTypeCustomFieldDefinition.DefaultDate = DateTime.UtcNow.Date; + //dateTypeCustomFieldDefinition.DefaultDateSpecified = true; + //dateTypeCustomFieldDefinition.MinDate = DateTime.UtcNow.Date; + //dateTypeCustomFieldDefinition.MinDateSpecified = true; + //dateTypeCustomFieldDefinition.MaxDate = DateTime.UtcNow.Date; + //dateTypeCustomFieldDefinition.MaxDateSpecified = true; + //dateTypeCustomFieldDefinition.EntityType = "EntityType"; + //dateTypeCustomFieldDefinition.Name = "Name"; + //dateTypeCustomFieldDefinition.Hidden = true; + //dateTypeCustomFieldDefinition.Required = true; + return dateTypeCustomFieldDefinition; + } + + + + internal static DateTypeCustomFieldDefinition UpdateDateTypeCustomFieldDefinition(ServiceContext context, DateTypeCustomFieldDefinition entity) + { + //update the properties of entity + return entity; + } + + + + internal static BooleanTypeCustomFieldDefinition CreateBooleanTypeCustomFieldDefinition(ServiceContext context) + { + BooleanTypeCustomFieldDefinition booleanTypeCustomFieldDefinition = new BooleanTypeCustomFieldDefinition(); + //booleanTypeCustomFieldDefinition.DefaultValue = true; + //booleanTypeCustomFieldDefinition.DefaultValueSpecified = true; + //booleanTypeCustomFieldDefinition.EntityType = "EntityType"; + //booleanTypeCustomFieldDefinition.Name = "Name"; + //booleanTypeCustomFieldDefinition.Hidden = true; + //booleanTypeCustomFieldDefinition.Required = true; + return booleanTypeCustomFieldDefinition; + } + + + + internal static BooleanTypeCustomFieldDefinition UpdateBooleanTypeCustomFieldDefinition(ServiceContext context, BooleanTypeCustomFieldDefinition entity) + { + //update the properties of entity + return entity; + } + + + + internal static NameBase CreateNameBase(ServiceContext context) + { + NameBase nameBase = new NameBase(); + //nameBase.Organization = true; + //nameBase.OrganizationSpecified = true; + //nameBase.Title = "Title"; + //nameBase.GivenName = "GivenName"; + //nameBase.MiddleName = "MiddleName"; + //nameBase.FamilyName = "FamilyName"; + //nameBase.Suffix = "Suffix"; + //nameBase.FullyQualifiedName = "FullyQualifiedName"; + //nameBase.CompanyName = "CompanyName"; + //nameBase.DisplayName = "DisplayName"; + //nameBase.PrintOnCheckName = "PrintOnCheckName"; + //nameBase.UserId = "UserId"; + //nameBase.Active = true; + //nameBase.ActiveSpecified = true; + //TelephoneNumber primaryPhone = new TelephoneNumber(); + //primaryPhone.DeviceType = "DeviceType"; + //primaryPhone.CountryCode = "CountryCode"; + //primaryPhone.AreaCode = "AreaCode"; + //primaryPhone.ExchangeCode = "ExchangeCode"; + //primaryPhone.Extension = "Extension"; + //primaryPhone.FreeFormNumber = "FreeFormNumber"; + //primaryPhone.Default = true; + //primaryPhone.DefaultSpecified = true; + //primaryPhone.Tag = "Tag"; + //nameBase.PrimaryPhone = primaryPhone; + //TelephoneNumber alternatePhone = new TelephoneNumber(); + //alternatePhone.DeviceType = "DeviceType"; + //alternatePhone.CountryCode = "CountryCode"; + //alternatePhone.AreaCode = "AreaCode"; + //alternatePhone.ExchangeCode = "ExchangeCode"; + //alternatePhone.Extension = "Extension"; + //alternatePhone.FreeFormNumber = "FreeFormNumber"; + //alternatePhone.Default = true; + //alternatePhone.DefaultSpecified = true; + //alternatePhone.Tag = "Tag"; + //nameBase.AlternatePhone = alternatePhone; + //TelephoneNumber mobile = new TelephoneNumber(); + //mobile.DeviceType = "DeviceType"; + //mobile.CountryCode = "CountryCode"; + //mobile.AreaCode = "AreaCode"; + //mobile.ExchangeCode = "ExchangeCode"; + //mobile.Extension = "Extension"; + //mobile.FreeFormNumber = "FreeFormNumber"; + //mobile.Default = true; + //mobile.DefaultSpecified = true; + //mobile.Tag = "Tag"; + //nameBase.Mobile = mobile; + //TelephoneNumber fax = new TelephoneNumber(); + //fax.DeviceType = "DeviceType"; + //fax.CountryCode = "CountryCode"; + //fax.AreaCode = "AreaCode"; + //fax.ExchangeCode = "ExchangeCode"; + //fax.Extension = "Extension"; + //fax.FreeFormNumber = "FreeFormNumber"; + //fax.Default = true; + //fax.DefaultSpecified = true; + //fax.Tag = "Tag"; + //nameBase.Fax = fax; + //EmailAddress primaryEmailAddr = new EmailAddress(); + //primaryEmailAddr.Address = "Address"; + //primaryEmailAddr.Default = true; + //primaryEmailAddr.DefaultSpecified = true; + //primaryEmailAddr.Tag = "Tag"; + //nameBase.PrimaryEmailAddr = primaryEmailAddr; + //WebSiteAddress webAddr = new WebSiteAddress(); + //webAddr.URI = "URI"; + //webAddr.Default = true; + //webAddr.DefaultSpecified = true; + //webAddr.Tag = "Tag"; + //nameBase.WebAddr = webAddr; + + //List otherContactInfoList = new List(); + //ContactInfo otherContactInfo = new ContactInfo(); + //otherContactInfo.Type = ContactTypeEnum.; + //otherContactInfo.TypeSpecified = true; + //otherContactInfo.AnyIntuitObject = + //otherContactInfoList.Add(otherContactInfo); + //nameBase.OtherContactInfo = otherContactInfoList.ToArray(); + //nameBase.DefaultTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + return nameBase; + } + + + + internal static NameBase UpdateNameBase(ServiceContext context, NameBase entity) + { + //update the properties of entity + return entity; + } + + + internal static Customer CreateCustomerFrance(ServiceContext context) + { + + String guid = Helper.GetGuid(); + + Customer customer = new Customer(); + customer.Taxable = true; + customer.TaxableSpecified = true; + customer.GivenName = "GivenName"; + customer.MiddleName = "MiddleName"; + customer.FamilyName = "FamilyName"; + customer.FullyQualifiedName = "Name_" + guid; + customer.CompanyName = "CompanyName"; + customer.DisplayName = "Name_" + guid; + + return customer; + } + + + internal static Customer CreateCustomer(ServiceContext context) + { + + String guid = Helper.GetGuid(); + Customer customer = new Customer(); + customer.Taxable = true; + customer.TaxableSpecified = true; + PhysicalAddress billAddr = new PhysicalAddress(); + billAddr.Line1 = "Line1"; + billAddr.Line2 = "Line2"; + billAddr.Line3 = "Line3"; + billAddr.Line4 = "Line4"; + billAddr.Line5 = "Line5"; + billAddr.City = "City"; + billAddr.Country = "Country"; + //billAddr.CountryCode = "IN"; + billAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + billAddr.PostalCode = "PostalCode"; + //billAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //billAddr.Lat = "Lat"; + //billAddr.Long = "Long"; + //billAddr.Tag = "Tag"; + //billAddr.Note = "Note"; + customer.BillAddr = billAddr; + PhysicalAddress shipAddr = new PhysicalAddress(); + shipAddr.Line1 = "Line1"; + shipAddr.Line2 = "Line2"; + shipAddr.Line3 = "Line3"; + shipAddr.Line4 = "Line4"; + shipAddr.Line5 = "Line5"; + shipAddr.City = "City"; + shipAddr.Country = "Country"; + //shipAddr.CountryCode = "IN"; + shipAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + shipAddr.PostalCode = "PostalCode"; + //shipAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //shipAddr.Lat = "Lat"; + //shipAddr.Long = "Long"; + //shipAddr.Tag = "Tag"; + //shipAddr.Note = "Note"; + customer.ShipAddr = shipAddr; + + List otherAddrList = new List(); + PhysicalAddress otherAddr = new PhysicalAddress(); + otherAddr.Line1 = "Line1"; + otherAddr.Line2 = "Line2"; + otherAddr.Line3 = "Line3"; + otherAddr.Line4 = "Line4"; + otherAddr.Line5 = "Line5"; + otherAddr.City = "City"; + otherAddr.Country = "Country"; + //otherAddr.CountryCode = "IN"; + otherAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + otherAddr.PostalCode = "PostalCode"; + //otherAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //otherAddr.Lat = "Lat"; + //otherAddr.Long = "Long"; + //otherAddr.Tag = "Tag"; + //otherAddr.Note = "Note"; + otherAddrList.Add(otherAddr); + customer.OtherAddr = otherAddrList.ToArray(); + //customer.ContactName = "ContactName"; + //customer.AltContactName = "AltContactName"; + customer.Notes = "Notes"; + customer.Job = false; + customer.JobSpecified = true; + customer.BillWithParent = false; + customer.BillWithParentSpecified = true; + //customer.RootCustomerRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //customer.ParentRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //customer.Level = 1; + //customer.LevelSpecified = true; + //customer.CustomerTypeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //customer.SalesTermRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //customer.SalesRepRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //customer.AnyIntuitObject = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //customer.ItemElementName = itemChoiceType4; + //ItemChoiceType4 itemChoiceType4 = new ItemChoiceType4(); + + //customer.PaymentMethodRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //CreditChargeInfo cCDetail = new CreditChargeInfo(); + //cCDetail.Number = "Number"; + //cCDetail.Type = "Type"; + //cCDetail.NameOnAcct = "NameOnAcct"; + //cCDetail.CcExpiryMonth = int32; + //Int32 int32 = new Int32(); + //cCDetail.CcExpiryMonthSpecified = true; + //cCDetail.CcExpiryYear = int32; + //Int32 int32 = new Int32(); + //cCDetail.CcExpiryYearSpecified = true; + //cCDetail.BillAddrStreet = "BillAddrStreet"; + //cCDetail.PostalCode = "PostalCode"; + //cCDetail.CommercialCardCode = "CommercialCardCode"; + //cCDetail.CCTxnMode = CCTxnModeEnum.; + //cCDetail.CCTxnModeSpecified = true; + //cCDetail.CCTxnType = CCTxnTypeEnum.; + //cCDetail.CCTxnTypeSpecified = true; + //cCDetail.PrevCCTransId = "PrevCCTransId"; + //cCDetail.CreditCardChargeInfoEx = + + //customer.CCDetail = cCDetail; + //customer.PriceLevelRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + customer.Balance = new Decimal(100.00); + customer.BalanceSpecified = true; + //customer.OpenBalanceDate = DateTime.UtcNow.Date; + //customer.OpenBalanceDateSpecified = true; + customer.BalanceWithJobs = new Decimal(100.00); + customer.BalanceWithJobsSpecified = true; + //customer.CreditLimit = new Decimal(100.00); + //customer.CreditLimitSpecified = true; + //customer.AcctNum = "AcctNum"; + //customer.CurrencyRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //customer.OverDueBalance = new Decimal(100.00); + //customer.OverDueBalanceSpecified = true; + //customer.TotalRevenue = new Decimal(100.00); + //customer.TotalRevenueSpecified = true; + //customer.TotalExpense = new Decimal(100.00); + //customer.TotalExpenseSpecified = true; + customer.PreferredDeliveryMethod = "Print"; + customer.ResaleNum = "ResaleNum"; + //JobInfo jobInfo = new JobInfo(); + //jobInfo.Status = JobStatusEnum.Pending; + //jobInfo.StatusSpecified = true; + //jobInfo.StartDate = DateTime.UtcNow.Date; + //jobInfo.StartDateSpecified = true; + //jobInfo.ProjectedEndDate = DateTime.UtcNow.Date; + //jobInfo.ProjectedEndDateSpecified = true; + //jobInfo.EndDate = DateTime.UtcNow.Date; + //jobInfo.EndDateSpecified = true; + //jobInfo.Description = "Description"; + //jobInfo.JobTypeRef = new ReferenceType() + //{ + // name = + // type = + // Value = + //}; + //customer.JobInfo = jobInfo; + //customer.CustomerEx = + + //customer.Organization = true; + //customer.OrganizationSpecified = true; + customer.Title = "Title"; + customer.GivenName = "GivenName"; + customer.MiddleName = "MiddleName"; + customer.FamilyName = "FamilyName"; + customer.Suffix = "Suffix"; + customer.FullyQualifiedName = "Name_" + guid; + customer.CompanyName = "CompanyName"; + customer.DisplayName = "Name_" + guid; + customer.PrintOnCheckName = "PrintOnCheckName"; + //customer.UserId = "UserId"; + customer.Active = true; + customer.ActiveSpecified = true; + TelephoneNumber primaryPhone = new TelephoneNumber(); + //primaryPhone.DeviceType = "DeviceType"; + //primaryPhone.CountryCode = "CountryCode"; + //primaryPhone.AreaCode = "AreaCode"; + //primaryPhone.ExchangeCode = "ExchangeCode"; + //primaryPhone.Extension = "Extension"; + primaryPhone.FreeFormNumber = "FreeFormNumber"; + //primaryPhone.Default = true; + //primaryPhone.DefaultSpecified = true; + //primaryPhone.Tag = "Tag"; + customer.PrimaryPhone = primaryPhone; + TelephoneNumber alternatePhone = new TelephoneNumber(); + //alternatePhone.DeviceType = "DeviceType"; + //alternatePhone.CountryCode = "CountryCode"; + //alternatePhone.AreaCode = "AreaCode"; + //alternatePhone.ExchangeCode = "ExchangeCode"; + //alternatePhone.Extension = "Extension"; + alternatePhone.FreeFormNumber = "FreeFormNumber"; + //alternatePhone.Default = true; + //alternatePhone.DefaultSpecified = true; + //alternatePhone.Tag = "Tag"; + customer.AlternatePhone = alternatePhone; + TelephoneNumber mobile = new TelephoneNumber(); + //mobile.DeviceType = "DeviceType"; + //mobile.CountryCode = "CountryCode"; + //mobile.AreaCode = "AreaCode"; + //mobile.ExchangeCode = "ExchangeCode"; + //mobile.Extension = "Extension"; + mobile.FreeFormNumber = "FreeFormNumber"; + //mobile.Default = true; + //mobile.DefaultSpecified = true; + //mobile.Tag = "Tag"; + customer.Mobile = mobile; + TelephoneNumber fax = new TelephoneNumber(); + //fax.DeviceType = "DeviceType"; + //fax.CountryCode = "CountryCode"; + //fax.AreaCode = "AreaCode"; + //fax.ExchangeCode = "ExchangeCode"; + //fax.Extension = "Extension"; + fax.FreeFormNumber = "FreeFormNumber"; + //fax.Default = true; + //fax.DefaultSpecified = true; + //fax.Tag = "Tag"; + customer.Fax = fax; + EmailAddress primaryEmailAddr = new EmailAddress(); + primaryEmailAddr.Address = "test@tesing.com"; + //primaryEmailAddr.Default = true; + //primaryEmailAddr.DefaultSpecified = true; + //primaryEmailAddr.Tag = "Tag"; + customer.PrimaryEmailAddr = primaryEmailAddr; + WebSiteAddress webAddr = new WebSiteAddress(); + webAddr.URI = "http://uri.com"; + //webAddr.Default = true; + //webAddr.DefaultSpecified = true; + //webAddr.Tag = "Tag"; + customer.WebAddr = webAddr; + + //List otherContactInfoList = new List(); + //ContactInfo otherContactInfo = new ContactInfo(); + //otherContactInfo.Type = ContactTypeEnum.EmailAddress; + //otherContactInfo.TypeSpecified = true; + //otherContactInfo.AnyIntuitObject = new EmailAddress() { Address = "address@domain.com" }; + + //otherContactInfoList.Add(otherContactInfo); + //customer.OtherContactInfo = otherContactInfoList.ToArray(); + //customer.DefaultTaxCodeRef = new ReferenceType() + //{ + // name = + // type = + // Value = + //}; + return customer; + } + + + + internal static Customer UpdateCustomer(ServiceContext context, Customer entity) + { + //update the properties of entity + entity.GivenName = "ChangedName"; + entity.Taxable = true; + entity.TaxableSpecified = true; + return entity; + } + + + internal static Customer UpdateCustomerFrance(ServiceContext context, Customer entity) + { + //update the properties of entity + entity.GivenName = "ChangedName"; + entity.ARAccountRef = new ReferenceType() + { + Value = "13" + }; + return entity; + } + + internal static Customer SparseUpdateCustomer(ServiceContext context, string Id, string syncToken) + { + Customer entity = new Customer(); + entity.Id = Id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.MiddleName = "Sparse" + Helper.GetGuid().Substring(0, 5); + return entity; + } + + + internal static User CreateUser(ServiceContext context) + { + User user = new User(); + user.DisplayName = "DisplayName" + Helper.GetGuid().Substring(0, 5); + user.Title = "Title" + Helper.GetGuid().Substring(0, 5); + user.GivenName = "GivenName" + Helper.GetGuid().Substring(0, 5); + user.MiddleName = "MiddleName" + Helper.GetGuid().Substring(0, 5); + user.FamilyName = "FamilyName" + Helper.GetGuid().Substring(0, 5); + user.Suffix = "Mr/Ms"; + + List emailAddrList = new List(); + EmailAddress emailAddr = new EmailAddress(); + emailAddr.Address = "Address"; + emailAddr.Default = true; + emailAddr.DefaultSpecified = true; + emailAddr.Tag = "Tag"; + emailAddrList.Add(emailAddr); + user.EmailAddr = emailAddrList.ToArray(); + + //List addrList = new List(); + //PhysicalAddress addr = new PhysicalAddress(); + //addr.Line1 = "Line1"; + //addr.Line2 = "Line2"; + //addr.Line3 = "Line3"; + //addr.Line4 = "Line4"; + //addr.Line5 = "Line5"; + //addr.City = "City"; + //addr.Country = "Country"; + //addr.CountryCode = "CountryCode"; + //addr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //addr.PostalCode = "PostalCode"; + //addr.PostalCodeSuffix = "PostalCodeSuffix"; + //addr.Lat = "Lat"; + //addr.Long = "Long"; + //addr.Tag = "Tag"; + //addr.Note = "Note"; + //addrList.Add(addr); + //user.Addr = addrList.ToArray(); + + //List phoneNumberList = new List(); + //TelephoneNumber phoneNumber = new TelephoneNumber(); + //phoneNumber.DeviceType = "DeviceType"; + //phoneNumber.CountryCode = "CountryCode"; + //phoneNumber.AreaCode = "AreaCode"; + //phoneNumber.ExchangeCode = "ExchangeCode"; + //phoneNumber.Extension = "Extension"; + //phoneNumber.FreeFormNumber = "FreeFormNumber"; + //phoneNumber.Default = true; + //phoneNumber.DefaultSpecified = true; + //phoneNumber.Tag = "Tag"; + //phoneNumberList.Add(phoneNumber); + //user.PhoneNumber = phoneNumberList.ToArray(); + //user.LocaleCountry = "LocaleCountry"; + //user.LocaleLanguage = "LocaleLanguage"; + //user.LocalePostalCode = "LocalePostalCode"; + //user.LocaleTimeZone = "LocaleTimeZone"; + + //List nameValueAttrList = new List(); + //NameValue nameValueAttr = new NameValue(); + //nameValueAttr.Name = "Name"; + //nameValueAttr.Value = "Value"; + //nameValueAttrList.Add(nameValueAttr); + //user.NameValueAttr = nameValueAttrList.ToArray(); + return user; + } + + + + internal static User UpdateUser(ServiceContext context, User entity) + { + //update the properties of entity + + entity.DisplayName = "Updated" + Helper.GetGuid().Substring(0, 5); + entity.Title = "Updated" + Helper.GetGuid().Substring(0, 5); + entity.GivenName = "Updated" + Helper.GetGuid().Substring(0, 5); + entity.MiddleName = "Updated" + Helper.GetGuid().Substring(0, 5); + entity.FamilyName = "Updated" + Helper.GetGuid().Substring(0, 5); + entity.Suffix = "Mr/Ms."; + return entity; + } + + + internal static User UpdateUserSparse(ServiceContext context, string id, string syncToken) + { + User entity = new User(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.DisplayName = "Updated" + Helper.GetGuid().Substring(0, 5); + entity.Title = "Updated" + Helper.GetGuid().Substring(0, 5); + entity.GivenName = "Updated" + Helper.GetGuid().Substring(0, 5); + entity.MiddleName = "Updated" + Helper.GetGuid().Substring(0, 5); + entity.FamilyName = "Updated" + Helper.GetGuid().Substring(0, 5); + entity.Suffix = "Mr/Ms."; + return entity; + } + + internal static Vendor CreateVendor(ServiceContext context) + { + Vendor vendor = new Vendor(); + //vendor.ContactName = "ContactName"; //Service is not returning back + //vendor.AltContactName = "AltContactName"; //Service is not returning back + //vendor.Notes = "Notes"; //Service is not returning back + PhysicalAddress billAddr = new PhysicalAddress(); + billAddr.Line1 = "Line1"; + billAddr.Line2 = "Line2"; + billAddr.Line3 = "Line3"; + billAddr.Line4 = "Line4"; + billAddr.Line5 = "Line5"; + billAddr.City = "City"; + billAddr.Country = "Country"; + //billAddr.CountryCode = "CountryCode"; //Service is not returning back + billAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + billAddr.PostalCode = "PostalCode"; + //billAddr.PostalCodeSuffix = "PostalCodeSuffix"; //Service is not returning back + //billAddr.Lat = "12"; //Service returning INVALID + //billAddr.Long = "12"; //Service returning INVALID + //billAddr.Tag = "Tag"; + //billAddr.Note = "Note"; + vendor.BillAddr = billAddr; + ////shipAddr is not returned by service + //PhysicalAddress shipAddr = new PhysicalAddress(); + // shipAddr.Line1 = "Line1"; + // shipAddr.Line2 = "Line2"; + // shipAddr.Line3 = "Line3"; + // shipAddr.Line4 = "Line4"; + // shipAddr.Line5 = "Line5"; + // shipAddr.City = "City"; + // shipAddr.Country = "Country"; + // shipAddr.CountryCode = "CountryCode"; + // shipAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + // shipAddr.PostalCode = "PostalCode"; + // shipAddr.PostalCodeSuffix = "PostalCodeSuffix"; + // shipAddr.Lat = "12"; + // shipAddr.Long = "12"; + // shipAddr.Tag = "Tag"; + // shipAddr.Note = "Note"; + //vendor.ShipAddr = shipAddr; + + ////otherAddr is not returned by service + //List otherAddrList = new List(); + //PhysicalAddress otherAddr = new PhysicalAddress(); + // otherAddr.Line1 = "Line1"; + // otherAddr.Line2 = "Line2"; + // otherAddr.Line3 = "Line3"; + // otherAddr.Line4 = "Line4"; + // otherAddr.Line5 = "Line5"; + // otherAddr.City = "City"; + // otherAddr.Country = "Country"; + // otherAddr.CountryCode = "CountryCode"; + // otherAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + // otherAddr.PostalCode = "PostalCode"; + // //otherAddr.PostalCodeSuffix = "PostalCodeSuffix"; //Service is not returning back + // otherAddr.Lat = "Lat"; + // otherAddr.Long = "Long"; + // otherAddr.Tag = "12"; + // otherAddr.Note = "12"; + //otherAddrList.Add(otherAddr); + //vendor.OtherAddr = otherAddrList.ToArray(); + //vendor.TaxCountry = "TaxCountry"; //Service is not returning back + vendor.TaxIdentifier = "TaxIdentifier"; + //vendor.BusinessNumber = "BusinessNumber"; //Service is not returning back + //vendor.ParentRef = new ReferenceType() + //{ + // name = + // type = + // Value = + //}; + //vendor.VendorTypeRef = new ReferenceType() + //{ + // name = + // type = + // Value = + //}; + //Term term = Helper.FindOrAdd(context, new Term()); + //vendor.TermRef = new ReferenceType() + //{ + // name = term.Name, + // //type = + // Value = term.Id + //}; + //vendor.PrefillAccountRef = new ReferenceType() + //{ + // name = + // type = + // Value = + //}; + vendor.Balance = new Decimal(100.00); + vendor.BalanceSpecified = true; + vendor.OpenBalanceDate = DateTime.UtcNow.Date; + vendor.OpenBalanceDateSpecified = true; + //vendor.CreditLimit = new Decimal(100.00); //Service is not returning back + //vendor.CreditLimitSpecified = true; + vendor.AcctNum = "AcctNum"; + vendor.Vendor1099 = true; + vendor.Vendor1099Specified = true; + //vendor.T4AEligible = true; //Service is not returning back + //vendor.T4AEligibleSpecified = true; + //vendor.T5018Eligible = true; //Service is not returning back + //vendor.T5018EligibleSpecified = true; + //vendor.CurrencyRef = new ReferenceType() + //{ + // name = + // type = + // Value = + //}; + //vendor.VendorEx = + //vendor.Organization = true; //Service is not returning back + //vendor.OrganizationSpecified = true; + vendor.Title = "Title"; + vendor.GivenName = "GivenName"; + vendor.MiddleName = "MiddleName"; + vendor.FamilyName = "FamilyName"; + vendor.Suffix = "Suffix"; + //vendor.FullyQualifiedName = "FullyQualifiedName"; //Service is not returning back + vendor.CompanyName = "CompanyName"; + vendor.DisplayName = "DisplayName_" + Helper.GetGuid(); + vendor.PrintOnCheckName = "PrintOnCheckName"; + //vendor.UserId = "UserId"; //Service is not returning back + vendor.Active = true; + vendor.ActiveSpecified = true; + TelephoneNumber primaryPhone = new TelephoneNumber(); + //primaryPhone.DeviceType = "DeviceType"; //Service is not returning back + //primaryPhone.CountryCode = "CountryCode"; //Service is not returning back + //primaryPhone.AreaCode = "AreaCode"; //Service is not returning back + //primaryPhone.ExchangeCode = "ExchangeCode"; //Service is not returning back + //primaryPhone.Extension = "Extension"; //Service is not returning back + primaryPhone.FreeFormNumber = "FreeFormNumber"; + //primaryPhone.Default = true; //Service is not returning back + //primaryPhone.DefaultSpecified = true; //Service is not returning back + //primaryPhone.Tag = "Tag"; //Service is not returning back + vendor.PrimaryPhone = primaryPhone; + TelephoneNumber alternatePhone = new TelephoneNumber(); + //alternatePhone.DeviceType = "DeviceType"; //Service is not returning back + //alternatePhone.CountryCode = "CountryCode"; //Service is not returning back + //alternatePhone.AreaCode = "AreaCode"; //Service is not returning back + //alternatePhone.ExchangeCode = "ExchangeCode"; //Service is not returning back + //alternatePhone.Extension = "Extension"; //Service is not returning back + alternatePhone.FreeFormNumber = "FreeFormNumber"; + //alternatePhone.Default = true; //Service is not returning back + //alternatePhone.DefaultSpecified = true; //Service is not returning back + //alternatePhone.Tag = "Tag"; //Service is not returning back + vendor.AlternatePhone = alternatePhone; + TelephoneNumber mobile = new TelephoneNumber(); + //mobile.DeviceType = "DeviceType"; //Service is not returning back + //mobile.CountryCode = "CountryCode"; //Service is not returning back + //mobile.AreaCode = "AreaCode"; //Service is not returning back + //mobile.ExchangeCode = "ExchangeCode"; //Service is not returning back + //mobile.Extension = "Extension"; //Service is not returning back + mobile.FreeFormNumber = "FreeFormNumber"; + //mobile.Default = true; //Service is not returning back + //mobile.DefaultSpecified = true; //Service is not returning back + //mobile.Tag = "Tag"; //Service is not returning back + vendor.Mobile = mobile; + TelephoneNumber fax = new TelephoneNumber(); + //fax.DeviceType = "DeviceType"; + //fax.CountryCode = "CountryCode"; + //fax.AreaCode = "AreaCode"; + //fax.ExchangeCode = "ExchangeCode"; + //fax.Extension = "Extension"; + fax.FreeFormNumber = "FreeFormNumber"; + //fax.Default = true; + //fax.DefaultSpecified = true; + //fax.Tag = "Tag"; + vendor.Fax = fax; + EmailAddress primaryEmailAddr = new EmailAddress(); + primaryEmailAddr.Address = "Address@add.com"; + //primaryEmailAddr.Default = true; + //primaryEmailAddr.DefaultSpecified = true; + //primaryEmailAddr.Tag = "Tag"; + vendor.PrimaryEmailAddr = primaryEmailAddr; + WebSiteAddress webAddr = new WebSiteAddress(); + webAddr.URI = "http://site.com"; + //webAddr.Default = true; + //webAddr.DefaultSpecified = true; + //webAddr.Tag = "Tag"; + vendor.WebAddr = webAddr; + + //List otherContactInfoList = new List(); + //ContactInfo otherContactInfo = new ContactInfo(); + // otherContactInfo.Type = ContactTypeEnum.EmailAddress; + // otherContactInfo.TypeSpecified = true; + // otherContactInfo.AnyIntuitObject = + //otherContactInfoList.Add(otherContactInfo); + //vendor.OtherContactInfo = otherContactInfoList.ToArray(); + //vendor.DefaultTaxCodeRef = new ReferenceType() + //{ + // name = + // type = + // Value = + //}; + return vendor; + } + + + internal static Vendor CreateVendorFrance(ServiceContext context) + { + Vendor vendor = new Vendor(); + //vendor.ContactName = "ContactName"; //Service is not returning back + //vendor.AltContactName = "AltContactName"; //Service is not returning back + //vendor.Notes = "Notes"; //Service is not returning back + PhysicalAddress billAddr = new PhysicalAddress(); + billAddr.Line1 = "Line1"; + billAddr.Line2 = "Line2"; + billAddr.Line3 = "Line3"; + billAddr.Line4 = "Line4"; + billAddr.Line5 = "Line5"; + billAddr.City = "City"; + billAddr.Country = "Country"; + //billAddr.CountryCode = "CountryCode"; //Service is not returning back + billAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + billAddr.PostalCode = "PostalCode"; + //billAddr.PostalCodeSuffix = "PostalCodeSuffix"; //Service is not returning back + //billAddr.Lat = "12"; //Service returning INVALID + //billAddr.Long = "12"; //Service returning INVALID + //billAddr.Tag = "Tag"; + //billAddr.Note = "Note"; + vendor.BillAddr = billAddr; + ////shipAddr is not returned by service + //PhysicalAddress shipAddr = new PhysicalAddress(); + // shipAddr.Line1 = "Line1"; + // shipAddr.Line2 = "Line2"; + // shipAddr.Line3 = "Line3"; + // shipAddr.Line4 = "Line4"; + // shipAddr.Line5 = "Line5"; + // shipAddr.City = "City"; + // shipAddr.Country = "Country"; + // shipAddr.CountryCode = "CountryCode"; + // shipAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + // shipAddr.PostalCode = "PostalCode"; + // shipAddr.PostalCodeSuffix = "PostalCodeSuffix"; + // shipAddr.Lat = "12"; + // shipAddr.Long = "12"; + // shipAddr.Tag = "Tag"; + // shipAddr.Note = "Note"; + //vendor.ShipAddr = shipAddr; + + ////otherAddr is not returned by service + //List otherAddrList = new List(); + //PhysicalAddress otherAddr = new PhysicalAddress(); + // otherAddr.Line1 = "Line1"; + // otherAddr.Line2 = "Line2"; + // otherAddr.Line3 = "Line3"; + // otherAddr.Line4 = "Line4"; + // otherAddr.Line5 = "Line5"; + // otherAddr.City = "City"; + // otherAddr.Country = "Country"; + // otherAddr.CountryCode = "CountryCode"; + // otherAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + // otherAddr.PostalCode = "PostalCode"; + // //otherAddr.PostalCodeSuffix = "PostalCodeSuffix"; //Service is not returning back + // otherAddr.Lat = "Lat"; + // otherAddr.Long = "Long"; + // otherAddr.Tag = "12"; + // otherAddr.Note = "12"; + //otherAddrList.Add(otherAddr); + //vendor.OtherAddr = otherAddrList.ToArray(); + //vendor.TaxCountry = "TaxCountry"; //Service is not returning back + // vendor.TaxIdentifier = "TaxIdentifier"; + //vendor.BusinessNumber = "BusinessNumber"; //Service is not returning back + //vendor.ParentRef = new ReferenceType() + //{ + // name = + // type = + // Value = + //}; + //vendor.VendorTypeRef = new ReferenceType() + //{ + // name = + // type = + // Value = + //}; + //Term term = Helper.FindOrAdd(context, new Term()); + //vendor.TermRef = new ReferenceType() + //{ + // name = term.Name, + // //type = + // Value = term.Id + //}; + //vendor.PrefillAccountRef = new ReferenceType() + //{ + // name = + // type = + // Value = + //}; + // vendor.Balance = new Decimal(100.00); + // vendor.BalanceSpecified = true; + //vendor.OpenBalanceDate = DateTime.UtcNow.Date; + //vendor.OpenBalanceDateSpecified = true; + //vendor.CreditLimit = new Decimal(100.00); //Service is not returning back + //vendor.CreditLimitSpecified = true; + //vendor.AcctNum = "AcctNum"; + //vendor.Vendor1099 = true; + //vendor.Vendor1099Specified = true; + //vendor.T4AEligible = true; //Service is not returning back + //vendor.T4AEligibleSpecified = true; + //vendor.T5018Eligible = true; //Service is not returning back + //vendor.T5018EligibleSpecified = true; + //vendor.CurrencyRef = new ReferenceType() + //{ + // name = + // type = + // Value = + //}; + //vendor.VendorEx = + //vendor.Organization = true; //Service is not returning back + //vendor.OrganizationSpecified = true; + vendor.Title = "Title"; + vendor.GivenName = "GivenName"; + vendor.MiddleName = "MiddleName"; + vendor.FamilyName = "FamilyName"; + vendor.Suffix = "Suffix"; + //vendor.FullyQualifiedName = "FullyQualifiedName"; //Service is not returning back + //vendor.CompanyName = "CompanyName"; + vendor.DisplayName = "DisplayName_" + Helper.GetGuid(); + //vendor.PrintOnCheckName = "PrintOnCheckName"; + //vendor.UserId = "UserId"; //Service is not returning back + //vendor.Active = true; + //vendor.ActiveSpecified = true; + //TelephoneNumber primaryPhone = new TelephoneNumber(); + //primaryPhone.DeviceType = "DeviceType"; //Service is not returning back + //primaryPhone.CountryCode = "CountryCode"; //Service is not returning back + //primaryPhone.AreaCode = "AreaCode"; //Service is not returning back + //primaryPhone.ExchangeCode = "ExchangeCode"; //Service is not returning back + //primaryPhone.Extension = "Extension"; //Service is not returning back + //primaryPhone.FreeFormNumber = "FreeFormNumber"; + //primaryPhone.Default = true; //Service is not returning back + //primaryPhone.DefaultSpecified = true; //Service is not returning back + //primaryPhone.Tag = "Tag"; //Service is not returning back + //vendor.PrimaryPhone = primaryPhone; + //TelephoneNumber alternatePhone = new TelephoneNumber(); + //alternatePhone.DeviceType = "DeviceType"; //Service is not returning back + //alternatePhone.CountryCode = "CountryCode"; //Service is not returning back + //alternatePhone.AreaCode = "AreaCode"; //Service is not returning back + //alternatePhone.ExchangeCode = "ExchangeCode"; //Service is not returning back + //alternatePhone.Extension = "Extension"; //Service is not returning back + //alternatePhone.FreeFormNumber = "FreeFormNumber"; + //alternatePhone.Default = true; //Service is not returning back + //alternatePhone.DefaultSpecified = true; //Service is not returning back + //alternatePhone.Tag = "Tag"; //Service is not returning back + //vendor.AlternatePhone = alternatePhone; + //TelephoneNumber mobile = new TelephoneNumber(); + //mobile.DeviceType = "DeviceType"; //Service is not returning back + //mobile.CountryCode = "CountryCode"; //Service is not returning back + //mobile.AreaCode = "AreaCode"; //Service is not returning back + //mobile.ExchangeCode = "ExchangeCode"; //Service is not returning back + //mobile.Extension = "Extension"; //Service is not returning back + //mobile.FreeFormNumber = "FreeFormNumber"; + //mobile.Default = true; //Service is not returning back + //mobile.DefaultSpecified = true; //Service is not returning back + //mobile.Tag = "Tag"; //Service is not returning back + //vendor.Mobile = mobile; + //TelephoneNumber fax = new TelephoneNumber(); + //fax.DeviceType = "DeviceType"; + //fax.CountryCode = "CountryCode"; + //fax.AreaCode = "AreaCode"; + //fax.ExchangeCode = "ExchangeCode"; + //fax.Extension = "Extension"; + //fax.FreeFormNumber = "FreeFormNumber"; + //fax.Default = true; + //fax.DefaultSpecified = true; + //fax.Tag = "Tag"; + //vendor.Fax = fax; + //EmailAddress primaryEmailAddr = new EmailAddress(); + //primaryEmailAddr.Address = "Address@add.com"; + //primaryEmailAddr.Default = true; + //primaryEmailAddr.DefaultSpecified = true; + //primaryEmailAddr.Tag = "Tag"; + //vendor.PrimaryEmailAddr = primaryEmailAddr; + //WebSiteAddress webAddr = new WebSiteAddress(); + //webAddr.URI = "http://site.com"; + //webAddr.Default = true; + //webAddr.DefaultSpecified = true; + //webAddr.Tag = "Tag"; + //vendor.WebAddr = webAddr; + + //List otherContactInfoList = new List(); + //ContactInfo otherContactInfo = new ContactInfo(); + // otherContactInfo.Type = ContactTypeEnum.EmailAddress; + // otherContactInfo.TypeSpecified = true; + // otherContactInfo.AnyIntuitObject = + //otherContactInfoList.Add(otherContactInfo); + //vendor.OtherContactInfo = otherContactInfoList.ToArray(); + //vendor.DefaultTaxCodeRef = new ReferenceType() + //{ + // name = + // type = + // Value = + //}; + return vendor; + } + + + internal static Vendor UpdateVendor(ServiceContext context, Vendor entity) + { + entity.Title = "Title updated"; + entity.GivenName = "GivenName updated"; + entity.MiddleName = "MiddleName updated"; + entity.FamilyName = "FamilyName updated"; + entity.Suffix = "Mr."; + return entity; + } + + + internal static Vendor UpdateVendorFrance(ServiceContext context, Vendor entity) + { + entity.Title = "Title updated"; + entity.GivenName = "GivenName updated"; + entity.MiddleName = "MiddleName updated"; + entity.FamilyName = "FamilyName updated"; + entity.Suffix = "Mr."; + + entity.APAccountRef = new ReferenceType() + { + Value = "12" + }; + + return entity; + } + + + + internal static Vendor SparseUpdateVendor(ServiceContext context, string id, string syncToken) + { + Vendor entity = new Vendor(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.GivenName = "sparse" + Helper.GetGuid().Substring(0, 5); + entity.MiddleName = "sparse" + Helper.GetGuid().Substring(0, 5); + entity.FamilyName = "sparse" + Helper.GetGuid().Substring(0, 5); + return entity; + } + + + + internal static CustomerType CreateCustomerType(ServiceContext context) + { + CustomerType customerType = new CustomerType(); + customerType.Name = "Name" + Helper.GetGuid().Substring(0, 5); + + //customerType.ParentRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + customerType.FullyQualifiedName = customerType.Name; + customerType.Active = true; + customerType.ActiveSpecified = true; + return customerType; + } + + + + internal static CustomerType UpdateCustomerType(ServiceContext context, CustomerType entity) + { + //update the properties of entity + entity.Name = "Name_updated" + Helper.GetGuid().Substring(0, 5); + return entity; + } + + + internal static CustomerType UpdateCustomerTypeSparse(ServiceContext context, string id, string syncToken) + { + CustomerType entity = new CustomerType(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.Name = "Name_updated" + Helper.GetGuid().Substring(0, 5); + return entity; + } + + + internal static Employee CreateEmployee(ServiceContext context) + { + Employee employee = new Employee(); + employee.EmployeeType = EmployeeTypeEnum.Regular.ToString(); + employee.EmployeeNumber = "ENO" + Helper.GetGuid().Substring(0, 6); + //employee.SSN = "111-22-3333"; + PhysicalAddress primaryAddr = new PhysicalAddress(); + primaryAddr.Line1 = "Line1"; + primaryAddr.Line2 = "Line2"; + primaryAddr.Line3 = "Line3"; + primaryAddr.Line4 = "Line4"; + primaryAddr.Line5 = "Line5"; + primaryAddr.City = "City"; + primaryAddr.Country = "Country"; + primaryAddr.CountryCode = "CountryCode"; + primaryAddr.CountrySubDivisionCode = "CA"; + primaryAddr.PostalCode = "94089"; + //primaryAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //primaryAddr.Lat = "Lat"; + //primaryAddr.Long = "Long"; + //primaryAddr.Tag = "Tag"; + primaryAddr.Note = "Note"; + employee.PrimaryAddr = primaryAddr; + + //List otherAddrList = new List(); + //PhysicalAddress otherAddr = new PhysicalAddress(); + //otherAddr.Line1 = "Line1"; + //otherAddr.Line2 = "Line2"; + //otherAddr.Line3 = "Line3"; + //otherAddr.Line4 = "Line4"; + //otherAddr.Line5 = "Line5"; + //otherAddr.City = "City"; + //otherAddr.Country = "Country"; + //otherAddr.CountryCode = "CountryCode"; + //otherAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //otherAddr.PostalCode = "PostalCode"; + //otherAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //otherAddr.Lat = "Lat"; + //otherAddr.Long = "Long"; + //otherAddr.Tag = "Tag"; + //otherAddr.Note = "Note"; + //otherAddrList.Add(otherAddr); + //employee.OtherAddr = otherAddrList.ToArray(); + //employee.BillableTime = true; + //employee.BillableTimeSpecified = true; + employee.BirthDate = DateTime.UtcNow.Date; + employee.BirthDateSpecified = true; + employee.Gender = gender.Male; + + + employee.GenderSpecified = true; + employee.HiredDate = DateTime.UtcNow.Date; + employee.HiredDateSpecified = true; + employee.ReleasedDate = DateTime.UtcNow.Date; + employee.ReleasedDateSpecified = true; + employee.UseTimeEntry = TimeEntryUsedForPaychecksEnum.UseTimeEntry; + //employee.UseTimeEntrySpecified = true; + //employee.EmployeeEx = + + employee.Organization = true; + employee.OrganizationSpecified = true; + employee.Title = "Title"; + employee.GivenName = "GivenName" + Helper.GetGuid().Substring(0, 8); + employee.MiddleName = "MiddleName" + Helper.GetGuid().Substring(0, 8); + employee.FamilyName = "FamilyName" + Helper.GetGuid().Substring(0, 8); + employee.CompanyName = "CompanyName" + Helper.GetGuid().Substring(0, 8); + //employee.DisplayName = "DisplayName" + Helper.GetGuid().Substring(0, 8); + employee.PrintOnCheckName = "PrintOnCheckName" + Helper.GetGuid().Substring(0, 8); ; + employee.UserId = "UserId" + Helper.GetGuid().Substring(0, 8); ; + employee.Active = true; + employee.ActiveSpecified = true; + //TelephoneNumber primaryPhone = new TelephoneNumber(); + //primaryPhone.DeviceType = "DeviceType"; + //primaryPhone.CountryCode = "CountryCode"; + //primaryPhone.AreaCode = "AreaCode"; + //primaryPhone.ExchangeCode = "ExchangeCode"; + //primaryPhone.Extension = "Extension"; + //primaryPhone.FreeFormNumber = "FreeFormNumber"; + //primaryPhone.Default = true; + //primaryPhone.DefaultSpecified = true; + //primaryPhone.Tag = "Tag"; + //employee.PrimaryPhone = primaryPhone; + //TelephoneNumber alternatePhone = new TelephoneNumber(); + //alternatePhone.DeviceType = "DeviceType"; + //alternatePhone.CountryCode = "CountryCode"; + //alternatePhone.AreaCode = "AreaCode"; + //alternatePhone.ExchangeCode = "ExchangeCode"; + //alternatePhone.Extension = "Extension"; + //alternatePhone.FreeFormNumber = "FreeFormNumber"; + //alternatePhone.Default = true; + //alternatePhone.DefaultSpecified = true; + //alternatePhone.Tag = "Tag"; + //employee.AlternatePhone = alternatePhone; + //TelephoneNumber mobile = new TelephoneNumber(); + //mobile.DeviceType = "DeviceType"; + //mobile.CountryCode = "CountryCode"; + //mobile.AreaCode = "AreaCode"; + //mobile.ExchangeCode = "ExchangeCode"; + //mobile.Extension = "Extension"; + //mobile.FreeFormNumber = "FreeFormNumber"; + //mobile.Default = true; + //mobile.DefaultSpecified = true; + //mobile.Tag = "Tag"; + //employee.Mobile = mobile; + //TelephoneNumber fax = new TelephoneNumber(); + //fax.DeviceType = "DeviceType"; + //fax.CountryCode = "CountryCode"; + //fax.AreaCode = "AreaCode"; + //fax.ExchangeCode = "ExchangeCode"; + //fax.Extension = "Extension"; + //fax.FreeFormNumber = "FreeFormNumber"; + //fax.Default = true; + //fax.DefaultSpecified = true; + //fax.Tag = "Tag"; + //employee.Fax = fax; + //EmailAddress primaryEmailAddr = new EmailAddress(); + //primaryEmailAddr.Address = "Address"; + //primaryEmailAddr.Default = true; + //primaryEmailAddr.DefaultSpecified = true; + //primaryEmailAddr.Tag = "Tag"; + //employee.PrimaryEmailAddr = primaryEmailAddr; + //WebSiteAddress webAddr = new WebSiteAddress(); + //webAddr.URI = "URI"; + //webAddr.Default = true; + //webAddr.DefaultSpecified = true; + //webAddr.Tag = "Tag"; + //employee.WebAddr = webAddr; + + //List otherContactInfoList = new List(); + //ContactInfo otherContactInfo = new ContactInfo(); + //otherContactInfo.Type = ContactTypeEnum.; + //otherContactInfo.TypeSpecified = true; + //otherContactInfo.AnyIntuitObject = + //otherContactInfoList.Add(otherContactInfo); + //employee.OtherContactInfo = otherContactInfoList.ToArray(); + //employee.DefaultTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + return employee; + } + + + + internal static Employee UpdateEmployee(ServiceContext context, Employee entity) + { + //update the properties of entity + entity.GivenName = "updated" + Helper.GetGuid().Substring(0, 8); + entity.MiddleName = "updated" + Helper.GetGuid().Substring(0, 8); + entity.FamilyName = "updated" + Helper.GetGuid().Substring(0, 8); + entity.CompanyName = "updated" + Helper.GetGuid().Substring(0, 8); + return entity; + } + + + internal static Employee SparseUpdateEmployee(ServiceContext context, string Id, string syncToken) + { + Employee entity = new Employee(); + entity.Id = Id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.GivenName = "sparseupdated" + Helper.GetGuid().Substring(0, 8); + return entity; + } + + + internal static JobType CreateJobType(ServiceContext context) + { + JobType jobType = new JobType(); + jobType.Name = "Name" + Helper.GetGuid().Substring(0, 5); + //jobType.ParentRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + jobType.FullyQualifiedName = jobType.Name; + jobType.Active = true; + jobType.ActiveSpecified = true; + return jobType; + } + + + + internal static JobType UpdateJobType(ServiceContext context, JobType entity) + { + //update the properties of entity + entity.Name = "updated_name" + Helper.GetGuid().Substring(0, 5); + return entity; + } + + + internal static JobType UpdateJobTypeSparse(ServiceContext context, string id, string syncToken) + { + JobType entity = new JobType(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.Name = "updated_name" + Helper.GetGuid().Substring(0, 5); + return entity; + } + + internal static OtherName CreateOtherName(ServiceContext context) + { + OtherName otherName = new OtherName(); + otherName.AcctNum = "AcctNum" + Helper.GetGuid().Substring(0, 5); + PhysicalAddress primaryAddr = new PhysicalAddress(); + primaryAddr.Line1 = "address line1"; + primaryAddr.Line2 = "address Line2"; + //primaryAddr.Line3 = "Line3"; + //primaryAddr.Line4 = "Line4"; + //primaryAddr.Line5 = "Line5"; + primaryAddr.City = "City"; + primaryAddr.Country = "Country"; + //primaryAddr.CountryCode = "CountryCode"; + //primaryAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + primaryAddr.PostalCode = "485065"; + //primaryAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //primaryAddr.Lat = "Lat"; + //primaryAddr.Long = "Long"; + //primaryAddr.Tag = "Tag"; + //primaryAddr.Note = "Note"; + otherName.PrimaryAddr = primaryAddr; + + List otherAddrList = new List(); + PhysicalAddress otherAddr = new PhysicalAddress(); + otherAddr.Line1 = "Other address Line1"; + otherAddr.Line2 = "Other address Line2"; + //otherAddr.Line3 = "Line3"; + //otherAddr.Line4 = "Line4"; + //otherAddr.Line5 = "Line5"; + otherAddr.City = "City"; + otherAddr.Country = "Country"; + //otherAddr.CountryCode = "CountryCode"; + //otherAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + otherAddr.PostalCode = "7438957"; + //otherAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //otherAddr.Lat = "Lat"; + //otherAddr.Long = "Long"; + //otherAddr.Tag = "Tag"; + //otherAddr.Note = "Note"; + otherAddrList.Add(otherAddr); + //otherName.OtherAddr = otherAddrList.ToArray(); + //otherName.OtherNameEx = + + otherName.Organization = true; + otherName.OrganizationSpecified = true; + otherName.Title = "Title"; + otherName.GivenName = "GivenName" + Helper.GetGuid().Substring(0, 5); + otherName.MiddleName = "MiddleName" + Helper.GetGuid().Substring(0, 5); + otherName.FamilyName = "FamilyName" + Helper.GetGuid().Substring(0, 5); + //otherName.Suffix = "Suffix"; + otherName.FullyQualifiedName = "fully_name" + Helper.GetGuid().Substring(0, 5); + otherName.CompanyName = "CompanyName"; + otherName.DisplayName = "DisplayName"; + otherName.PrintOnCheckName = "Test"; + //otherName.UserId = "UserId"; + otherName.Active = true; + otherName.ActiveSpecified = true; + TelephoneNumber primaryPhone = new TelephoneNumber(); + primaryPhone.DeviceType = "DeviceType"; + primaryPhone.CountryCode = "5245"; + //primaryPhone.AreaCode = "AreaCode"; + //primaryPhone.ExchangeCode = "ExchangeCode"; + //primaryPhone.Extension = "Extension"; + primaryPhone.FreeFormNumber = "23454262"; + //primaryPhone.Default = true; + //primaryPhone.DefaultSpecified = true; + primaryPhone.Tag = "Home"; + otherName.PrimaryPhone = primaryPhone; + //TelephoneNumber alternatePhone = new TelephoneNumber(); + //alternatePhone.DeviceType = "DeviceType"; + //alternatePhone.CountryCode = "CountryCode"; + //alternatePhone.AreaCode = "AreaCode"; + //alternatePhone.ExchangeCode = "ExchangeCode"; + //alternatePhone.Extension = "Extension"; + //alternatePhone.FreeFormNumber = "FreeFormNumber"; + //alternatePhone.Default = true; + //alternatePhone.DefaultSpecified = true; + //alternatePhone.Tag = "Tag"; + //otherName.AlternatePhone = alternatePhone; + TelephoneNumber mobile = new TelephoneNumber(); + mobile.DeviceType = "DeviceType"; + mobile.CountryCode = "6756"; + //mobile.AreaCode = "AreaCode"; + //mobile.ExchangeCode = "ExchangeCode"; + //mobile.Extension = "Extension"; + mobile.FreeFormNumber = "9987567445"; + mobile.Default = true; + mobile.DefaultSpecified = true; + mobile.Tag = "Business"; + otherName.Mobile = mobile; + //TelephoneNumber fax = new TelephoneNumber(); + //fax.DeviceType = "DeviceType"; + //fax.CountryCode = "CountryCode"; + //fax.AreaCode = "AreaCode"; + //fax.ExchangeCode = "ExchangeCode"; + //fax.Extension = "Extension"; + //fax.FreeFormNumber = "FreeFormNumber"; + //fax.Default = true; + //fax.DefaultSpecified = true; + //fax.Tag = "Tag"; + //otherName.Fax = fax; + EmailAddress primaryEmailAddr = new EmailAddress(); + primaryEmailAddr.Address = "intuit@aditi.com"; + primaryEmailAddr.Default = true; + primaryEmailAddr.DefaultSpecified = true; + primaryEmailAddr.Tag = "office"; + otherName.PrimaryEmailAddr = primaryEmailAddr; + WebSiteAddress webAddr = new WebSiteAddress(); + webAddr.URI = "http://intuit.com"; + webAddr.Default = true; + webAddr.DefaultSpecified = true; + webAddr.Tag = "Tag"; + otherName.WebAddr = webAddr; + + //List otherContactInfoList = new List(); + //ContactInfo otherContactInfo = new ContactInfo(); + // otherContactInfo.Type = ContactTypeEnum.; + // otherContactInfo.TypeSpecified = true; + // otherContactInfo.AnyIntuitObject = + //otherContactInfoList.Add(otherContactInfo); + //otherName.OtherContactInfo = otherContactInfoList.ToArray(); + //otherName.DefaultTaxCodeRef = new ReferenceType() + //{ + // name = + // type = + // Value = + //}; + return otherName; + } + + + + internal static OtherName UpdateOtherName(ServiceContext context, OtherName entity) + { + //update the properties of entity + entity.AcctNum = "AcctNum" + Helper.GetGuid().Substring(0, 5); + entity.GivenName = "name_updated" + Helper.GetGuid().Substring(0, 5); + entity.FamilyName = "family_updated" + Helper.GetGuid().Substring(0, 5); + return entity; + } + + + + internal static OtherName UpdateOtherNameSparse(ServiceContext context, string id, string syncToken) + { + OtherName entity = new OtherName(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.AcctNum = "AcctNum" + Helper.GetGuid().Substring(0, 5); + entity.GivenName = "name_updated" + Helper.GetGuid().Substring(0, 5); + entity.FamilyName = "family_updated" + Helper.GetGuid().Substring(0, 5); + return entity; + } + + + internal static VendorType CreateVendorType(ServiceContext context) + { + VendorType vendorType = new VendorType(); + vendorType.Name = "Name" + Helper.GetGuid().Substring(0, 5); + //vendorType.ParentRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + vendorType.FullyQualifiedName = vendorType.Name; + + ModificationMetaData modification = new ModificationMetaData(); + modification.CreateTime = DateTime.UtcNow.AddDays(-20); + modification.CreateTimeSpecified = true; + modification.LastUpdatedTime = DateTime.UtcNow; + modification.LastUpdatedTimeSpecified = true; + + vendorType.MetaData = modification; + //vendorType.Active = true; + //vendorType.ActiveSpecified = true; + return vendorType; + } + + + + internal static VendorType UpdateVendorType(ServiceContext context, VendorType entity) + { + //update the properties of entity + entity.Name = "Name" + Helper.GetGuid().Substring(0, 5); + entity.FullyQualifiedName = entity.Name; + return entity; + } + + + internal static VendorType UpdateVendorTypeSparse(ServiceContext context, string id, string syncToken) + { + VendorType entity = new VendorType(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.Name = "Name" + Helper.GetGuid().Substring(0, 5); + entity.FullyQualifiedName = entity.Name; + return entity; + } + + + + internal static TaxAgency CreateTaxAgency(ServiceContext context) + { + TaxAgency taxAgency = new TaxAgency(); + taxAgency.DisplayName = "Name" + Helper.GetGuid().Substring(0, 5); + + //taxAgency.SalesTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //taxAgency.SalesTaxCountry = "SalesTaxCountry"; + //taxAgency.SalesTaxReturnRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //taxAgency.TaxRegistrationNumber = "TaxRegistrationNumber"; + //taxAgency.ReportingPeriod = "ReportingPeriod"; + //taxAgency.TaxTrackedOnPurchases = true; + //taxAgency.TaxTrackedOnPurchasesSpecified = true; + //taxAgency.TaxOnPurchasesAccountRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //taxAgency.TaxTrackedOnSales = true; + //taxAgency.TaxTrackedOnSalesSpecified = true; + //taxAgency.TaxTrackedOnSalesAccountRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //taxAgency.TaxOnTax = true; + //taxAgency.TaxOnTaxSpecified = true; + //taxAgency.TaxAgencyExt = + //taxAgency.ContactName = "ContactName"; + //taxAgency.AltContactName = "AltContactName"; + //taxAgency.Notes = "Notes"; + //PhysicalAddress billAddr = new PhysicalAddress(); + //billAddr.Line1 = "Line1"; + //billAddr.Line2 = "Line2"; + //billAddr.Line3 = "Line3"; + //billAddr.Line4 = "Line4"; + //billAddr.Line5 = "Line5"; + //billAddr.City = "City"; + //billAddr.Country = "Country"; + //billAddr.CountryCode = "CountryCode"; + //billAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //billAddr.PostalCode = "PostalCode"; + //billAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //billAddr.Lat = "Lat"; + //billAddr.Long = "Long"; + //billAddr.Tag = "Tag"; + //billAddr.Note = "Note"; + //taxAgency.BillAddr = billAddr; + //PhysicalAddress shipAddr = new PhysicalAddress(); + //shipAddr.Line1 = "Line1"; + //shipAddr.Line2 = "Line2"; + //shipAddr.Line3 = "Line3"; + //shipAddr.Line4 = "Line4"; + //shipAddr.Line5 = "Line5"; + //shipAddr.City = "City"; + //shipAddr.Country = "Country"; + //shipAddr.CountryCode = "CountryCode"; + //shipAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //shipAddr.PostalCode = "PostalCode"; + //shipAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //shipAddr.Lat = "Lat"; + //shipAddr.Long = "Long"; + //shipAddr.Tag = "Tag"; + //shipAddr.Note = "Note"; + //taxAgency.ShipAddr = shipAddr; + + //List otherAddrList = new List(); + //PhysicalAddress otherAddr = new PhysicalAddress(); + //otherAddr.Line1 = "Line1"; + //otherAddr.Line2 = "Line2"; + //otherAddr.Line3 = "Line3"; + //otherAddr.Line4 = "Line4"; + //otherAddr.Line5 = "Line5"; + //otherAddr.City = "City"; + //otherAddr.Country = "Country"; + //otherAddr.CountryCode = "CountryCode"; + //otherAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + //otherAddr.PostalCode = "PostalCode"; + //otherAddr.PostalCodeSuffix = "PostalCodeSuffix"; + //otherAddr.Lat = "Lat"; + //otherAddr.Long = "Long"; + //otherAddr.Tag = "Tag"; + //otherAddr.Note = "Note"; + //otherAddrList.Add(otherAddr); + //taxAgency.OtherAddr = otherAddrList.ToArray(); + //taxAgency.TaxCountry = "TaxCountry"; + //taxAgency.TaxIdentifier = "TaxIdentifier"; + //taxAgency.BusinessNumber = "BusinessNumber"; + //taxAgency.ParentRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //taxAgency.VendorTypeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //taxAgency.TermRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //taxAgency.PrefillAccountRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //taxAgency.Balance = new Decimal(100.00); + //taxAgency.BalanceSpecified = true; + //taxAgency.OpenBalanceDate = DateTime.UtcNow.Date; + //taxAgency.OpenBalanceDateSpecified = true; + //taxAgency.CreditLimit = new Decimal(100.00); + //taxAgency.CreditLimitSpecified = true; + //taxAgency.AcctNum = "AcctNum"; + //taxAgency.Vendor1099 = true; + //taxAgency.Vendor1099Specified = true; + //taxAgency.T4AEligible = true; + //taxAgency.T4AEligibleSpecified = true; + //taxAgency.T5018Eligible = true; + //taxAgency.T5018EligibleSpecified = true; + //taxAgency.CurrencyRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + //taxAgency.VendorEx = + //taxAgency.Organization = true; + //taxAgency.OrganizationSpecified = true; + //taxAgency.Title = "Title"; + //taxAgency.GivenName = "GivenName"; + //taxAgency.MiddleName = "MiddleName"; + //taxAgency.FamilyName = "FamilyName"; + //taxAgency.Suffix = "Suffix"; + //taxAgency.FullyQualifiedName = "FullyQualifiedName"; + //taxAgency.CompanyName = "CompanyName"; + //taxAgency.DisplayName = "DisplayName"; + //taxAgency.PrintOnCheckName = "PrintOnCheckName"; + //taxAgency.UserId = "UserId"; + //taxAgency.Active = true; + //taxAgency.ActiveSpecified = true; + //TelephoneNumber primaryPhone = new TelephoneNumber(); + //primaryPhone.DeviceType = "DeviceType"; + //primaryPhone.CountryCode = "CountryCode"; + //primaryPhone.AreaCode = "AreaCode"; + //primaryPhone.ExchangeCode = "ExchangeCode"; + //primaryPhone.Extension = "Extension"; + //primaryPhone.FreeFormNumber = "FreeFormNumber"; + //primaryPhone.Default = true; + //primaryPhone.DefaultSpecified = true; + //primaryPhone.Tag = "Tag"; + //taxAgency.PrimaryPhone = primaryPhone; + //TelephoneNumber alternatePhone = new TelephoneNumber(); + //alternatePhone.DeviceType = "DeviceType"; + //alternatePhone.CountryCode = "CountryCode"; + //alternatePhone.AreaCode = "AreaCode"; + //alternatePhone.ExchangeCode = "ExchangeCode"; + //alternatePhone.Extension = "Extension"; + //alternatePhone.FreeFormNumber = "FreeFormNumber"; + //alternatePhone.Default = true; + //alternatePhone.DefaultSpecified = true; + //alternatePhone.Tag = "Tag"; + //taxAgency.AlternatePhone = alternatePhone; + //TelephoneNumber mobile = new TelephoneNumber(); + //mobile.DeviceType = "DeviceType"; + //mobile.CountryCode = "CountryCode"; + //mobile.AreaCode = "AreaCode"; + //mobile.ExchangeCode = "ExchangeCode"; + //mobile.Extension = "Extension"; + //mobile.FreeFormNumber = "FreeFormNumber"; + //mobile.Default = true; + //mobile.DefaultSpecified = true; + //mobile.Tag = "Tag"; + //taxAgency.Mobile = mobile; + //TelephoneNumber fax = new TelephoneNumber(); + //fax.DeviceType = "DeviceType"; + //fax.CountryCode = "CountryCode"; + //fax.AreaCode = "AreaCode"; + //fax.ExchangeCode = "ExchangeCode"; + //fax.Extension = "Extension"; + //fax.FreeFormNumber = "FreeFormNumber"; + //fax.Default = true; + //fax.DefaultSpecified = true; + //fax.Tag = "Tag"; + //taxAgency.Fax = fax; + //EmailAddress primaryEmailAddr = new EmailAddress(); + //primaryEmailAddr.Address = "Address"; + //primaryEmailAddr.Default = true; + //primaryEmailAddr.DefaultSpecified = true; + //primaryEmailAddr.Tag = "Tag"; + //taxAgency.PrimaryEmailAddr = primaryEmailAddr; + //WebSiteAddress webAddr = new WebSiteAddress(); + //webAddr.URI = "URI"; + //webAddr.Default = true; + //webAddr.DefaultSpecified = true; + //webAddr.Tag = "Tag"; + //taxAgency.WebAddr = webAddr; + + //List otherContactInfoList = new List(); + //ContactInfo otherContactInfo = new ContactInfo(); + //otherContactInfo.Type = ContactTypeEnum.; + //otherContactInfo.TypeSpecified = true; + //otherContactInfo.AnyIntuitObject = + //otherContactInfoList.Add(otherContactInfo); + //taxAgency.OtherContactInfo = otherContactInfoList.ToArray(); + //taxAgency.DefaultTaxCodeRef = new ReferenceType() + //{ + //name = + //type = + //Value = + //}; + return taxAgency; + } + + + + internal static TaxAgency UpdateTaxAgency(ServiceContext context, TaxAgency entity) + { + //update the properties of entity + return entity; + } + + + internal static TaxAgency UpdateTaxAgencySparse(ServiceContext context, string id, string syncToken) + { + TaxAgency entity = new TaxAgency(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + return entity; + } + + + internal static Status CreateStatus(ServiceContext context) + { + Status status = new Status(); + status.RequestId = "RId" + Helper.GetGuid().Substring(0, 3); + status.BatchId = "BId" + Helper.GetGuid().Substring(0, 3); + status.ObjectType = "ObjectType"; + status.StateCode = "StateCode"; + status.StateDesc = "StateDesc"; + status.MessageCode = "MessageCode"; + status.MessageDesc = "MessageDesc"; + return status; + } + + + + internal static Status UpdateStatus(ServiceContext context, Status entity) + { + //update the properties of entity + entity.StateCode = "UpdatedStateCode"; + entity.StateDesc = "UpdatedStateDesc"; + return entity; + } + + + + internal static Status UpdateStatusSparse(ServiceContext context, string id, string syncToken) + { + Status entity = new Status(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.StateCode = "SparseUpdatedStateCode"; + entity.StateDesc = "SparseUpdatedStateDesc"; + return entity; + } + + + + internal static SyncActivity CreateSyncActivity(ServiceContext context) + { + SyncActivity syncActivity = new SyncActivity(); + //syncActivity.LatestUploadDateTime = DateTime.UtcNow.Date; + //syncActivity.LatestUploadDateTimeSpecified = true; + //syncActivity.LatestWriteBackDateTime = DateTime.UtcNow.Date; + //syncActivity.LatestWriteBackDateTimeSpecified = true; + //syncActivity.SyncType = syncType; + //SyncType syncType = new SyncType(); + + syncActivity.SyncTypeSpecified = true; + syncActivity.StartSyncTMS = DateTime.UtcNow.Date; + syncActivity.StartSyncTMSSpecified = true; + syncActivity.EndSyncTMS = DateTime.UtcNow.Date; + syncActivity.EndSyncTMSSpecified = true; + syncActivity.EntityName = "EntityName" + Helper.GetGuid().Substring(0, 5); + //syncActivity.EntityRowCount = int32; + //Int32 int32 = new Int32(); + + //syncActivity.EntityRowCountSpecified = true; + return syncActivity; + } + + + + internal static SyncActivity UpdateSyncActivity(ServiceContext context, SyncActivity entity) + { + //update the properties of entity + entity.EntityName = "EntityName" + Helper.GetGuid().Substring(0, 5); + return entity; + } + + + internal static SyncActivity UpdateSyncActivitySparse(ServiceContext context, string id, string syncToken) + { + SyncActivity entity = new SyncActivity(); + entity.Id = id; + entity.SyncToken = syncToken; + entity.sparse = true; + entity.sparseSpecified = true; + entity.EntityName = "EntityName" + Helper.GetGuid().Substring(0, 5); + return entity; + } + + + + #endregion + + #region Verify Helper Methods + + internal static void VerifyNameValue(NameValue expected, NameValue actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.Value, actual.Value); + } + + + + internal static void VerifyCompany(Company expected, Company actual) + { + + Assert.AreEqual(expected.CompanyName, actual.CompanyName); + Assert.AreEqual(expected.LegalName, actual.LegalName); + Assert.AreEqual(expected.CompanyAddr.Line1, actual.CompanyAddr.Line1); + Assert.AreEqual(expected.CompanyAddr.Line2, actual.CompanyAddr.Line2); + Assert.AreEqual(expected.CompanyAddr.Line3, actual.CompanyAddr.Line3); + Assert.AreEqual(expected.CompanyAddr.Line4, actual.CompanyAddr.Line4); + Assert.AreEqual(expected.CompanyAddr.Line5, actual.CompanyAddr.Line5); + Assert.AreEqual(expected.CompanyAddr.City, actual.CompanyAddr.City); + Assert.AreEqual(expected.CompanyAddr.Country, actual.CompanyAddr.Country); + Assert.AreEqual(expected.CompanyAddr.CountryCode, actual.CompanyAddr.CountryCode); + Assert.AreEqual(expected.CompanyAddr.CountrySubDivisionCode, actual.CompanyAddr.CountrySubDivisionCode); + Assert.AreEqual(expected.CompanyAddr.PostalCode, actual.CompanyAddr.PostalCode); + Assert.AreEqual(expected.CompanyAddr.PostalCodeSuffix, actual.CompanyAddr.PostalCodeSuffix); + Assert.AreEqual(expected.CompanyAddr.Lat, actual.CompanyAddr.Lat); + Assert.AreEqual(expected.CompanyAddr.Long, actual.CompanyAddr.Long); + Assert.AreEqual(expected.CompanyAddr.Tag, actual.CompanyAddr.Tag); + Assert.AreEqual(expected.CompanyAddr.Note, actual.CompanyAddr.Note); + Assert.AreEqual(expected.CustomerCommunicationAddr.Line1, actual.CustomerCommunicationAddr.Line1); + Assert.AreEqual(expected.CustomerCommunicationAddr.Line2, actual.CustomerCommunicationAddr.Line2); + Assert.AreEqual(expected.CustomerCommunicationAddr.Line3, actual.CustomerCommunicationAddr.Line3); + Assert.AreEqual(expected.CustomerCommunicationAddr.Line4, actual.CustomerCommunicationAddr.Line4); + Assert.AreEqual(expected.CustomerCommunicationAddr.Line5, actual.CustomerCommunicationAddr.Line5); + Assert.AreEqual(expected.CustomerCommunicationAddr.City, actual.CustomerCommunicationAddr.City); + Assert.AreEqual(expected.CustomerCommunicationAddr.Country, actual.CustomerCommunicationAddr.Country); + Assert.AreEqual(expected.CustomerCommunicationAddr.CountryCode, actual.CustomerCommunicationAddr.CountryCode); + Assert.AreEqual(expected.CustomerCommunicationAddr.CountrySubDivisionCode, actual.CustomerCommunicationAddr.CountrySubDivisionCode); + Assert.AreEqual(expected.CustomerCommunicationAddr.PostalCode, actual.CustomerCommunicationAddr.PostalCode); + Assert.AreEqual(expected.CustomerCommunicationAddr.PostalCodeSuffix, actual.CustomerCommunicationAddr.PostalCodeSuffix); + Assert.AreEqual(expected.CustomerCommunicationAddr.Lat, actual.CustomerCommunicationAddr.Lat); + Assert.AreEqual(expected.CustomerCommunicationAddr.Long, actual.CustomerCommunicationAddr.Long); + Assert.AreEqual(expected.CustomerCommunicationAddr.Tag, actual.CustomerCommunicationAddr.Tag); + Assert.AreEqual(expected.CustomerCommunicationAddr.Note, actual.CustomerCommunicationAddr.Note); + //Assert.AreEqual(expected.LegalAddr.Line1, actual.LegalAddr.Line1); + //Assert.AreEqual(expected.LegalAddr.Line2, actual.LegalAddr.Line2); + //Assert.AreEqual(expected.LegalAddr.Line3, actual.LegalAddr.Line3); + //Assert.AreEqual(expected.LegalAddr.Line4, actual.LegalAddr.Line4); + //Assert.AreEqual(expected.LegalAddr.Line5, actual.LegalAddr.Line5); + //Assert.AreEqual(expected.LegalAddr.City, actual.LegalAddr.City); + //Assert.AreEqual(expected.LegalAddr.Country, actual.LegalAddr.Country); + //Assert.AreEqual(expected.LegalAddr.CountryCode, actual.LegalAddr.CountryCode); + //Assert.AreEqual(expected.LegalAddr.CountrySubDivisionCode, actual.LegalAddr.CountrySubDivisionCode); + //Assert.AreEqual(expected.LegalAddr.PostalCode, actual.LegalAddr.PostalCode); + //Assert.AreEqual(expected.LegalAddr.PostalCodeSuffix, actual.LegalAddr.PostalCodeSuffix); + //Assert.AreEqual(expected.LegalAddr.Lat, actual.LegalAddr.Lat); + //Assert.AreEqual(expected.LegalAddr.Long, actual.LegalAddr.Long); + //Assert.AreEqual(expected.LegalAddr.Tag, actual.LegalAddr.Tag); + //Assert.AreEqual(expected.LegalAddr.Note, actual.LegalAddr.Note); + //Assert.AreEqual(expected.CompanyEmailAddr.Address, actual.CompanyEmailAddr.Address); + //Assert.AreEqual(expected.CompanyEmailAddr.Default, actual.CompanyEmailAddr.Default); + //Assert.AreEqual(expected.CompanyEmailAddr.DefaultSpecified, actual.CompanyEmailAddr.DefaultSpecified); + //Assert.AreEqual(expected.CompanyEmailAddr.Tag, actual.CompanyEmailAddr.Tag); + //Assert.AreEqual(expected.CustomerCommunicationEmailAddr.Address, actual.CustomerCommunicationEmailAddr.Address); + //Assert.AreEqual(expected.CustomerCommunicationEmailAddr.Default, actual.CustomerCommunicationEmailAddr.Default); + //Assert.AreEqual(expected.CustomerCommunicationEmailAddr.DefaultSpecified, actual.CustomerCommunicationEmailAddr.DefaultSpecified); + //Assert.AreEqual(expected.CustomerCommunicationEmailAddr.Tag, actual.CustomerCommunicationEmailAddr.Tag); + //Assert.AreEqual(expected.CompanyURL.URI, actual.CompanyURL.URI); + //Assert.AreEqual(expected.CompanyURL.Default, actual.CompanyURL.Default); + //Assert.AreEqual(expected.CompanyURL.DefaultSpecified, actual.CompanyURL.DefaultSpecified); + //Assert.AreEqual(expected.CompanyURL.Tag, actual.CompanyURL.Tag); + //Assert.AreEqual(expected.PrimaryPhone.DeviceType, actual.PrimaryPhone.DeviceType); + //Assert.AreEqual(expected.PrimaryPhone.CountryCode, actual.PrimaryPhone.CountryCode); + //Assert.AreEqual(expected.PrimaryPhone.AreaCode, actual.PrimaryPhone.AreaCode); + //Assert.AreEqual(expected.PrimaryPhone.ExchangeCode, actual.PrimaryPhone.ExchangeCode); + //Assert.AreEqual(expected.PrimaryPhone.Extension, actual.PrimaryPhone.Extension); + //Assert.AreEqual(expected.PrimaryPhone.FreeFormNumber, actual.PrimaryPhone.FreeFormNumber); + //Assert.AreEqual(expected.PrimaryPhone.Default, actual.PrimaryPhone.Default); + //Assert.AreEqual(expected.PrimaryPhone.DefaultSpecified, actual.PrimaryPhone.DefaultSpecified); + //Assert.AreEqual(expected.PrimaryPhone.Tag, actual.PrimaryPhone.Tag); + //Assert.IsTrue(Helper.CheckEqual(expected.OtherContactInfo, actual.OtherContactInfo)); + //Assert.AreEqual(expected.CompanyFileName, actual.CompanyFileName); + //Assert.AreEqual(expected.FlavorStratum, actual.FlavorStratum); + //Assert.AreEqual(expected.SampleFile, actual.SampleFile); + //Assert.AreEqual(expected.SampleFileSpecified, actual.SampleFileSpecified); + //Assert.AreEqual(expected.CompanyUserId, actual.CompanyUserId); + //Assert.AreEqual(expected.CompanyUserAdminEmail, actual.CompanyUserAdminEmail); + //Assert.AreEqual(expected.CompanyStartDate, actual.CompanyStartDate); + //Assert.AreEqual(expected.CompanyStartDateSpecified, actual.CompanyStartDateSpecified); + //Assert.AreEqual(expected.EmployerId, actual.EmployerId); + //Assert.AreEqual(expected.FiscalYearStartMonthSpecified, actual.FiscalYearStartMonthSpecified); + //Assert.AreEqual(expected.TaxYearStartMonthSpecified, actual.TaxYearStartMonthSpecified); + //Assert.AreEqual(expected.QBVersion, actual.QBVersion); + //Assert.AreEqual(expected.Country, actual.Country); + // Assert.AreEqual(expected.ShipAddr.Line1, actual.ShipAddr.Line1); + // Assert.AreEqual(expected.ShipAddr.Line2, actual.ShipAddr.Line2); + // Assert.AreEqual(expected.ShipAddr.Line3, actual.ShipAddr.Line3); + // Assert.AreEqual(expected.ShipAddr.Line4, actual.ShipAddr.Line4); + // Assert.AreEqual(expected.ShipAddr.Line5, actual.ShipAddr.Line5); + // Assert.AreEqual(expected.ShipAddr.City, actual.ShipAddr.City); + // Assert.AreEqual(expected.ShipAddr.Country, actual.ShipAddr.Country); + // Assert.AreEqual(expected.ShipAddr.CountryCode, actual.ShipAddr.CountryCode); + // Assert.AreEqual(expected.ShipAddr.CountrySubDivisionCode, actual.ShipAddr.CountrySubDivisionCode); + // Assert.AreEqual(expected.ShipAddr.PostalCode, actual.ShipAddr.PostalCode); + // Assert.AreEqual(expected.ShipAddr.PostalCodeSuffix, actual.ShipAddr.PostalCodeSuffix); + // Assert.AreEqual(expected.ShipAddr.Lat, actual.ShipAddr.Lat); + // Assert.AreEqual(expected.ShipAddr.Long, actual.ShipAddr.Long); + // Assert.AreEqual(expected.ShipAddr.Tag, actual.ShipAddr.Tag); + // Assert.AreEqual(expected.ShipAddr.Note, actual.ShipAddr.Note); + //Assert.IsTrue(Helper.CheckEqual(expected.OtherAddr, actual.OtherAddr)); + // Assert.AreEqual(expected.Mobile.DeviceType, actual.Mobile.DeviceType); + // Assert.AreEqual(expected.Mobile.CountryCode, actual.Mobile.CountryCode); + // Assert.AreEqual(expected.Mobile.AreaCode, actual.Mobile.AreaCode); + // Assert.AreEqual(expected.Mobile.ExchangeCode, actual.Mobile.ExchangeCode); + // Assert.AreEqual(expected.Mobile.Extension, actual.Mobile.Extension); + // Assert.AreEqual(expected.Mobile.FreeFormNumber, actual.Mobile.FreeFormNumber); + // Assert.AreEqual(expected.Mobile.Default, actual.Mobile.Default); + // Assert.AreEqual(expected.Mobile.DefaultSpecified, actual.Mobile.DefaultSpecified); + // Assert.AreEqual(expected.Mobile.Tag, actual.Mobile.Tag); + // Assert.AreEqual(expected.Fax.DeviceType, actual.Fax.DeviceType); + // Assert.AreEqual(expected.Fax.CountryCode, actual.Fax.CountryCode); + // Assert.AreEqual(expected.Fax.AreaCode, actual.Fax.AreaCode); + // Assert.AreEqual(expected.Fax.ExchangeCode, actual.Fax.ExchangeCode); + // Assert.AreEqual(expected.Fax.Extension, actual.Fax.Extension); + // Assert.AreEqual(expected.Fax.FreeFormNumber, actual.Fax.FreeFormNumber); + // Assert.AreEqual(expected.Fax.Default, actual.Fax.Default); + // Assert.AreEqual(expected.Fax.DefaultSpecified, actual.Fax.DefaultSpecified); + // Assert.AreEqual(expected.Fax.Tag, actual.Fax.Tag); + // Assert.AreEqual(expected.Email.Address, actual.Email.Address); + // Assert.AreEqual(expected.Email.Default, actual.Email.Default); + // Assert.AreEqual(expected.Email.DefaultSpecified, actual.Email.DefaultSpecified); + // Assert.AreEqual(expected.Email.Tag, actual.Email.Tag); + // Assert.AreEqual(expected.WebSite.URI, actual.WebSite.URI); + // Assert.AreEqual(expected.WebSite.Default, actual.WebSite.Default); + // Assert.AreEqual(expected.WebSite.DefaultSpecified, actual.WebSite.DefaultSpecified); + // Assert.AreEqual(expected.WebSite.Tag, actual.WebSite.Tag); + //Assert.AreEqual(expected.LastImportedTime, actual.LastImportedTime); + //Assert.AreEqual(expected.LastImportedTimeSpecified, actual.LastImportedTimeSpecified); + //Assert.AreEqual(expected.SupportedLanguages, actual.SupportedLanguages); + //Assert.AreEqual(expected.DefaultTimeZone, actual.DefaultTimeZone); + //Assert.AreEqual(expected.MultiByteCharsSupported, actual.MultiByteCharsSupported); + //Assert.AreEqual(expected.MultiByteCharsSupportedSpecified, actual.MultiByteCharsSupportedSpecified); + //Assert.IsTrue(Helper.CheckEqual(expected.NameValue, actual.NameValue)); + // Assert.AreEqual(expected.CompanyInfoEx.Any, actual.CompanyInfoEx.Any); + + } + + internal static void VerifyCompanySparse(Company expected, Company actual) + { + Assert.AreEqual(expected.CompanyName, actual.CompanyName); + Assert.AreEqual(expected.LegalName, actual.LegalName); + } + + internal static void VerifyCompanyInfo(CompanyInfo expected, CompanyInfo actual) + { + Assert.AreEqual(expected.CompanyName, actual.CompanyName); + Assert.AreEqual(expected.LegalName, actual.LegalName); + //Assert.AreEqual(expected.CompanyAddr.Line1, actual.CompanyAddr.Line1); + //Assert.AreEqual(expected.CompanyAddr.Line2, actual.CompanyAddr.Line2); + //Assert.AreEqual(expected.CompanyAddr.Line3, actual.CompanyAddr.Line3); + //Assert.AreEqual(expected.CompanyAddr.Line4, actual.CompanyAddr.Line4); + //Assert.AreEqual(expected.CompanyAddr.Line5, actual.CompanyAddr.Line5); + //Assert.AreEqual(expected.CompanyAddr.City, actual.CompanyAddr.City); + //Assert.AreEqual(expected.CompanyAddr.Country, actual.CompanyAddr.Country); + //Assert.AreEqual(expected.CompanyAddr.CountryCode, actual.CompanyAddr.CountryCode); + //Assert.AreEqual(expected.CompanyAddr.CountrySubDivisionCode, actual.CompanyAddr.CountrySubDivisionCode); + //Assert.AreEqual(expected.CompanyAddr.PostalCode, actual.CompanyAddr.PostalCode); + //Assert.AreEqual(expected.CompanyAddr.PostalCodeSuffix, actual.CompanyAddr.PostalCodeSuffix); + //Assert.AreEqual(expected.CompanyAddr.Lat, actual.CompanyAddr.Lat); + //Assert.AreEqual(expected.CompanyAddr.Long, actual.CompanyAddr.Long); + //Assert.AreEqual(expected.CompanyAddr.Tag, actual.CompanyAddr.Tag); + //Assert.AreEqual(expected.CompanyAddr.Note, actual.CompanyAddr.Note); + //Assert.AreEqual(expected.CustomerCommunicationAddr.Line1, actual.CustomerCommunicationAddr.Line1); + //Assert.AreEqual(expected.CustomerCommunicationAddr.Line2, actual.CustomerCommunicationAddr.Line2); + //Assert.AreEqual(expected.CustomerCommunicationAddr.Line3, actual.CustomerCommunicationAddr.Line3); + //Assert.AreEqual(expected.CustomerCommunicationAddr.Line4, actual.CustomerCommunicationAddr.Line4); + //Assert.AreEqual(expected.CustomerCommunicationAddr.Line5, actual.CustomerCommunicationAddr.Line5); + //Assert.AreEqual(expected.CustomerCommunicationAddr.City, actual.CustomerCommunicationAddr.City); + //Assert.AreEqual(expected.CustomerCommunicationAddr.Country, actual.CustomerCommunicationAddr.Country); + //Assert.AreEqual(expected.CustomerCommunicationAddr.CountryCode, actual.CustomerCommunicationAddr.CountryCode); + //Assert.AreEqual(expected.CustomerCommunicationAddr.CountrySubDivisionCode, actual.CustomerCommunicationAddr.CountrySubDivisionCode); + //Assert.AreEqual(expected.CustomerCommunicationAddr.PostalCode, actual.CustomerCommunicationAddr.PostalCode); + //Assert.AreEqual(expected.CustomerCommunicationAddr.PostalCodeSuffix, actual.CustomerCommunicationAddr.PostalCodeSuffix); + //Assert.AreEqual(expected.CustomerCommunicationAddr.Lat, actual.CustomerCommunicationAddr.Lat); + //Assert.AreEqual(expected.CustomerCommunicationAddr.Long, actual.CustomerCommunicationAddr.Long); + //Assert.AreEqual(expected.CustomerCommunicationAddr.Tag, actual.CustomerCommunicationAddr.Tag); + //Assert.AreEqual(expected.CustomerCommunicationAddr.Note, actual.CustomerCommunicationAddr.Note); + //Assert.AreEqual(expected.LegalAddr.Line1, actual.LegalAddr.Line1); + //Assert.AreEqual(expected.LegalAddr.Line2, actual.LegalAddr.Line2); + //Assert.AreEqual(expected.LegalAddr.Line3, actual.LegalAddr.Line3); + //Assert.AreEqual(expected.LegalAddr.Line4, actual.LegalAddr.Line4); + //Assert.AreEqual(expected.LegalAddr.Line5, actual.LegalAddr.Line5); + //Assert.AreEqual(expected.LegalAddr.City, actual.LegalAddr.City); + //Assert.AreEqual(expected.LegalAddr.Country, actual.LegalAddr.Country); + //Assert.AreEqual(expected.LegalAddr.CountryCode, actual.LegalAddr.CountryCode); + //Assert.AreEqual(expected.LegalAddr.CountrySubDivisionCode, actual.LegalAddr.CountrySubDivisionCode); + //Assert.AreEqual(expected.LegalAddr.PostalCode, actual.LegalAddr.PostalCode); + //Assert.AreEqual(expected.LegalAddr.PostalCodeSuffix, actual.LegalAddr.PostalCodeSuffix); + //Assert.AreEqual(expected.LegalAddr.Lat, actual.LegalAddr.Lat); + //Assert.AreEqual(expected.LegalAddr.Long, actual.LegalAddr.Long); + //Assert.AreEqual(expected.LegalAddr.Tag, actual.LegalAddr.Tag); + //Assert.AreEqual(expected.LegalAddr.Note, actual.LegalAddr.Note); + //Assert.AreEqual(expected.CompanyEmailAddr.Address, actual.CompanyEmailAddr.Address); + //Assert.AreEqual(expected.CompanyEmailAddr.Default, actual.CompanyEmailAddr.Default); + //Assert.AreEqual(expected.CompanyEmailAddr.DefaultSpecified, actual.CompanyEmailAddr.DefaultSpecified); + //Assert.AreEqual(expected.CompanyEmailAddr.Tag, actual.CompanyEmailAddr.Tag); + //Assert.AreEqual(expected.CustomerCommunicationEmailAddr.Address, actual.CustomerCommunicationEmailAddr.Address); + //Assert.AreEqual(expected.CustomerCommunicationEmailAddr.Default, actual.CustomerCommunicationEmailAddr.Default); + //Assert.AreEqual(expected.CustomerCommunicationEmailAddr.DefaultSpecified, actual.CustomerCommunicationEmailAddr.DefaultSpecified); + //Assert.AreEqual(expected.CustomerCommunicationEmailAddr.Tag, actual.CustomerCommunicationEmailAddr.Tag); + //Assert.AreEqual(expected.CompanyURL.URI, actual.CompanyURL.URI); + //Assert.AreEqual(expected.CompanyURL.Default, actual.CompanyURL.Default); + //Assert.AreEqual(expected.CompanyURL.DefaultSpecified, actual.CompanyURL.DefaultSpecified); + //Assert.AreEqual(expected.CompanyURL.Tag, actual.CompanyURL.Tag); + Assert.AreEqual(expected.PrimaryPhone.DeviceType, actual.PrimaryPhone.DeviceType); + Assert.AreEqual(expected.PrimaryPhone.CountryCode, actual.PrimaryPhone.CountryCode); + Assert.AreEqual(expected.PrimaryPhone.AreaCode, actual.PrimaryPhone.AreaCode); + Assert.AreEqual(expected.PrimaryPhone.ExchangeCode, actual.PrimaryPhone.ExchangeCode); + Assert.AreEqual(expected.PrimaryPhone.Extension, actual.PrimaryPhone.Extension); + Assert.AreEqual(expected.PrimaryPhone.FreeFormNumber, actual.PrimaryPhone.FreeFormNumber); + Assert.AreEqual(expected.PrimaryPhone.Default, actual.PrimaryPhone.Default); + Assert.AreEqual(expected.PrimaryPhone.DefaultSpecified, actual.PrimaryPhone.DefaultSpecified); + Assert.AreEqual(expected.PrimaryPhone.Tag, actual.PrimaryPhone.Tag); + Assert.IsTrue(Helper.CheckEqual(expected.OtherContactInfo, actual.OtherContactInfo)); + Assert.AreEqual(expected.CompanyFileName, actual.CompanyFileName); + Assert.AreEqual(expected.FlavorStratum, actual.FlavorStratum); + Assert.AreEqual(expected.SampleFile, actual.SampleFile); + Assert.AreEqual(expected.SampleFileSpecified, actual.SampleFileSpecified); + Assert.AreEqual(expected.CompanyUserId, actual.CompanyUserId); + Assert.AreEqual(expected.CompanyUserAdminEmail, actual.CompanyUserAdminEmail); + Assert.AreEqual(expected.CompanyStartDate, actual.CompanyStartDate); + Assert.AreEqual(expected.CompanyStartDateSpecified, actual.CompanyStartDateSpecified); + Assert.AreEqual(expected.EmployerId, actual.EmployerId); + Assert.AreEqual(expected.FiscalYearStartMonthSpecified, actual.FiscalYearStartMonthSpecified); + Assert.AreEqual(expected.TaxYearStartMonthSpecified, actual.TaxYearStartMonthSpecified); + Assert.AreEqual(expected.QBVersion, actual.QBVersion); + Assert.AreEqual(expected.Country, actual.Country); + //Assert.AreEqual(expected.ShipAddr.Line1, actual.ShipAddr.Line1); + //Assert.AreEqual(expected.ShipAddr.Line2, actual.ShipAddr.Line2); + //Assert.AreEqual(expected.ShipAddr.Line3, actual.ShipAddr.Line3); + //Assert.AreEqual(expected.ShipAddr.Line4, actual.ShipAddr.Line4); + //Assert.AreEqual(expected.ShipAddr.Line5, actual.ShipAddr.Line5); + //Assert.AreEqual(expected.ShipAddr.City, actual.ShipAddr.City); + //Assert.AreEqual(expected.ShipAddr.Country, actual.ShipAddr.Country); + //Assert.AreEqual(expected.ShipAddr.CountryCode, actual.ShipAddr.CountryCode); + //Assert.AreEqual(expected.ShipAddr.CountrySubDivisionCode, actual.ShipAddr.CountrySubDivisionCode); + //Assert.AreEqual(expected.ShipAddr.PostalCode, actual.ShipAddr.PostalCode); + //Assert.AreEqual(expected.ShipAddr.PostalCodeSuffix, actual.ShipAddr.PostalCodeSuffix); + //Assert.AreEqual(expected.ShipAddr.Lat, actual.ShipAddr.Lat); + //Assert.AreEqual(expected.ShipAddr.Long, actual.ShipAddr.Long); + //Assert.AreEqual(expected.ShipAddr.Tag, actual.ShipAddr.Tag); + //Assert.AreEqual(expected.ShipAddr.Note, actual.ShipAddr.Note); + Assert.IsTrue(Helper.CheckEqual(expected.OtherAddr, actual.OtherAddr)); + //Assert.AreEqual(expected.Mobile.DeviceType, actual.Mobile.DeviceType); + //Assert.AreEqual(expected.Mobile.CountryCode, actual.Mobile.CountryCode); + //Assert.AreEqual(expected.Mobile.AreaCode, actual.Mobile.AreaCode); + //Assert.AreEqual(expected.Mobile.ExchangeCode, actual.Mobile.ExchangeCode); + //Assert.AreEqual(expected.Mobile.Extension, actual.Mobile.Extension); + //Assert.AreEqual(expected.Mobile.FreeFormNumber, actual.Mobile.FreeFormNumber); + //Assert.AreEqual(expected.Mobile.Default, actual.Mobile.Default); + //Assert.AreEqual(expected.Mobile.DefaultSpecified, actual.Mobile.DefaultSpecified); + //Assert.AreEqual(expected.Mobile.Tag, actual.Mobile.Tag); + //Assert.AreEqual(expected.Fax.DeviceType, actual.Fax.DeviceType); + //Assert.AreEqual(expected.Fax.CountryCode, actual.Fax.CountryCode); + //Assert.AreEqual(expected.Fax.AreaCode, actual.Fax.AreaCode); + //Assert.AreEqual(expected.Fax.ExchangeCode, actual.Fax.ExchangeCode); + //Assert.AreEqual(expected.Fax.Extension, actual.Fax.Extension); + //Assert.AreEqual(expected.Fax.FreeFormNumber, actual.Fax.FreeFormNumber); + //Assert.AreEqual(expected.Fax.Default, actual.Fax.Default); + //Assert.AreEqual(expected.Fax.DefaultSpecified, actual.Fax.DefaultSpecified); + //Assert.AreEqual(expected.Fax.Tag, actual.Fax.Tag); + Assert.AreEqual(expected.Email.Address, actual.Email.Address); + Assert.AreEqual(expected.Email.Default, actual.Email.Default); + Assert.AreEqual(expected.Email.DefaultSpecified, actual.Email.DefaultSpecified); + Assert.AreEqual(expected.Email.Tag, actual.Email.Tag); + Assert.AreEqual(expected.WebAddr.URI, actual.WebAddr.URI); + Assert.AreEqual(expected.WebAddr.Default, actual.WebAddr.Default); + Assert.AreEqual(expected.WebAddr.DefaultSpecified, actual.WebAddr.DefaultSpecified); + Assert.AreEqual(expected.WebAddr.Tag, actual.WebAddr.Tag); + Assert.AreEqual(expected.LastImportedTime, actual.LastImportedTime); + Assert.AreEqual(expected.LastImportedTimeSpecified, actual.LastImportedTimeSpecified); + Assert.AreEqual(expected.SupportedLanguages, actual.SupportedLanguages); + Assert.AreEqual(expected.DefaultTimeZone, actual.DefaultTimeZone); + //Assert.AreEqual(expected.MultiByteCharsSupported, actual.MultiByteCharsSupported); + //Assert.AreEqual(expected.MultiByteCharsSupportedSpecified, actual.MultiByteCharsSupportedSpecified); + //Assert.IsTrue(Helper.CheckEqual(expected.NameValue, actual.NameValue)); + //Assert.AreEqual(expected.CompanyInfoEx.Any, actual.CompanyInfoEx.Any); + } + + + internal static void VerifyCompanyInfoSparseUpdate(CompanyInfo expected, CompanyInfo actual) + { + Assert.AreEqual(expected.CompanyName, actual.CompanyName); + Assert.AreEqual(expected.LegalName, actual.LegalName); + } + + + + internal static void VerifyTransaction(Transaction expected, Transaction actual) + { + Assert.AreEqual(expected.DocNumber, actual.DocNumber); + Assert.AreEqual(expected.TxnDate, actual.TxnDate); + Assert.AreEqual(expected.TxnDateSpecified, actual.TxnDateSpecified); + Assert.AreEqual(expected.DepartmentRef.name, actual.DepartmentRef.name); + Assert.AreEqual(expected.DepartmentRef.type, actual.DepartmentRef.type); + Assert.AreEqual(expected.DepartmentRef.Value, actual.DepartmentRef.Value); + Assert.AreEqual(expected.CurrencyRef.name, actual.CurrencyRef.name); + Assert.AreEqual(expected.CurrencyRef.type, actual.CurrencyRef.type); + Assert.AreEqual(expected.CurrencyRef.Value, actual.CurrencyRef.Value); + Assert.AreEqual(expected.ExchangeRate, actual.ExchangeRate); + Assert.AreEqual(expected.ExchangeRateSpecified, actual.ExchangeRateSpecified); + Assert.AreEqual(expected.PrivateNote, actual.PrivateNote); + Assert.AreEqual(expected.TxnStatus, actual.TxnStatus); + Assert.IsTrue(Helper.CheckEqual(expected.LinkedTxn, actual.LinkedTxn)); + Assert.IsTrue(Helper.CheckEqual(expected.Line, actual.Line)); + Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.name, actual.TxnTaxDetail.DefaultTaxCodeRef.name); + Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.type, actual.TxnTaxDetail.DefaultTaxCodeRef.type); + Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.Value, actual.TxnTaxDetail.DefaultTaxCodeRef.Value); + Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.name, actual.TxnTaxDetail.TxnTaxCodeRef.name); + Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.type, actual.TxnTaxDetail.TxnTaxCodeRef.type); + Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.Value, actual.TxnTaxDetail.TxnTaxCodeRef.Value); + Assert.AreEqual(expected.TxnTaxDetail.TotalTax, actual.TxnTaxDetail.TotalTax); + Assert.AreEqual(expected.TxnTaxDetail.TotalTaxSpecified, actual.TxnTaxDetail.TotalTaxSpecified); + Assert.IsTrue(Helper.CheckEqual(expected.TxnTaxDetail.TaxLine, actual.TxnTaxDetail.TaxLine)); + } + + internal static void VerifyTransactionSparse(Transaction expected, Transaction actual) + { + Assert.AreEqual(expected.PrivateNote, actual.PrivateNote); + } + + internal static void VerifySalesTransaction(SalesTransaction expected, SalesTransaction actual) + { + Assert.AreEqual(expected.AutoDocNumber, actual.AutoDocNumber); + Assert.AreEqual(expected.AutoDocNumberSpecified, actual.AutoDocNumberSpecified); + Assert.AreEqual(expected.CustomerRef.name, actual.CustomerRef.name); + Assert.AreEqual(expected.CustomerRef.type, actual.CustomerRef.type); + Assert.AreEqual(expected.CustomerRef.Value, actual.CustomerRef.Value); + Assert.AreEqual(expected.CustomerMemo.id, actual.CustomerMemo.id); + Assert.AreEqual(expected.CustomerMemo.Value, actual.CustomerMemo.Value); + Assert.AreEqual(expected.BillAddr.Line1, actual.BillAddr.Line1); + Assert.AreEqual(expected.BillAddr.Line2, actual.BillAddr.Line2); + Assert.AreEqual(expected.BillAddr.Line3, actual.BillAddr.Line3); + Assert.AreEqual(expected.BillAddr.Line4, actual.BillAddr.Line4); + Assert.AreEqual(expected.BillAddr.Line5, actual.BillAddr.Line5); + Assert.AreEqual(expected.BillAddr.City, actual.BillAddr.City); + Assert.AreEqual(expected.BillAddr.Country, actual.BillAddr.Country); + Assert.AreEqual(expected.BillAddr.CountryCode, actual.BillAddr.CountryCode); + Assert.AreEqual(expected.BillAddr.CountrySubDivisionCode, actual.BillAddr.CountrySubDivisionCode); + Assert.AreEqual(expected.BillAddr.PostalCode, actual.BillAddr.PostalCode); + Assert.AreEqual(expected.BillAddr.PostalCodeSuffix, actual.BillAddr.PostalCodeSuffix); + Assert.AreEqual(expected.BillAddr.Lat, actual.BillAddr.Lat); + Assert.AreEqual(expected.BillAddr.Long, actual.BillAddr.Long); + Assert.AreEqual(expected.BillAddr.Tag, actual.BillAddr.Tag); + Assert.AreEqual(expected.BillAddr.Note, actual.BillAddr.Note); + Assert.AreEqual(expected.ShipAddr.Line1, actual.ShipAddr.Line1); + Assert.AreEqual(expected.ShipAddr.Line2, actual.ShipAddr.Line2); + Assert.AreEqual(expected.ShipAddr.Line3, actual.ShipAddr.Line3); + Assert.AreEqual(expected.ShipAddr.Line4, actual.ShipAddr.Line4); + Assert.AreEqual(expected.ShipAddr.Line5, actual.ShipAddr.Line5); + Assert.AreEqual(expected.ShipAddr.City, actual.ShipAddr.City); + Assert.AreEqual(expected.ShipAddr.Country, actual.ShipAddr.Country); + Assert.AreEqual(expected.ShipAddr.CountryCode, actual.ShipAddr.CountryCode); + Assert.AreEqual(expected.ShipAddr.CountrySubDivisionCode, actual.ShipAddr.CountrySubDivisionCode); + Assert.AreEqual(expected.ShipAddr.PostalCode, actual.ShipAddr.PostalCode); + Assert.AreEqual(expected.ShipAddr.PostalCodeSuffix, actual.ShipAddr.PostalCodeSuffix); + Assert.AreEqual(expected.ShipAddr.Lat, actual.ShipAddr.Lat); + Assert.AreEqual(expected.ShipAddr.Long, actual.ShipAddr.Long); + Assert.AreEqual(expected.ShipAddr.Tag, actual.ShipAddr.Tag); + Assert.AreEqual(expected.ShipAddr.Note, actual.ShipAddr.Note); + Assert.AreEqual(expected.RemitToRef.name, actual.RemitToRef.name); + Assert.AreEqual(expected.RemitToRef.type, actual.RemitToRef.type); + Assert.AreEqual(expected.RemitToRef.Value, actual.RemitToRef.Value); + Assert.AreEqual(expected.ClassRef.name, actual.ClassRef.name); + Assert.AreEqual(expected.ClassRef.type, actual.ClassRef.type); + Assert.AreEqual(expected.ClassRef.Value, actual.ClassRef.Value); + Assert.AreEqual(expected.SalesTermRef.name, actual.SalesTermRef.name); + Assert.AreEqual(expected.SalesTermRef.type, actual.SalesTermRef.type); + Assert.AreEqual(expected.SalesTermRef.Value, actual.SalesTermRef.Value); + Assert.AreEqual(expected.DueDate, actual.DueDate); + Assert.AreEqual(expected.DueDateSpecified, actual.DueDateSpecified); + Assert.AreEqual(expected.SalesRepRef.name, actual.SalesRepRef.name); + Assert.AreEqual(expected.SalesRepRef.type, actual.SalesRepRef.type); + Assert.AreEqual(expected.SalesRepRef.Value, actual.SalesRepRef.Value); + Assert.AreEqual(expected.PONumber, actual.PONumber); + Assert.AreEqual(expected.FOB, actual.FOB); + Assert.AreEqual(expected.ShipMethodRef.name, actual.ShipMethodRef.name); + Assert.AreEqual(expected.ShipMethodRef.type, actual.ShipMethodRef.type); + Assert.AreEqual(expected.ShipMethodRef.Value, actual.ShipMethodRef.Value); + Assert.AreEqual(expected.ShipDate, actual.ShipDate); + Assert.AreEqual(expected.ShipDateSpecified, actual.ShipDateSpecified); + Assert.AreEqual(expected.TrackingNum, actual.TrackingNum); + Assert.AreEqual(expected.GlobalTaxCalculationSpecified, actual.GlobalTaxCalculationSpecified); + Assert.AreEqual(expected.TotalAmt, actual.TotalAmt); + Assert.AreEqual(expected.TotalAmtSpecified, actual.TotalAmtSpecified); + Assert.AreEqual(expected.HomeTotalAmt, actual.HomeTotalAmt); + Assert.AreEqual(expected.HomeTotalAmtSpecified, actual.HomeTotalAmtSpecified); + Assert.AreEqual(expected.ApplyTaxAfterDiscount, actual.ApplyTaxAfterDiscount); + Assert.AreEqual(expected.ApplyTaxAfterDiscountSpecified, actual.ApplyTaxAfterDiscountSpecified); + Assert.AreEqual(expected.TemplateRef.name, actual.TemplateRef.name); + Assert.AreEqual(expected.TemplateRef.type, actual.TemplateRef.type); + Assert.AreEqual(expected.TemplateRef.Value, actual.TemplateRef.Value); + Assert.AreEqual(expected.PrintStatusSpecified, actual.PrintStatusSpecified); + Assert.AreEqual(expected.EmailStatusSpecified, actual.EmailStatusSpecified); + Assert.AreEqual(expected.BillEmail.Address, actual.BillEmail.Address); + Assert.AreEqual(expected.BillEmail.Default, actual.BillEmail.Default); + Assert.AreEqual(expected.BillEmail.DefaultSpecified, actual.BillEmail.DefaultSpecified); + Assert.AreEqual(expected.BillEmail.Tag, actual.BillEmail.Tag); + Assert.AreEqual(expected.ARAccountRef.name, actual.ARAccountRef.name); + Assert.AreEqual(expected.ARAccountRef.type, actual.ARAccountRef.type); + Assert.AreEqual(expected.ARAccountRef.Value, actual.ARAccountRef.Value); + Assert.AreEqual(expected.Balance, actual.Balance); + Assert.AreEqual(expected.BalanceSpecified, actual.BalanceSpecified); + Assert.AreEqual(expected.FinanceCharge, actual.FinanceCharge); + Assert.AreEqual(expected.FinanceChargeSpecified, actual.FinanceChargeSpecified); + Assert.AreEqual(expected.PaymentMethodRef.name, actual.PaymentMethodRef.name); + Assert.AreEqual(expected.PaymentMethodRef.type, actual.PaymentMethodRef.type); + Assert.AreEqual(expected.PaymentMethodRef.Value, actual.PaymentMethodRef.Value); + Assert.AreEqual(expected.PaymentRefNum, actual.PaymentRefNum); + Assert.AreEqual(expected.PaymentTypeSpecified, actual.PaymentTypeSpecified); + Assert.AreEqual(expected.AnyIntuitObject, actual.AnyIntuitObject); + Assert.AreEqual(expected.DepositToAccountRef.name, actual.DepositToAccountRef.name); + Assert.AreEqual(expected.DepositToAccountRef.type, actual.DepositToAccountRef.type); + Assert.AreEqual(expected.DepositToAccountRef.Value, actual.DepositToAccountRef.Value); + Assert.AreEqual(expected.DocNumber, actual.DocNumber); + Assert.AreEqual(expected.TxnDate, actual.TxnDate); + Assert.AreEqual(expected.TxnDateSpecified, actual.TxnDateSpecified); + Assert.AreEqual(expected.DepartmentRef.name, actual.DepartmentRef.name); + Assert.AreEqual(expected.DepartmentRef.type, actual.DepartmentRef.type); + Assert.AreEqual(expected.DepartmentRef.Value, actual.DepartmentRef.Value); + Assert.AreEqual(expected.CurrencyRef.name, actual.CurrencyRef.name); + Assert.AreEqual(expected.CurrencyRef.type, actual.CurrencyRef.type); + Assert.AreEqual(expected.CurrencyRef.Value, actual.CurrencyRef.Value); + Assert.AreEqual(expected.ExchangeRate, actual.ExchangeRate); + Assert.AreEqual(expected.ExchangeRateSpecified, actual.ExchangeRateSpecified); + Assert.AreEqual(expected.PrivateNote, actual.PrivateNote); + Assert.AreEqual(expected.TxnStatus, actual.TxnStatus); + Assert.IsTrue(Helper.CheckEqual(expected.LinkedTxn, actual.LinkedTxn)); + Assert.IsTrue(Helper.CheckEqual(expected.Line, actual.Line)); + Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.name, actual.TxnTaxDetail.DefaultTaxCodeRef.name); + Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.type, actual.TxnTaxDetail.DefaultTaxCodeRef.type); + Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.Value, actual.TxnTaxDetail.DefaultTaxCodeRef.Value); + Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.name, actual.TxnTaxDetail.TxnTaxCodeRef.name); + Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.type, actual.TxnTaxDetail.TxnTaxCodeRef.type); + Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.Value, actual.TxnTaxDetail.TxnTaxCodeRef.Value); + Assert.AreEqual(expected.TxnTaxDetail.TotalTax, actual.TxnTaxDetail.TotalTax); + Assert.AreEqual(expected.TxnTaxDetail.TotalTaxSpecified, actual.TxnTaxDetail.TotalTaxSpecified); + Assert.IsTrue(Helper.CheckEqual(expected.TxnTaxDetail.TaxLine, actual.TxnTaxDetail.TaxLine)); + } + + + internal static void VerifySalesTransactionSparse(SalesTransaction expected, SalesTransaction actual) + { + Assert.AreEqual(expected.Balance, actual.Balance); + } + + internal static void VerifyInvoice(Invoice expected, Invoice actual) + { + Assert.AreEqual(expected.Deposit, actual.Deposit); + Assert.AreEqual(expected.DepositSpecified, actual.DepositSpecified); + Assert.AreEqual(expected.AllowIPNPayment, actual.AllowIPNPayment); + Assert.AreEqual(expected.AllowIPNPaymentSpecified, actual.AllowIPNPaymentSpecified); + //Assert.AreEqual(expected.InvoiceEx.Any, actual.InvoiceEx.Any); + Assert.AreEqual(expected.AutoDocNumber, actual.AutoDocNumber); + Assert.AreEqual(expected.AutoDocNumberSpecified, actual.AutoDocNumberSpecified); + Assert.AreEqual(expected.CustomerRef.name, actual.CustomerRef.name); + Assert.AreEqual(expected.CustomerRef.type, actual.CustomerRef.type); + Assert.AreEqual(expected.CustomerRef.Value, actual.CustomerRef.Value); + //Assert.AreEqual(expected.CustomerMemo.id, actual.CustomerMemo.id); + //Assert.AreEqual(expected.CustomerMemo.Value, actual.CustomerMemo.Value); + //Assert.AreEqual(expected.BillAddr.Line1, actual.BillAddr.Line1); + //Assert.AreEqual(expected.BillAddr.Line2, actual.BillAddr.Line2); + //Assert.AreEqual(expected.BillAddr.Line3, actual.BillAddr.Line3); + //Assert.AreEqual(expected.BillAddr.Line4, actual.BillAddr.Line4); + //Assert.AreEqual(expected.BillAddr.Line5, actual.BillAddr.Line5); + //Assert.AreEqual(expected.BillAddr.City, actual.BillAddr.City); + //Assert.AreEqual(expected.BillAddr.Country, actual.BillAddr.Country); + //Assert.AreEqual(expected.BillAddr.CountryCode, actual.BillAddr.CountryCode); + //Assert.AreEqual(expected.BillAddr.CountrySubDivisionCode, actual.BillAddr.CountrySubDivisionCode); + //Assert.AreEqual(expected.BillAddr.PostalCode, actual.BillAddr.PostalCode); + //Assert.AreEqual(expected.BillAddr.PostalCodeSuffix, actual.BillAddr.PostalCodeSuffix); + //Assert.AreEqual(expected.BillAddr.Lat, actual.BillAddr.Lat); + //Assert.AreEqual(expected.BillAddr.Long, actual.BillAddr.Long); + //Assert.AreEqual(expected.BillAddr.Tag, actual.BillAddr.Tag); + //Assert.AreEqual(expected.BillAddr.Note, actual.BillAddr.Note); + //Assert.AreEqual(expected.ShipAddr.Line1, actual.ShipAddr.Line1); + //Assert.AreEqual(expected.ShipAddr.Line2, actual.ShipAddr.Line2); + //Assert.AreEqual(expected.ShipAddr.Line3, actual.ShipAddr.Line3); + //Assert.AreEqual(expected.ShipAddr.Line4, actual.ShipAddr.Line4); + //Assert.AreEqual(expected.ShipAddr.Line5, actual.ShipAddr.Line5); + //Assert.AreEqual(expected.ShipAddr.City, actual.ShipAddr.City); + //Assert.AreEqual(expected.ShipAddr.Country, actual.ShipAddr.Country); + //Assert.AreEqual(expected.ShipAddr.CountryCode, actual.ShipAddr.CountryCode); + //Assert.AreEqual(expected.ShipAddr.CountrySubDivisionCode, actual.ShipAddr.CountrySubDivisionCode); + //Assert.AreEqual(expected.ShipAddr.PostalCode, actual.ShipAddr.PostalCode); + //Assert.AreEqual(expected.ShipAddr.PostalCodeSuffix, actual.ShipAddr.PostalCodeSuffix); + //Assert.AreEqual(expected.ShipAddr.Lat, actual.ShipAddr.Lat); + //Assert.AreEqual(expected.ShipAddr.Long, actual.ShipAddr.Long); + //Assert.AreEqual(expected.ShipAddr.Tag, actual.ShipAddr.Tag); + //Assert.AreEqual(expected.ShipAddr.Note, actual.ShipAddr.Note); + //Assert.AreEqual(expected.RemitToRef.name, actual.RemitToRef.name); + //Assert.AreEqual(expected.RemitToRef.type, actual.RemitToRef.type); + //Assert.AreEqual(expected.RemitToRef.Value, actual.RemitToRef.Value); + //Assert.AreEqual(expected.ClassRef.name, actual.ClassRef.name); + //Assert.AreEqual(expected.ClassRef.type, actual.ClassRef.type); + //Assert.AreEqual(expected.ClassRef.Value, actual.ClassRef.Value); + //Assert.AreEqual(expected.SalesTermRef.name, actual.SalesTermRef.name); + //Assert.AreEqual(expected.SalesTermRef.type, actual.SalesTermRef.type); + //Assert.AreEqual(expected.SalesTermRef.Value, actual.SalesTermRef.Value); + Assert.AreEqual(expected.DueDate, actual.DueDate); + Assert.AreEqual(expected.DueDateSpecified, actual.DueDateSpecified); + //Assert.AreEqual(expected.SalesRepRef.name, actual.SalesRepRef.name); + //Assert.AreEqual(expected.SalesRepRef.type, actual.SalesRepRef.type); + //Assert.AreEqual(expected.SalesRepRef.Value, actual.SalesRepRef.Value); + Assert.AreEqual(expected.PONumber, actual.PONumber); + Assert.AreEqual(expected.FOB, actual.FOB); + //Assert.AreEqual(expected.ShipMethodRef.name, actual.ShipMethodRef.name); + //Assert.AreEqual(expected.ShipMethodRef.type, actual.ShipMethodRef.type); + //Assert.AreEqual(expected.ShipMethodRef.Value, actual.ShipMethodRef.Value); + Assert.AreEqual(expected.ShipDate, actual.ShipDate); + Assert.AreEqual(expected.ShipDateSpecified, actual.ShipDateSpecified); + Assert.AreEqual(expected.TrackingNum, actual.TrackingNum); + //Assert.AreEqual(expected.GlobalTaxCalculationSpecified, actual.GlobalTaxCalculationSpecified); + Assert.AreEqual(expected.TotalAmt, actual.TotalAmt); + Assert.AreEqual(expected.TotalAmtSpecified, actual.TotalAmtSpecified); + //Assert.AreEqual(expected.HomeTotalAmt, actual.HomeTotalAmt); + //Assert.AreEqual(expected.HomeTotalAmtSpecified, actual.HomeTotalAmtSpecified); + Assert.AreEqual(expected.ApplyTaxAfterDiscount, actual.ApplyTaxAfterDiscount); + //Assert.AreEqual(expected.ApplyTaxAfterDiscountSpecified, actual.ApplyTaxAfterDiscountSpecified); //Fails for global realms + //Assert.AreEqual(expected.TemplateRef.name, actual.TemplateRef.name); + //Assert.AreEqual(expected.TemplateRef.type, actual.TemplateRef.type); + //Assert.AreEqual(expected.TemplateRef.Value, actual.TemplateRef.Value); + Assert.AreEqual(expected.PrintStatusSpecified, actual.PrintStatusSpecified); + Assert.AreEqual(expected.EmailStatusSpecified, actual.EmailStatusSpecified); + //Assert.AreEqual(expected.BillEmail.Address, actual.BillEmail.Address); + //Assert.AreEqual(expected.BillEmail.Default, actual.BillEmail.Default); + //Assert.AreEqual(expected.BillEmail.DefaultSpecified, actual.BillEmail.DefaultSpecified); + //Assert.AreEqual(expected.BillEmail.Tag, actual.BillEmail.Tag); + //Assert.AreEqual(expected.ARAccountRef.name, actual.ARAccountRef.name); + //Assert.AreEqual(expected.ARAccountRef.type, actual.ARAccountRef.type); + //Assert.AreEqual(expected.ARAccountRef.Value, actual.ARAccountRef.Value); + Assert.AreEqual(expected.Balance, actual.Balance); + Assert.AreEqual(expected.BalanceSpecified, actual.BalanceSpecified); + Assert.AreEqual(expected.FinanceCharge, actual.FinanceCharge); + Assert.AreEqual(expected.FinanceChargeSpecified, actual.FinanceChargeSpecified); + //Assert.AreEqual(expected.PaymentMethodRef.name, actual.PaymentMethodRef.name); + //Assert.AreEqual(expected.PaymentMethodRef.type, actual.PaymentMethodRef.type); + //Assert.AreEqual(expected.PaymentMethodRef.Value, actual.PaymentMethodRef.Value); + Assert.AreEqual(expected.PaymentRefNum, actual.PaymentRefNum); + Assert.AreEqual(expected.PaymentTypeSpecified, actual.PaymentTypeSpecified); + //Assert.AreEqual(expected.AnyIntuitObject, actual.AnyIntuitObject); //IgnoreReason: + //Assert.AreEqual(expected.DepositToAccountRef.name, actual.DepositToAccountRef.name); + //Assert.AreEqual(expected.DepositToAccountRef.type, actual.DepositToAccountRef.type); + //Assert.AreEqual(expected.DepositToAccountRef.Value, actual.DepositToAccountRef.Value); + //Assert.AreEqual(expected.DocNumber, actual.DocNumber); + Assert.AreEqual(expected.TxnDate, actual.TxnDate); + Assert.AreEqual(expected.TxnDateSpecified, actual.TxnDateSpecified); + //Assert.AreEqual(expected.DepartmentRef.name, actual.DepartmentRef.name); + //Assert.AreEqual(expected.DepartmentRef.type, actual.DepartmentRef.type); + //Assert.AreEqual(expected.DepartmentRef.Value, actual.DepartmentRef.Value); + //Assert.AreEqual(expected.CurrencyRef.name, actual.CurrencyRef.name); + //Assert.AreEqual(expected.CurrencyRef.type, actual.CurrencyRef.type); + //Assert.AreEqual(expected.CurrencyRef.Value, actual.CurrencyRef.Value); + //Assert.AreEqual(expected.ExchangeRate, actual.ExchangeRate); + //Assert.AreEqual(expected.ExchangeRateSpecified, actual.ExchangeRateSpecified); + Assert.AreEqual(expected.PrivateNote, actual.PrivateNote); + Assert.AreEqual(expected.TxnStatus, actual.TxnStatus); + Assert.IsTrue(Helper.CheckEqual(expected.LinkedTxn, actual.LinkedTxn)); + Assert.IsTrue(Helper.CheckEqual(expected.Line, actual.Line)); + //Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.name, actual.TxnTaxDetail.DefaultTaxCodeRef.name); + //Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.type, actual.TxnTaxDetail.DefaultTaxCodeRef.type); + //Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.Value, actual.TxnTaxDetail.DefaultTaxCodeRef.Value); + //Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.name, actual.TxnTaxDetail.TxnTaxCodeRef.name); + //Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.type, actual.TxnTaxDetail.TxnTaxCodeRef.type); + //Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.Value, actual.TxnTaxDetail.TxnTaxCodeRef.Value); + //Assert.AreEqual(expected.TxnTaxDetail.TotalTax, actual.TxnTaxDetail.TotalTax); + //Assert.AreEqual(expected.TxnTaxDetail.TotalTaxSpecified, actual.TxnTaxDetail.TotalTaxSpecified); + //Assert.IsTrue(Helper.CheckEqual(expected.TxnTaxDetail.TaxLine, actual.TxnTaxDetail.TaxLine)); + } + + + + internal static void VerifyInvoiceSparseUpdate(Invoice expected, Invoice actual) + { + Assert.AreEqual(expected.DocNumber, actual.DocNumber); + } + + + + internal static void VerifySalesReceipt(SalesReceipt expected, SalesReceipt actual) + { + //Assert.AreEqual(expected.SalesReceiptEx.Any, actual.SalesReceiptEx.Any); + //Assert.AreEqual(expected.AutoDocNumber, actual.AutoDocNumber); + //Assert.AreEqual(expected.AutoDocNumberSpecified, actual.AutoDocNumberSpecified); + //Assert.AreEqual(expected.CustomerRef.name, actual.CustomerRef.name); + //Assert.AreEqual(expected.CustomerRef.type, actual.CustomerRef.type); + //Assert.AreEqual(expected.CustomerRef.Value, actual.CustomerRef.Value); + //Assert.AreEqual(expected.CustomerMemo.id, actual.CustomerMemo.id); + //Assert.AreEqual(expected.CustomerMemo.Value, actual.CustomerMemo.Value); + //Assert.AreEqual(expected.BillAddr.Line1, actual.BillAddr.Line1); + //Assert.AreEqual(expected.BillAddr.Line2, actual.BillAddr.Line2); + //Assert.AreEqual(expected.BillAddr.Line3, actual.BillAddr.Line3); + //Assert.AreEqual(expected.BillAddr.Line4, actual.BillAddr.Line4); + //Assert.AreEqual(expected.BillAddr.Line5, actual.BillAddr.Line5); + //Assert.AreEqual(expected.BillAddr.City, actual.BillAddr.City); + //Assert.AreEqual(expected.BillAddr.Country, actual.BillAddr.Country); + //Assert.AreEqual(expected.BillAddr.CountryCode, actual.BillAddr.CountryCode); + //Assert.AreEqual(expected.BillAddr.CountrySubDivisionCode, actual.BillAddr.CountrySubDivisionCode); + //Assert.AreEqual(expected.BillAddr.PostalCode, actual.BillAddr.PostalCode); + //Assert.AreEqual(expected.BillAddr.PostalCodeSuffix, actual.BillAddr.PostalCodeSuffix); + //Assert.AreEqual(expected.BillAddr.Lat, actual.BillAddr.Lat); + //Assert.AreEqual(expected.BillAddr.Long, actual.BillAddr.Long); + //Assert.AreEqual(expected.BillAddr.Tag, actual.BillAddr.Tag); + //Assert.AreEqual(expected.BillAddr.Note, actual.BillAddr.Note); + //Assert.AreEqual(expected.ShipAddr.Line1, actual.ShipAddr.Line1); + //Assert.AreEqual(expected.ShipAddr.Line2, actual.ShipAddr.Line2); + //Assert.AreEqual(expected.ShipAddr.Line3, actual.ShipAddr.Line3); + //Assert.AreEqual(expected.ShipAddr.Line4, actual.ShipAddr.Line4); + //Assert.AreEqual(expected.ShipAddr.Line5, actual.ShipAddr.Line5); + //Assert.AreEqual(expected.ShipAddr.City, actual.ShipAddr.City); + //Assert.AreEqual(expected.ShipAddr.Country, actual.ShipAddr.Country); + //Assert.AreEqual(expected.ShipAddr.CountryCode, actual.ShipAddr.CountryCode); + //Assert.AreEqual(expected.ShipAddr.CountrySubDivisionCode, actual.ShipAddr.CountrySubDivisionCode); + //Assert.AreEqual(expected.ShipAddr.PostalCode, actual.ShipAddr.PostalCode); + //Assert.AreEqual(expected.ShipAddr.PostalCodeSuffix, actual.ShipAddr.PostalCodeSuffix); + //Assert.AreEqual(expected.ShipAddr.Lat, actual.ShipAddr.Lat); + //Assert.AreEqual(expected.ShipAddr.Long, actual.ShipAddr.Long); + //Assert.AreEqual(expected.ShipAddr.Tag, actual.ShipAddr.Tag); + //Assert.AreEqual(expected.ShipAddr.Note, actual.ShipAddr.Note); + //Assert.AreEqual(expected.RemitToRef.name, actual.RemitToRef.name); + //Assert.AreEqual(expected.RemitToRef.type, actual.RemitToRef.type); + //Assert.AreEqual(expected.RemitToRef.Value, actual.RemitToRef.Value); + //Assert.AreEqual(expected.ClassRef.name, actual.ClassRef.name); + //Assert.AreEqual(expected.ClassRef.type, actual.ClassRef.type); + //Assert.AreEqual(expected.ClassRef.Value, actual.ClassRef.Value); + //Assert.AreEqual(expected.SalesTermRef.name, actual.SalesTermRef.name); + //Assert.AreEqual(expected.SalesTermRef.type, actual.SalesTermRef.type); + //Assert.AreEqual(expected.SalesTermRef.Value, actual.SalesTermRef.Value); + //Assert.AreEqual(expected.DueDate, actual.DueDate); + //Assert.AreEqual(expected.DueDateSpecified, actual.DueDateSpecified); + //Assert.AreEqual(expected.SalesRepRef.name, actual.SalesRepRef.name); + //Assert.AreEqual(expected.SalesRepRef.type, actual.SalesRepRef.type); + //Assert.AreEqual(expected.SalesRepRef.Value, actual.SalesRepRef.Value); + //Assert.AreEqual(expected.PONumber, actual.PONumber); + //Assert.AreEqual(expected.FOB, actual.FOB); + // Assert.AreEqual(expected.ShipMethodRef.name, actual.ShipMethodRef.name); + // Assert.AreEqual(expected.ShipMethodRef.type, actual.ShipMethodRef.type); + // Assert.AreEqual(expected.ShipMethodRef.Value, actual.ShipMethodRef.Value); + Assert.AreEqual(expected.ShipDate, actual.ShipDate); + Assert.AreEqual(expected.ShipDateSpecified, actual.ShipDateSpecified); + Assert.AreEqual(expected.TrackingNum, actual.TrackingNum); + //Assert.AreEqual(expected.GlobalTaxCalculationSpecified, actual.GlobalTaxCalculationSpecified); + //Assert.AreEqual(expected.TotalAmt, actual.TotalAmt); + //Assert.AreEqual(expected.TotalAmtSpecified, actual.TotalAmtSpecified); + //Assert.AreEqual(expected.HomeTotalAmt, actual.HomeTotalAmt); + //Assert.AreEqual(expected.HomeTotalAmtSpecified, actual.HomeTotalAmtSpecified); + //Assert.AreEqual(expected.ApplyTaxAfterDiscount, actual.ApplyTaxAfterDiscount); + //Assert.AreEqual(expected.ApplyTaxAfterDiscountSpecified, actual.ApplyTaxAfterDiscountSpecified); + //Assert.AreEqual(expected.TemplateRef.name, actual.TemplateRef.name); + //Assert.AreEqual(expected.TemplateRef.type, actual.TemplateRef.type); + //Assert.AreEqual(expected.TemplateRef.Value, actual.TemplateRef.Value); + Assert.AreEqual(expected.PrintStatusSpecified, actual.PrintStatusSpecified); + Assert.AreEqual(expected.EmailStatusSpecified, actual.EmailStatusSpecified); + //Assert.AreEqual(expected.BillEmail.Address, actual.BillEmail.Address); + //Assert.AreEqual(expected.BillEmail.Default, actual.BillEmail.Default); + //Assert.AreEqual(expected.BillEmail.DefaultSpecified, actual.BillEmail.DefaultSpecified); + //Assert.AreEqual(expected.BillEmail.Tag, actual.BillEmail.Tag); + //Assert.AreEqual(expected.ARAccountRef.name, actual.ARAccountRef.name); + //Assert.AreEqual(expected.ARAccountRef.type, actual.ARAccountRef.type); + //Assert.AreEqual(expected.ARAccountRef.Value, actual.ARAccountRef.Value); + //Assert.AreEqual(expected.Balance, actual.Balance); + //Assert.AreEqual(expected.BalanceSpecified, actual.BalanceSpecified); + //Assert.AreEqual(expected.FinanceCharge, actual.FinanceCharge); + //Assert.AreEqual(expected.FinanceChargeSpecified, actual.FinanceChargeSpecified); + //Assert.AreEqual(expected.PaymentMethodRef.name, actual.PaymentMethodRef.name); + //Assert.AreEqual(expected.PaymentMethodRef.type, actual.PaymentMethodRef.type); + //Assert.AreEqual(expected.PaymentMethodRef.Value, actual.PaymentMethodRef.Value); + Assert.AreEqual(expected.PaymentRefNum, actual.PaymentRefNum); + //Assert.AreEqual(expected.PaymentTypeSpecified, actual.PaymentTypeSpecified); + //Assert.AreEqual(expected.AnyIntuitObject, actual.AnyIntuitObject); + //Assert.AreEqual(expected.DepositToAccountRef.name, actual.DepositToAccountRef.name); + //Assert.AreEqual(expected.DepositToAccountRef.type, actual.DepositToAccountRef.type); + //Assert.AreEqual(expected.DepositToAccountRef.Value, actual.DepositToAccountRef.Value); + Assert.AreEqual(expected.DocNumber, actual.DocNumber); + Assert.AreEqual(expected.TxnDate, actual.TxnDate); + Assert.AreEqual(expected.TxnDateSpecified, actual.TxnDateSpecified); + //Assert.AreEqual(expected.DepartmentRef.name, actual.DepartmentRef.name); + //Assert.AreEqual(expected.DepartmentRef.type, actual.DepartmentRef.type); + //Assert.AreEqual(expected.DepartmentRef.Value, actual.DepartmentRef.Value); + //Assert.AreEqual(expected.CurrencyRef.name, actual.CurrencyRef.name); + //Assert.AreEqual(expected.CurrencyRef.type, actual.CurrencyRef.type); + //Assert.AreEqual(expected.CurrencyRef.Value, actual.CurrencyRef.Value); + //Assert.AreEqual(expected.ExchangeRate, actual.ExchangeRate); + //Assert.AreEqual(expected.ExchangeRateSpecified, actual.ExchangeRateSpecified); + Assert.AreEqual(expected.PrivateNote, actual.PrivateNote); + //Assert.AreEqual(expected.TxnStatus, actual.TxnStatus); + //Assert.IsTrue(Helper.CheckEqual(expected.LinkedTxn, actual.LinkedTxn)); + Assert.IsTrue(Helper.CheckEqual(expected.Line, actual.Line)); + //Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.name, actual.TxnTaxDetail.DefaultTaxCodeRef.name); + //Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.type, actual.TxnTaxDetail.DefaultTaxCodeRef.type); + //Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.Value, actual.TxnTaxDetail.DefaultTaxCodeRef.Value); + //Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.name, actual.TxnTaxDetail.TxnTaxCodeRef.name); + //Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.type, actual.TxnTaxDetail.TxnTaxCodeRef.type); + //Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.Value, actual.TxnTaxDetail.TxnTaxCodeRef.Value); + //Assert.AreEqual(expected.TxnTaxDetail.TotalTax, actual.TxnTaxDetail.TotalTax); + //Assert.AreEqual(expected.TxnTaxDetail.TotalTaxSpecified, actual.TxnTaxDetail.TotalTaxSpecified); + //Assert.IsTrue(Helper.CheckEqual(expected.TxnTaxDetail.TaxLine, actual.TxnTaxDetail.TaxLine)); + } + + + + internal static void VerifySalesReceiptSparseUpdate(SalesReceipt expected, SalesReceipt actual) + { + Assert.AreEqual(expected.PrintStatus, actual.PrintStatus); + } + + + + internal static void VerifyEstimate(Estimate expected, Estimate actual) + { + Assert.AreEqual(expected.ExpirationDate, actual.ExpirationDate); + Assert.AreEqual(expected.ExpirationDateSpecified, actual.ExpirationDateSpecified); + Assert.AreEqual(expected.AcceptedBy, actual.AcceptedBy); + Assert.AreEqual(expected.AcceptedDate, actual.AcceptedDate); + Assert.AreEqual(expected.AcceptedDateSpecified, actual.AcceptedDateSpecified); + //Assert.AreEqual(expected.EstimateEx.Any, actual.EstimateEx.Any); + Assert.AreEqual(expected.AutoDocNumber, actual.AutoDocNumber); + Assert.AreEqual(expected.AutoDocNumberSpecified, actual.AutoDocNumberSpecified); + Assert.AreEqual(expected.CustomerRef.name, actual.CustomerRef.name); + Assert.AreEqual(expected.CustomerRef.type, actual.CustomerRef.type); + Assert.AreEqual(expected.CustomerRef.Value, actual.CustomerRef.Value); + //Assert.AreEqual(expected.CustomerMemo.id, actual.CustomerMemo.id); + //Assert.AreEqual(expected.CustomerMemo.Value, actual.CustomerMemo.Value); + //Assert.AreEqual(expected.BillAddr.Line1, actual.BillAddr.Line1); + //Assert.AreEqual(expected.BillAddr.Line2, actual.BillAddr.Line2); + //Assert.AreEqual(expected.BillAddr.Line3, actual.BillAddr.Line3); + //Assert.AreEqual(expected.BillAddr.Line4, actual.BillAddr.Line4); + //Assert.AreEqual(expected.BillAddr.Line5, actual.BillAddr.Line5); + //Assert.AreEqual(expected.BillAddr.City, actual.BillAddr.City); + //Assert.AreEqual(expected.BillAddr.Country, actual.BillAddr.Country); + //Assert.AreEqual(expected.BillAddr.CountryCode, actual.BillAddr.CountryCode); + //Assert.AreEqual(expected.BillAddr.CountrySubDivisionCode, actual.BillAddr.CountrySubDivisionCode); + //Assert.AreEqual(expected.BillAddr.PostalCode, actual.BillAddr.PostalCode); + //Assert.AreEqual(expected.BillAddr.PostalCodeSuffix, actual.BillAddr.PostalCodeSuffix); + //Assert.AreEqual(expected.BillAddr.Lat, actual.BillAddr.Lat); + //Assert.AreEqual(expected.BillAddr.Long, actual.BillAddr.Long); + //Assert.AreEqual(expected.BillAddr.Tag, actual.BillAddr.Tag); + //Assert.AreEqual(expected.BillAddr.Note, actual.BillAddr.Note); + //Assert.AreEqual(expected.ShipAddr.Line1, actual.ShipAddr.Line1); + //Assert.AreEqual(expected.ShipAddr.Line2, actual.ShipAddr.Line2); + //Assert.AreEqual(expected.ShipAddr.Line3, actual.ShipAddr.Line3); + //Assert.AreEqual(expected.ShipAddr.Line4, actual.ShipAddr.Line4); + //Assert.AreEqual(expected.ShipAddr.Line5, actual.ShipAddr.Line5); + //Assert.AreEqual(expected.ShipAddr.City, actual.ShipAddr.City); + //Assert.AreEqual(expected.ShipAddr.Country, actual.ShipAddr.Country); + //Assert.AreEqual(expected.ShipAddr.CountryCode, actual.ShipAddr.CountryCode); + //Assert.AreEqual(expected.ShipAddr.CountrySubDivisionCode, actual.ShipAddr.CountrySubDivisionCode); + //Assert.AreEqual(expected.ShipAddr.PostalCode, actual.ShipAddr.PostalCode); + //Assert.AreEqual(expected.ShipAddr.PostalCodeSuffix, actual.ShipAddr.PostalCodeSuffix); + //Assert.AreEqual(expected.ShipAddr.Lat, actual.ShipAddr.Lat); + //Assert.AreEqual(expected.ShipAddr.Long, actual.ShipAddr.Long); + //Assert.AreEqual(expected.ShipAddr.Tag, actual.ShipAddr.Tag); + //Assert.AreEqual(expected.ShipAddr.Note, actual.ShipAddr.Note); + //Assert.AreEqual(expected.RemitToRef.name, actual.RemitToRef.name); + //Assert.AreEqual(expected.RemitToRef.type, actual.RemitToRef.type); + //Assert.AreEqual(expected.RemitToRef.Value, actual.RemitToRef.Value); + //Assert.AreEqual(expected.ClassRef.name, actual.ClassRef.name); + //Assert.AreEqual(expected.ClassRef.type, actual.ClassRef.type); + //Assert.AreEqual(expected.ClassRef.Value, actual.ClassRef.Value); + //Assert.AreEqual(expected.SalesTermRef.name, actual.SalesTermRef.name); + //Assert.AreEqual(expected.SalesTermRef.type, actual.SalesTermRef.type); + //Assert.AreEqual(expected.SalesTermRef.Value, actual.SalesTermRef.Value); + //Assert.AreEqual(expected.DueDate, actual.DueDate); + //Assert.AreEqual(expected.DueDateSpecified, actual.DueDateSpecified); + //Assert.AreEqual(expected.SalesRepRef.name, actual.SalesRepRef.name); + //Assert.AreEqual(expected.SalesRepRef.type, actual.SalesRepRef.type); + //Assert.AreEqual(expected.SalesRepRef.Value, actual.SalesRepRef.Value); + //Assert.AreEqual(expected.PONumber, actual.PONumber); + //Assert.AreEqual(expected.FOB, actual.FOB); + //Assert.AreEqual(expected.ShipMethodRef.name, actual.ShipMethodRef.name); + //Assert.AreEqual(expected.ShipMethodRef.type, actual.ShipMethodRef.type); + //Assert.AreEqual(expected.ShipMethodRef.Value, actual.ShipMethodRef.Value); + //Assert.AreEqual(expected.ShipDate, actual.ShipDate); + //Assert.AreEqual(expected.ShipDateSpecified, actual.ShipDateSpecified); + //Assert.AreEqual(expected.TrackingNum, actual.TrackingNum); + //Assert.AreEqual(expected.GlobalTaxCalculationSpecified, actual.GlobalTaxCalculationSpecified); + //Assert.AreEqual(expected.TotalAmt, actual.TotalAmt); + //Assert.AreEqual(expected.TotalAmtSpecified, actual.TotalAmtSpecified); + //Assert.AreEqual(expected.HomeTotalAmt, actual.HomeTotalAmt); + //Assert.AreEqual(expected.HomeTotalAmtSpecified, actual.HomeTotalAmtSpecified); + Assert.AreEqual(expected.ApplyTaxAfterDiscount, actual.ApplyTaxAfterDiscount); + //Assert.AreEqual(expected.ApplyTaxAfterDiscountSpecified, actual.ApplyTaxAfterDiscountSpecified); + //Assert.AreEqual(expected.TemplateRef.name, actual.TemplateRef.name); + //Assert.AreEqual(expected.TemplateRef.type, actual.TemplateRef.type); + //Assert.AreEqual(expected.TemplateRef.Value, actual.TemplateRef.Value); + //Assert.AreEqual(expected.PrintStatusSpecified, actual.PrintStatusSpecified); + //Assert.AreEqual(expected.EmailStatusSpecified, actual.EmailStatusSpecified); + //Assert.AreEqual(expected.BillEmail.Address, actual.BillEmail.Address); + //Assert.AreEqual(expected.BillEmail.Default, actual.BillEmail.Default); + //Assert.AreEqual(expected.BillEmail.DefaultSpecified, actual.BillEmail.DefaultSpecified); + //Assert.AreEqual(expected.BillEmail.Tag, actual.BillEmail.Tag); + //Assert.AreEqual(expected.ARAccountRef.name, actual.ARAccountRef.name); + //Assert.AreEqual(expected.ARAccountRef.type, actual.ARAccountRef.type); + //Assert.AreEqual(expected.ARAccountRef.Value, actual.ARAccountRef.Value); + //Assert.AreEqual(expected.Balance, actual.Balance); + //Assert.AreEqual(expected.BalanceSpecified, actual.BalanceSpecified); + //Assert.AreEqual(expected.FinanceCharge, actual.FinanceCharge); + //Assert.AreEqual(expected.FinanceChargeSpecified, actual.FinanceChargeSpecified); + //Assert.AreEqual(expected.PaymentMethodRef.name, actual.PaymentMethodRef.name); + //Assert.AreEqual(expected.PaymentMethodRef.type, actual.PaymentMethodRef.type); + //Assert.AreEqual(expected.PaymentMethodRef.Value, actual.PaymentMethodRef.Value); + //Assert.AreEqual(expected.PaymentRefNum, actual.PaymentRefNum); + //Assert.AreEqual(expected.PaymentTypeSpecified, actual.PaymentTypeSpecified); + //Assert.AreEqual(expected.AnyIntuitObject, actual.AnyIntuitObject); + //Assert.AreEqual(expected.DepositToAccountRef.name, actual.DepositToAccountRef.name); + //Assert.AreEqual(expected.DepositToAccountRef.type, actual.DepositToAccountRef.type); + //Assert.AreEqual(expected.DepositToAccountRef.Value, actual.DepositToAccountRef.Value); + //Assert.AreEqual(expected.DocNumber, actual.DocNumber); + //Assert.AreEqual(expected.TxnDate, actual.TxnDate); + //Assert.AreEqual(expected.TxnDateSpecified, actual.TxnDateSpecified); + // Assert.AreEqual(expected.DepartmentRef.name, actual.DepartmentRef.name); + // Assert.AreEqual(expected.DepartmentRef.type, actual.DepartmentRef.type); + // Assert.AreEqual(expected.DepartmentRef.Value, actual.DepartmentRef.Value); + // Assert.AreEqual(expected.CurrencyRef.name, actual.CurrencyRef.name); + // Assert.AreEqual(expected.CurrencyRef.type, actual.CurrencyRef.type); + // Assert.AreEqual(expected.CurrencyRef.Value, actual.CurrencyRef.Value); + //Assert.AreEqual(expected.ExchangeRate, actual.ExchangeRate); + //Assert.AreEqual(expected.ExchangeRateSpecified, actual.ExchangeRateSpecified); + //Assert.AreEqual(expected.PrivateNote, actual.PrivateNote); + //Assert.AreEqual(expected.TxnStatus, actual.TxnStatus); + //Assert.IsTrue(Helper.CheckEqual(expected.LinkedTxn, actual.LinkedTxn)); + Assert.IsTrue(Helper.CheckEqual(expected.Line, actual.Line)); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.name, actual.TxnTaxDetail.DefaultTaxCodeRef.name); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.type, actual.TxnTaxDetail.DefaultTaxCodeRef.type); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.Value, actual.TxnTaxDetail.DefaultTaxCodeRef.Value); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.name, actual.TxnTaxDetail.TxnTaxCodeRef.name); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.type, actual.TxnTaxDetail.TxnTaxCodeRef.type); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.Value, actual.TxnTaxDetail.TxnTaxCodeRef.Value); + //Assert.AreEqual(expected.TxnTaxDetail.TotalTax, actual.TxnTaxDetail.TotalTax); + //Assert.AreEqual(expected.TxnTaxDetail.TotalTaxSpecified, actual.TxnTaxDetail.TotalTaxSpecified); + //Assert.IsTrue(Helper.CheckEqual(expected.TxnTaxDetail.TaxLine, actual.TxnTaxDetail.TaxLine)); + } + + + internal static void VerifyEstimateSparseUpdate(Estimate expected, Estimate actual) + { + Assert.AreEqual(expected.ExpirationDate, actual.ExpirationDate); + Assert.AreEqual(expected.TxnDate, actual.TxnDate); + } + + + + internal static void VerifyExchangeRate(ExchangeRate expected, ExchangeRate actual) + { + Assert.AreEqual(expected.SourceCurrencyCode, actual.SourceCurrencyCode); + Assert.AreEqual(expected.TargetCurrencyCode, actual.TargetCurrencyCode); + Assert.AreEqual(expected.Rate, actual.Rate); + Assert.AreEqual(expected.RateSpecified, actual.RateSpecified); + Assert.AreEqual(expected.AsOfDate, actual.AsOfDate); + Assert.AreEqual(expected.AsOfDateSpecified, actual.AsOfDateSpecified); + } + + + internal static void VerifyExchangeRateSparse(ExchangeRate expected, ExchangeRate actual) + { + Assert.AreEqual(expected.SourceCurrencyCode, actual.SourceCurrencyCode); + Assert.AreEqual(expected.TargetCurrencyCode, actual.TargetCurrencyCode); + Assert.AreEqual(expected.Rate, actual.Rate); + Assert.AreEqual(expected.RateSpecified, actual.RateSpecified); + Assert.AreEqual(expected.AsOfDate, actual.AsOfDate); + Assert.AreEqual(expected.AsOfDateSpecified, actual.AsOfDateSpecified); + } + + + internal static void VerifyFixedAsset(FixedAsset expected, FixedAsset actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.Active, actual.Active); + Assert.AreEqual(expected.ActiveSpecified, actual.ActiveSpecified); + Assert.AreEqual(expected.AcquiredAsSpecified, actual.AcquiredAsSpecified); + Assert.AreEqual(expected.PurchaseDesc, actual.PurchaseDesc); + Assert.AreEqual(expected.PurchaseDate, actual.PurchaseDate); + Assert.AreEqual(expected.PurchaseDateSpecified, actual.PurchaseDateSpecified); + Assert.AreEqual(expected.PurchaseCost, actual.PurchaseCost); + Assert.AreEqual(expected.PurchaseCostSpecified, actual.PurchaseCostSpecified); + //Assert.AreEqual(expected.Vendor, actual.Vendor); + //Assert.AreEqual(expected.AssetAccountRef.name, actual.AssetAccountRef.name); + //Assert.AreEqual(expected.AssetAccountRef.type, actual.AssetAccountRef.type); + //Assert.AreEqual(expected.AssetAccountRef.Value, actual.AssetAccountRef.Value); + Assert.AreEqual(expected.SalesDesc, actual.SalesDesc); + Assert.AreEqual(expected.SalesDate, actual.SalesDate); + Assert.AreEqual(expected.SalesDateSpecified, actual.SalesDateSpecified); + Assert.AreEqual(expected.SalesPrice, actual.SalesPrice); + Assert.AreEqual(expected.SalesPriceSpecified, actual.SalesPriceSpecified); + Assert.AreEqual(expected.SalesExpense, actual.SalesExpense); + Assert.AreEqual(expected.SalesExpenseSpecified, actual.SalesExpenseSpecified); + Assert.AreEqual(expected.Location, actual.Location); + Assert.AreEqual(expected.PONumber, actual.PONumber); + Assert.AreEqual(expected.SerialNumber, actual.SerialNumber); + Assert.AreEqual(expected.WarrantyExpDate, actual.WarrantyExpDate); + Assert.AreEqual(expected.WarrantyExpDateSpecified, actual.WarrantyExpDateSpecified); + Assert.AreEqual(expected.Description, actual.Description); + Assert.AreEqual(expected.Notes, actual.Notes); + Assert.AreEqual(expected.AssetNum, actual.AssetNum); + Assert.AreEqual(expected.AssetNumSpecified, actual.AssetNumSpecified); + Assert.AreEqual(expected.CostBasis, actual.CostBasis); + Assert.AreEqual(expected.CostBasisSpecified, actual.CostBasisSpecified); + Assert.AreEqual(expected.Depreciation, actual.Depreciation); + Assert.AreEqual(expected.DepreciationSpecified, actual.DepreciationSpecified); + Assert.AreEqual(expected.BookValue, actual.BookValue); + Assert.AreEqual(expected.BookValueSpecified, actual.BookValueSpecified); + //Assert.AreEqual(expected.FixedAssetEx.Any, actual.FixedAssetEx.Any); + } + + + internal static void VerifyFixedAssetSparse(FixedAsset expected, FixedAsset actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.SalesDesc, actual.SalesDesc); + } + + internal static void VerifyTaxCode(TaxCode expected, TaxCode actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.Description, actual.Description); + //Assert.AreEqual(expected.Active, actual.Active); + //Assert.AreEqual(expected.ActiveSpecified, actual.ActiveSpecified); + Assert.AreEqual(expected.Taxable, actual.Taxable); + //Assert.AreEqual(expected.TaxableSpecified, actual.TaxableSpecified); + Assert.AreEqual(expected.TaxGroup, actual.TaxGroup); + //Assert.AreEqual(expected.TaxGroupSpecified, actual.TaxGroupSpecified); + //Assert.IsTrue(Helper.CheckEqual(expected.SalesTaxRateList.TaxRateDetail, actual.SalesTaxRateList.TaxRateDetail)); + //Assert.AreEqual(expected.SalesTaxRateList.originatingGroupId, actual.SalesTaxRateList.originatingGroupId); + //Assert.IsTrue(Helper.CheckEqual(expected.PurchaseTaxRateList.TaxRateDetail, actual.PurchaseTaxRateList.TaxRateDetail)); + //Assert.AreEqual(expected.PurchaseTaxRateList.originatingGroupId, actual.PurchaseTaxRateList.originatingGroupId); + //Assert.IsTrue(Helper.CheckEqual(expected.AdjustmentTaxRateList.TaxRateDetail, actual.AdjustmentTaxRateList.TaxRateDetail)); + //Assert.AreEqual(expected.AdjustmentTaxRateList.originatingGroupId, actual.AdjustmentTaxRateList.originatingGroupId); + //Assert.AreEqual(expected.TaxCodeEx.Any, actual.TaxCodeEx.Any); + } + + + internal static void VerifyTaxCodeSparseUpdate(TaxCode expected, TaxCode actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.Description, actual.Description); + } + + internal static void VerifyTaxRate(TaxRate expected, TaxRate actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.Description, actual.Description); + //Assert.AreEqual(expected.Active, actual.Active); + //Assert.AreEqual(expected.ActiveSpecified, actual.ActiveSpecified); + Assert.AreEqual(expected.RateValue, actual.RateValue); + //Assert.AreEqual(expected.RateValueSpecified, actual.RateValueSpecified); + // Assert.AreEqual(expected.AgencyRef.name, actual.AgencyRef.name); + // Assert.AreEqual(expected.AgencyRef.type, actual.AgencyRef.type); + // Assert.AreEqual(expected.AgencyRef.Value, actual.AgencyRef.Value); + // Assert.AreEqual(expected.TaxReturnLineRef.name, actual.TaxReturnLineRef.name); + // Assert.AreEqual(expected.TaxReturnLineRef.type, actual.TaxReturnLineRef.type); + // Assert.AreEqual(expected.TaxReturnLineRef.Value, actual.TaxReturnLineRef.Value); + Assert.IsTrue(Helper.CheckEqual(expected.EffectiveTaxRate, actual.EffectiveTaxRate)); + Assert.AreEqual(expected.SpecialTaxTypeSpecified, actual.SpecialTaxTypeSpecified); + Assert.AreEqual(expected.DisplayTypeSpecified, actual.DisplayTypeSpecified); + //Assert.AreEqual(expected.TaxRateEx.Any, actual.TaxRateEx.Any); + } + + + internal static void VerifyTaxRateSparseUpdate(TaxRate expected, TaxRate actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.Description, actual.Description); + } + + + internal static void VerifyAccountSparseUpdate(Account expected, Account actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.FullyQualifiedName, actual.FullyQualifiedName); + } + + + + + internal static void VerifyAccount(Account expected, Account actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.SubAccount, actual.SubAccount); + //Assert.AreEqual(expected.SubAccountSpecified, actual.SubAccountSpecified); + //Assert.AreEqual(expected.ParentRef.name, actual.ParentRef.name); + //Assert.AreEqual(expected.ParentRef.type, actual.ParentRef.type); + //Assert.AreEqual(expected.ParentRef.Value, actual.ParentRef.Value); + Assert.AreEqual(expected.Description, actual.Description); + Assert.AreEqual(expected.FullyQualifiedName, actual.FullyQualifiedName); + //Assert.AreEqual(expected.Active, actual.Active); + //Assert.AreEqual(expected.ActiveSpecified, actual.ActiveSpecified); + Assert.AreEqual(expected.ClassificationSpecified, actual.ClassificationSpecified); + Assert.AreEqual(expected.AccountTypeSpecified, actual.AccountTypeSpecified); + //Assert.AreEqual(expected.AccountSubType, actual.AccountSubType); + Assert.AreEqual(expected.AcctNum, actual.AcctNum); + Assert.AreEqual(expected.BankNum, actual.BankNum); + //Assert.AreEqual(expected.OpeningBalance, actual.OpeningBalance); + //Assert.AreEqual(expected.OpeningBalanceSpecified, actual.OpeningBalanceSpecified); + //Assert.AreEqual(expected.OpeningBalanceDate, actual.OpeningBalanceDate); + //Assert.AreEqual(expected.OpeningBalanceDateSpecified, actual.OpeningBalanceDateSpecified); + //Assert.AreEqual(expected.CurrentBalance, actual.CurrentBalance); + //Assert.AreEqual(expected.CurrentBalanceSpecified, actual.CurrentBalanceSpecified); + //Assert.AreEqual(expected.CurrentBalanceWithSubAccounts, actual.CurrentBalanceWithSubAccounts); + //Assert.AreEqual(expected.CurrentBalanceWithSubAccountsSpecified, actual.CurrentBalanceWithSubAccountsSpecified); + Assert.AreEqual(expected.CurrencyRef.name, actual.CurrencyRef.name); + //Assert.AreEqual(expected.CurrencyRef.type, actual.CurrencyRef.type); + Assert.AreEqual(expected.CurrencyRef.Value, actual.CurrencyRef.Value); + Assert.AreEqual(expected.TaxAccount, actual.TaxAccount); + Assert.AreEqual(expected.TaxAccountSpecified, actual.TaxAccountSpecified); + //Assert.AreEqual(expected.TaxCodeRef.name, actual.TaxCodeRef.name); + //Assert.AreEqual(expected.TaxCodeRef.type, actual.TaxCodeRef.type); + //Assert.AreEqual(expected.TaxCodeRef.Value, actual.TaxCodeRef.Value); + //Assert.AreEqual(expected.AccountEx.Any, actual.AccountEx.Any); + } + + // France + internal static void VerifyAccountFrance(Account expected, Account actual) + { + + Assert.AreEqual(expected.Name, actual.Name); + //Assert.AreEqual(expected.AccountAlias, actual.AccountAlias); + //Assert.AreEqual(expected.TxnLocationType, actual.TxnLocationType); + //Assert.AreEqual(expected.AcctNum, actual.AcctNum); + Assert.AreEqual(expected.FullyQualifiedName, actual.FullyQualifiedName); + Assert.AreEqual(expected.ClassificationSpecified, actual.ClassificationSpecified); + Assert.AreEqual(expected.AccountTypeSpecified, actual.AccountTypeSpecified); + Assert.AreEqual(expected.AcctNum, actual.AcctNum); + + } + + + internal static void VerifyPurchase(Purchase expected, Purchase actual) + { + Assert.AreEqual(expected.AccountRef.name, actual.AccountRef.name); + Assert.AreEqual(expected.AccountRef.type, actual.AccountRef.type); + Assert.AreEqual(expected.AccountRef.Value, actual.AccountRef.Value); + //Assert.AreEqual(expected.PaymentMethodRef.name, actual.PaymentMethodRef.name); + //Assert.AreEqual(expected.PaymentMethodRef.type, actual.PaymentMethodRef.type); + //Assert.AreEqual(expected.PaymentMethodRef.Value, actual.PaymentMethodRef.Value); + Assert.AreEqual(expected.PaymentRefNum, actual.PaymentRefNum); + Assert.AreEqual(expected.PaymentTypeSpecified, actual.PaymentTypeSpecified); + Assert.AreEqual(expected.AnyIntuitObject, actual.AnyIntuitObject); + Assert.AreEqual(expected.EntityRef.name, actual.EntityRef.name); + Assert.AreEqual(expected.EntityRef.type, actual.EntityRef.type); + Assert.AreEqual(expected.EntityRef.Value, actual.EntityRef.Value); + //Assert.AreEqual(expected.Credit, actual.Credit); + //Assert.AreEqual(expected.CreditSpecified, actual.CreditSpecified); + //Assert.AreEqual(expected.RemitToAddr.Line1, actual.RemitToAddr.Line1); + //Assert.AreEqual(expected.RemitToAddr.Line2, actual.RemitToAddr.Line2); + //Assert.AreEqual(expected.RemitToAddr.Line3, actual.RemitToAddr.Line3); + //Assert.AreEqual(expected.RemitToAddr.Line4, actual.RemitToAddr.Line4); + //Assert.AreEqual(expected.RemitToAddr.Line5, actual.RemitToAddr.Line5); + //Assert.AreEqual(expected.RemitToAddr.City, actual.RemitToAddr.City); + //Assert.AreEqual(expected.RemitToAddr.Country, actual.RemitToAddr.Country); + //Assert.AreEqual(expected.RemitToAddr.CountryCode, actual.RemitToAddr.CountryCode); + //Assert.AreEqual(expected.RemitToAddr.CountrySubDivisionCode, actual.RemitToAddr.CountrySubDivisionCode); + //Assert.AreEqual(expected.RemitToAddr.PostalCode, actual.RemitToAddr.PostalCode); + //Assert.AreEqual(expected.RemitToAddr.PostalCodeSuffix, actual.RemitToAddr.PostalCodeSuffix); + //Assert.AreEqual(expected.RemitToAddr.Lat, actual.RemitToAddr.Lat); + //Assert.AreEqual(expected.RemitToAddr.Long, actual.RemitToAddr.Long); + //Assert.AreEqual(expected.RemitToAddr.Tag, actual.RemitToAddr.Tag); + //Assert.AreEqual(expected.RemitToAddr.Note, actual.RemitToAddr.Note); + Assert.AreEqual(expected.TotalAmt, actual.TotalAmt); + Assert.AreEqual(expected.TotalAmtSpecified, actual.TotalAmtSpecified); + Assert.AreEqual(expected.TxnId, actual.TxnId); + Assert.AreEqual(expected.TxnNum, actual.TxnNum); + Assert.AreEqual(expected.Memo, actual.Memo); + //Assert.AreEqual(expected.PrintStatusSpecified, actual.PrintStatusSpecified); + //Assert.AreEqual(expected.GlobalTaxCalculationSpecified, actual.GlobalTaxCalculationSpecified); + //Assert.AreEqual(expected.PurchaseEx.Any, actual.PurchaseEx.Any); + Assert.AreEqual(expected.DocNumber, actual.DocNumber); + Assert.AreEqual(expected.TxnDate, actual.TxnDate); + Assert.AreEqual(expected.TxnDateSpecified, actual.TxnDateSpecified); + //Assert.AreEqual(expected.DepartmentRef.name, actual.DepartmentRef.name); + //Assert.AreEqual(expected.DepartmentRef.type, actual.DepartmentRef.type); + //Assert.AreEqual(expected.DepartmentRef.Value, actual.DepartmentRef.Value); + //Assert.AreEqual(expected.CurrencyRef.name, actual.CurrencyRef.name); + //Assert.AreEqual(expected.CurrencyRef.type, actual.CurrencyRef.type); + //Assert.AreEqual(expected.CurrencyRef.Value, actual.CurrencyRef.Value); + //Assert.AreEqual(expected.ExchangeRate, actual.ExchangeRate); + //Assert.AreEqual(expected.ExchangeRateSpecified, actual.ExchangeRateSpecified); + Assert.AreEqual(expected.PrivateNote, actual.PrivateNote); + Assert.AreEqual(expected.TxnStatus, actual.TxnStatus); + Assert.IsTrue(Helper.CheckEqual(expected.LinkedTxn, actual.LinkedTxn)); + Assert.IsTrue(Helper.CheckEqual(expected.Line, actual.Line)); + //Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.name, actual.TxnTaxDetail.DefaultTaxCodeRef.name); + //Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.type, actual.TxnTaxDetail.DefaultTaxCodeRef.type); + //Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.Value, actual.TxnTaxDetail.DefaultTaxCodeRef.Value); + //Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.name, actual.TxnTaxDetail.TxnTaxCodeRef.name); + //Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.type, actual.TxnTaxDetail.TxnTaxCodeRef.type); + //Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.Value, actual.TxnTaxDetail.TxnTaxCodeRef.Value); + //Assert.AreEqual(expected.TxnTaxDetail.TotalTax, actual.TxnTaxDetail.TotalTax); + //Assert.AreEqual(expected.TxnTaxDetail.TotalTaxSpecified, actual.TxnTaxDetail.TotalTaxSpecified); + //Assert.IsTrue(Helper.CheckEqual(expected.TxnTaxDetail.TaxLine, actual.TxnTaxDetail.TaxLine)); + } + + + + internal static void VerifyPurchaseSparseUpdate(Purchase expected, Purchase actual) + { + Assert.AreEqual(expected.TotalAmt, actual.TotalAmt); + } + + + + internal static void VerifyPurchaseByVendor(PurchaseByVendor expected, PurchaseByVendor actual) + { + Assert.AreEqual(expected.VendorRef.name, actual.VendorRef.name); + Assert.AreEqual(expected.VendorRef.type, actual.VendorRef.type); + Assert.AreEqual(expected.VendorRef.Value, actual.VendorRef.Value); + Assert.AreEqual(expected.APAccountRef.name, actual.APAccountRef.name); + Assert.AreEqual(expected.APAccountRef.type, actual.APAccountRef.type); + Assert.AreEqual(expected.APAccountRef.Value, actual.APAccountRef.Value); + Assert.AreEqual(expected.TotalAmt, actual.TotalAmt); + Assert.AreEqual(expected.TotalAmtSpecified, actual.TotalAmtSpecified); + Assert.AreEqual(expected.BillEmail.Address, actual.BillEmail.Address); + Assert.AreEqual(expected.BillEmail.Default, actual.BillEmail.Default); + Assert.AreEqual(expected.BillEmail.DefaultSpecified, actual.BillEmail.DefaultSpecified); + Assert.AreEqual(expected.BillEmail.Tag, actual.BillEmail.Tag); + Assert.AreEqual(expected.ReplyEmail.Address, actual.ReplyEmail.Address); + Assert.AreEqual(expected.ReplyEmail.Default, actual.ReplyEmail.Default); + Assert.AreEqual(expected.ReplyEmail.DefaultSpecified, actual.ReplyEmail.DefaultSpecified); + Assert.AreEqual(expected.ReplyEmail.Tag, actual.ReplyEmail.Tag); + Assert.AreEqual(expected.Memo, actual.Memo); + Assert.AreEqual(expected.GlobalTaxCalculationSpecified, actual.GlobalTaxCalculationSpecified); + Assert.AreEqual(expected.DocNumber, actual.DocNumber); + Assert.AreEqual(expected.TxnDate, actual.TxnDate); + Assert.AreEqual(expected.TxnDateSpecified, actual.TxnDateSpecified); + Assert.AreEqual(expected.DepartmentRef.name, actual.DepartmentRef.name); + Assert.AreEqual(expected.DepartmentRef.type, actual.DepartmentRef.type); + Assert.AreEqual(expected.DepartmentRef.Value, actual.DepartmentRef.Value); + Assert.AreEqual(expected.CurrencyRef.name, actual.CurrencyRef.name); + Assert.AreEqual(expected.CurrencyRef.type, actual.CurrencyRef.type); + Assert.AreEqual(expected.CurrencyRef.Value, actual.CurrencyRef.Value); + Assert.AreEqual(expected.ExchangeRate, actual.ExchangeRate); + Assert.AreEqual(expected.ExchangeRateSpecified, actual.ExchangeRateSpecified); + Assert.AreEqual(expected.PrivateNote, actual.PrivateNote); + Assert.AreEqual(expected.TxnStatus, actual.TxnStatus); + Assert.IsTrue(Helper.CheckEqual(expected.LinkedTxn, actual.LinkedTxn)); + Assert.IsTrue(Helper.CheckEqual(expected.Line, actual.Line)); + Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.name, actual.TxnTaxDetail.DefaultTaxCodeRef.name); + Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.type, actual.TxnTaxDetail.DefaultTaxCodeRef.type); + Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.Value, actual.TxnTaxDetail.DefaultTaxCodeRef.Value); + Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.name, actual.TxnTaxDetail.TxnTaxCodeRef.name); + Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.type, actual.TxnTaxDetail.TxnTaxCodeRef.type); + Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.Value, actual.TxnTaxDetail.TxnTaxCodeRef.Value); + Assert.AreEqual(expected.TxnTaxDetail.TotalTax, actual.TxnTaxDetail.TotalTax); + Assert.AreEqual(expected.TxnTaxDetail.TotalTaxSpecified, actual.TxnTaxDetail.TotalTaxSpecified); + Assert.IsTrue(Helper.CheckEqual(expected.TxnTaxDetail.TaxLine, actual.TxnTaxDetail.TaxLine)); + } + + + internal static void VerifyPurchaseByVendorSparse(PurchaseByVendor expected, PurchaseByVendor actual) + { + Assert.AreEqual(expected.Memo, actual.Memo); + } + + + internal static void VerifyBill(Bill expected, Bill actual) + { + //Assert.AreEqual(expected.PayerRef.name, actual.PayerRef.name); + //Assert.AreEqual(expected.PayerRef.type, actual.PayerRef.type); + //Assert.AreEqual(expected.PayerRef.Value, actual.PayerRef.Value); + //Assert.AreEqual(expected.SalesTermRef.name, actual.SalesTermRef.name); + //Assert.AreEqual(expected.SalesTermRef.type, actual.SalesTermRef.type); + //Assert.AreEqual(expected.SalesTermRef.Value, actual.SalesTermRef.Value); + Assert.AreEqual(expected.DueDate, actual.DueDate); + Assert.AreEqual(expected.DueDateSpecified, actual.DueDateSpecified); + //Assert.AreEqual(expected.RemitToAddr.Line1, actual.RemitToAddr.Line1); + //Assert.AreEqual(expected.RemitToAddr.Line2, actual.RemitToAddr.Line2); + //Assert.AreEqual(expected.RemitToAddr.Line3, actual.RemitToAddr.Line3); + //Assert.AreEqual(expected.RemitToAddr.Line4, actual.RemitToAddr.Line4); + //Assert.AreEqual(expected.RemitToAddr.Line5, actual.RemitToAddr.Line5); + //Assert.AreEqual(expected.RemitToAddr.City, actual.RemitToAddr.City); + //Assert.AreEqual(expected.RemitToAddr.Country, actual.RemitToAddr.Country); + //Assert.AreEqual(expected.RemitToAddr.CountryCode, actual.RemitToAddr.CountryCode); + //Assert.AreEqual(expected.RemitToAddr.CountrySubDivisionCode, actual.RemitToAddr.CountrySubDivisionCode); + //Assert.AreEqual(expected.RemitToAddr.PostalCode, actual.RemitToAddr.PostalCode); + //Assert.AreEqual(expected.RemitToAddr.PostalCodeSuffix, actual.RemitToAddr.PostalCodeSuffix); + //Assert.AreEqual(expected.RemitToAddr.Lat, actual.RemitToAddr.Lat); + //Assert.AreEqual(expected.RemitToAddr.Long, actual.RemitToAddr.Long); + //Assert.AreEqual(expected.RemitToAddr.Tag, actual.RemitToAddr.Tag); + //Assert.AreEqual(expected.RemitToAddr.Note, actual.RemitToAddr.Note); + //Assert.AreEqual(expected.ShipAddr.Line1, actual.ShipAddr.Line1); + //Assert.AreEqual(expected.ShipAddr.Line2, actual.ShipAddr.Line2); + //Assert.AreEqual(expected.ShipAddr.Line3, actual.ShipAddr.Line3); + //Assert.AreEqual(expected.ShipAddr.Line4, actual.ShipAddr.Line4); + //Assert.AreEqual(expected.ShipAddr.Line5, actual.ShipAddr.Line5); + //Assert.AreEqual(expected.ShipAddr.City, actual.ShipAddr.City); + //Assert.AreEqual(expected.ShipAddr.Country, actual.ShipAddr.Country); + //Assert.AreEqual(expected.ShipAddr.CountryCode, actual.ShipAddr.CountryCode); + //Assert.AreEqual(expected.ShipAddr.CountrySubDivisionCode, actual.ShipAddr.CountrySubDivisionCode); + //Assert.AreEqual(expected.ShipAddr.PostalCode, actual.ShipAddr.PostalCode); + //Assert.AreEqual(expected.ShipAddr.PostalCodeSuffix, actual.ShipAddr.PostalCodeSuffix); + //Assert.AreEqual(expected.ShipAddr.Lat, actual.ShipAddr.Lat); + //Assert.AreEqual(expected.ShipAddr.Long, actual.ShipAddr.Long); + //Assert.AreEqual(expected.ShipAddr.Tag, actual.ShipAddr.Tag); + //Assert.AreEqual(expected.ShipAddr.Note, actual.ShipAddr.Note); + Assert.AreEqual(expected.Balance, actual.Balance); + Assert.AreEqual(expected.BalanceSpecified, actual.BalanceSpecified); + //Assert.AreEqual(expected.BillEx.Any, actual.BillEx.Any); + Assert.AreEqual(expected.VendorRef.name, actual.VendorRef.name); + Assert.AreEqual(expected.VendorRef.type, actual.VendorRef.type); + Assert.AreEqual(expected.VendorRef.Value, actual.VendorRef.Value); + Assert.AreEqual(expected.APAccountRef.name, actual.APAccountRef.name); + Assert.AreEqual(expected.APAccountRef.type, actual.APAccountRef.type); + Assert.AreEqual(expected.APAccountRef.Value, actual.APAccountRef.Value); + Assert.AreEqual(expected.TotalAmt, actual.TotalAmt); + Assert.AreEqual(expected.TotalAmtSpecified, actual.TotalAmtSpecified); + //Assert.AreEqual(expected.BillEmail.Address, actual.BillEmail.Address); + //Assert.AreEqual(expected.BillEmail.Default, actual.BillEmail.Default); + //Assert.AreEqual(expected.BillEmail.DefaultSpecified, actual.BillEmail.DefaultSpecified); + //Assert.AreEqual(expected.BillEmail.Tag, actual.BillEmail.Tag); + //Assert.AreEqual(expected.ReplyEmail.Address, actual.ReplyEmail.Address); + //Assert.AreEqual(expected.ReplyEmail.Default, actual.ReplyEmail.Default); + //Assert.AreEqual(expected.ReplyEmail.DefaultSpecified, actual.ReplyEmail.DefaultSpecified); + //Assert.AreEqual(expected.ReplyEmail.Tag, actual.ReplyEmail.Tag); + Assert.AreEqual(expected.Memo, actual.Memo); + //Assert.AreEqual(expected.GlobalTaxCalculationSpecified, actual.GlobalTaxCalculationSpecified); //fails for global realms + Assert.AreEqual(expected.DocNumber, actual.DocNumber); + Assert.AreEqual(expected.TxnDate, actual.TxnDate); + Assert.AreEqual(expected.TxnDateSpecified, actual.TxnDateSpecified); + //Assert.AreEqual(expected.DepartmentRef.name, actual.DepartmentRef.name); + //Assert.AreEqual(expected.DepartmentRef.type, actual.DepartmentRef.type); + //Assert.AreEqual(expected.DepartmentRef.Value, actual.DepartmentRef.Value); + //Assert.AreEqual(expected.CurrencyRef.name, actual.CurrencyRef.name); + //Assert.AreEqual(expected.CurrencyRef.type, actual.CurrencyRef.type); + //Assert.AreEqual(expected.CurrencyRef.Value, actual.CurrencyRef.Value); + //Assert.AreEqual(expected.ExchangeRate, actual.ExchangeRate); + //Assert.AreEqual(expected.ExchangeRateSpecified, actual.ExchangeRateSpecified); + Assert.AreEqual(expected.PrivateNote, actual.PrivateNote); + Assert.AreEqual(expected.TxnStatus, actual.TxnStatus); + Assert.IsTrue(Helper.CheckEqual(expected.LinkedTxn, actual.LinkedTxn)); + Assert.IsTrue(Helper.CheckEqual(expected.Line, actual.Line)); + //Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.name, actual.TxnTaxDetail.DefaultTaxCodeRef.name); + //Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.type, actual.TxnTaxDetail.DefaultTaxCodeRef.type); + //Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.Value, actual.TxnTaxDetail.DefaultTaxCodeRef.Value); + //Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.name, actual.TxnTaxDetail.TxnTaxCodeRef.name); + //Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.type, actual.TxnTaxDetail.TxnTaxCodeRef.type); + //Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.Value, actual.TxnTaxDetail.TxnTaxCodeRef.Value); + //Assert.AreEqual(expected.TxnTaxDetail.TotalTax, actual.TxnTaxDetail.TotalTax); + //Assert.AreEqual(expected.TxnTaxDetail.TotalTaxSpecified, actual.TxnTaxDetail.TotalTaxSpecified); + //Assert.IsTrue(Helper.CheckEqual(expected.TxnTaxDetail.TaxLine, actual.TxnTaxDetail.TaxLine)); + } + + internal static void VerifyBillSparse(Bill expected, Bill actual) + { + Assert.AreEqual(expected.DocNumber, actual.DocNumber); + } + + + + internal static void VerifyVendorCredit(VendorCredit expected, VendorCredit actual) + { + //Assert.AreEqual(expected.VendorCreditEx.Any, actual.VendorCreditEx.Any); + //Assert.AreEqual(expected.VendorRef.name, actual.VendorRef.name); + //Assert.AreEqual(expected.VendorRef.type, actual.VendorRef.type); + Assert.AreEqual(expected.VendorRef.Value, actual.VendorRef.Value); + //Assert.AreEqual(expected.APAccountRef.name, actual.APAccountRef.name); + //Assert.AreEqual(expected.APAccountRef.type, actual.APAccountRef.type); + Assert.AreEqual(expected.APAccountRef.Value, actual.APAccountRef.Value); + Assert.AreEqual(expected.TotalAmt, actual.TotalAmt); + Assert.AreEqual(expected.TotalAmtSpecified, actual.TotalAmtSpecified); + // Assert.AreEqual(expected.BillEmail.Address, actual.BillEmail.Address); + // Assert.AreEqual(expected.BillEmail.Default, actual.BillEmail.Default); + // Assert.AreEqual(expected.BillEmail.DefaultSpecified, actual.BillEmail.DefaultSpecified); + // Assert.AreEqual(expected.BillEmail.Tag, actual.BillEmail.Tag); + // Assert.AreEqual(expected.ReplyEmail.Address, actual.ReplyEmail.Address); + // Assert.AreEqual(expected.ReplyEmail.Default, actual.ReplyEmail.Default); + // Assert.AreEqual(expected.ReplyEmail.DefaultSpecified, actual.ReplyEmail.DefaultSpecified); + // Assert.AreEqual(expected.ReplyEmail.Tag, actual.ReplyEmail.Tag); + //Assert.AreEqual(expected.Memo, actual.Memo); + //Assert.AreEqual(expected.GlobalTaxCalculationSpecified, actual.GlobalTaxCalculationSpecified); + //Assert.AreEqual(expected.DocNumber, actual.DocNumber); + Assert.AreEqual(expected.TxnDate, actual.TxnDate); + Assert.AreEqual(expected.TxnDateSpecified, actual.TxnDateSpecified); + // Assert.AreEqual(expected.DepartmentRef.name, actual.DepartmentRef.name); + // Assert.AreEqual(expected.DepartmentRef.type, actual.DepartmentRef.type); + // Assert.AreEqual(expected.DepartmentRef.Value, actual.DepartmentRef.Value); + // Assert.AreEqual(expected.CurrencyRef.name, actual.CurrencyRef.name); + // Assert.AreEqual(expected.CurrencyRef.type, actual.CurrencyRef.type); + // Assert.AreEqual(expected.CurrencyRef.Value, actual.CurrencyRef.Value); + //Assert.AreEqual(expected.ExchangeRate, actual.ExchangeRate); + //Assert.AreEqual(expected.ExchangeRateSpecified, actual.ExchangeRateSpecified); + Assert.AreEqual(expected.PrivateNote, actual.PrivateNote); + //Assert.AreEqual(expected.TxnStatus, actual.TxnStatus); + //Assert.IsTrue(Helper.CheckEqual(expected.LinkedTxn, actual.LinkedTxn)); + Assert.IsTrue(Helper.CheckEqual(expected.Line, actual.Line)); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.name, actual.TxnTaxDetail.DefaultTaxCodeRef.name); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.type, actual.TxnTaxDetail.DefaultTaxCodeRef.type); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.Value, actual.TxnTaxDetail.DefaultTaxCodeRef.Value); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.name, actual.TxnTaxDetail.TxnTaxCodeRef.name); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.type, actual.TxnTaxDetail.TxnTaxCodeRef.type); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.Value, actual.TxnTaxDetail.TxnTaxCodeRef.Value); + //Assert.AreEqual(expected.TxnTaxDetail.TotalTax, actual.TxnTaxDetail.TotalTax); + //Assert.AreEqual(expected.TxnTaxDetail.TotalTaxSpecified, actual.TxnTaxDetail.TotalTaxSpecified); + //Assert.IsTrue(Helper.CheckEqual(expected.TxnTaxDetail.TaxLine, actual.TxnTaxDetail.TaxLine)); + } + + internal static void VerifyVendorCreditSparse(VendorCredit expected, VendorCredit actual) + { + Assert.AreEqual(expected.TxnDate, actual.TxnDate); + Assert.AreEqual(expected.PrivateNote, actual.PrivateNote); + } + + internal static void VerifyStatementCharge(StatementCharge expected, StatementCharge actual) + { + //Assert.AreEqual(expected.Credit, actual.Credit); + //Assert.AreEqual(expected.CreditSpecified, actual.CreditSpecified); + // Assert.AreEqual(expected.CustomerRef.name, actual.CustomerRef.name); + // Assert.AreEqual(expected.CustomerRef.type, actual.CustomerRef.type); + Assert.AreEqual(expected.CustomerRef.Value, actual.CustomerRef.Value); + //Assert.AreEqual(expected.RemitToRef.name, actual.RemitToRef.name); + //Assert.AreEqual(expected.RemitToRef.type, actual.RemitToRef.type); + Assert.AreEqual(expected.RemitToRef.Value, actual.RemitToRef.Value); + //Assert.AreEqual(expected.ARAccountRef.name, actual.ARAccountRef.name); + //Assert.AreEqual(expected.ARAccountRef.type, actual.ARAccountRef.type); + Assert.AreEqual(expected.ARAccountRef.Value, actual.ARAccountRef.Value); + //Assert.AreEqual(expected.ClassRef.name, actual.ClassRef.name); + //Assert.AreEqual(expected.ClassRef.type, actual.ClassRef.type); + Assert.AreEqual(expected.ClassRef.Value, actual.ClassRef.Value); + Assert.AreEqual(expected.DueDate, actual.DueDate); + Assert.AreEqual(expected.DueDateSpecified, actual.DueDateSpecified); + Assert.AreEqual(expected.BilledDate, actual.BilledDate); + Assert.AreEqual(expected.BilledDateSpecified, actual.BilledDateSpecified); + Assert.AreEqual(expected.TotalAmt, actual.TotalAmt); + Assert.AreEqual(expected.TotalAmtSpecified, actual.TotalAmtSpecified); + // Assert.AreEqual(expected.StatementChargeEx.Any, actual.StatementChargeEx.Any); + //Assert.AreEqual(expected.DocNumber, actual.DocNumber); + Assert.AreEqual(expected.TxnDate, actual.TxnDate); + Assert.AreEqual(expected.TxnDateSpecified, actual.TxnDateSpecified); + // Assert.AreEqual(expected.DepartmentRef.name, actual.DepartmentRef.name); + // Assert.AreEqual(expected.DepartmentRef.type, actual.DepartmentRef.type); + // Assert.AreEqual(expected.DepartmentRef.Value, actual.DepartmentRef.Value); + // Assert.AreEqual(expected.CurrencyRef.name, actual.CurrencyRef.name); + // Assert.AreEqual(expected.CurrencyRef.type, actual.CurrencyRef.type); + // Assert.AreEqual(expected.CurrencyRef.Value, actual.CurrencyRef.Value); + //Assert.AreEqual(expected.ExchangeRate, actual.ExchangeRate); + //Assert.AreEqual(expected.ExchangeRateSpecified, actual.ExchangeRateSpecified); + //Assert.AreEqual(expected.PrivateNote, actual.PrivateNote); + //Assert.AreEqual(expected.TxnStatus, actual.TxnStatus); + //Assert.IsTrue(Helper.CheckEqual(expected.LinkedTxn, actual.LinkedTxn)); + //Assert.IsTrue(Helper.CheckEqual(expected.Line, actual.Line)); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.name, actual.TxnTaxDetail.DefaultTaxCodeRef.name); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.type, actual.TxnTaxDetail.DefaultTaxCodeRef.type); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.Value, actual.TxnTaxDetail.DefaultTaxCodeRef.Value); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.name, actual.TxnTaxDetail.TxnTaxCodeRef.name); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.type, actual.TxnTaxDetail.TxnTaxCodeRef.type); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.Value, actual.TxnTaxDetail.TxnTaxCodeRef.Value); + // Assert.AreEqual(expected.TxnTaxDetail.TotalTax, actual.TxnTaxDetail.TotalTax); + // Assert.AreEqual(expected.TxnTaxDetail.TotalTaxSpecified, actual.TxnTaxDetail.TotalTaxSpecified); + // Assert.IsTrue(Helper.CheckEqual(expected.TxnTaxDetail.TaxLine, actual.TxnTaxDetail.TaxLine)); + } + + internal static void VerifyStatementChargeSparse(StatementCharge expected, StatementCharge actual) + { + Assert.AreEqual(expected.DueDate, actual.DueDate); + Assert.AreEqual(expected.BilledDate, actual.BilledDate); + Assert.AreEqual(expected.TotalAmt, actual.TotalAmt); + } + + + internal static void VerifyClass(Class expected, Class actual) + { + Assert.AreEqual(expected.Name, actual.Name); + //Assert.AreEqual(expected.SubClass, actual.SubClass); + //Assert.AreEqual(expected.SubClassSpecified, actual.SubClassSpecified); + //Assert.AreEqual(expected.ParentRef.name, actual.ParentRef.name); + //Assert.AreEqual(expected.ParentRef.type, actual.ParentRef.type); + //Assert.AreEqual(expected.ParentRef.Value, actual.ParentRef.Value); + Assert.AreEqual(expected.FullyQualifiedName, actual.FullyQualifiedName); + //Assert.AreEqual(expected.Active, actual.Active); + //Assert.AreEqual(expected.ActiveSpecified, actual.ActiveSpecified); + // Assert.AreEqual(expected.ClassEx.Any, actual.ClassEx.Any); + } + + + internal static void VerifyClassSparseUpdate(Class expected, Class actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.FullyQualifiedName, actual.FullyQualifiedName); + } + + internal static void VerifyPayment(Payment expected, Payment actual) + { + //Assert.AreEqual(expected.CustomerRef.name, actual.CustomerRef.name); + //Assert.AreEqual(expected.CustomerRef.type, actual.CustomerRef.type); + Assert.AreEqual(expected.CustomerRef.Value, actual.CustomerRef.Value); + //Assert.AreEqual(expected.RemitToRef.name, actual.RemitToRef.name); + //Assert.AreEqual(expected.RemitToRef.type, actual.RemitToRef.type); + //Assert.AreEqual(expected.RemitToRef.Value, actual.RemitToRef.Value); + //Assert.AreEqual(expected.ARAccountRef.name, actual.ARAccountRef.name); + //Assert.AreEqual(expected.ARAccountRef.type, actual.ARAccountRef.type); + //Assert.AreEqual(expected.ARAccountRef.Value, actual.ARAccountRef.Value); + //Assert.AreEqual(expected.DepositToAccountRef.name, actual.DepositToAccountRef.name); + //Assert.AreEqual(expected.DepositToAccountRef.type, actual.DepositToAccountRef.type); + Assert.AreEqual(expected.DepositToAccountRef.Value, actual.DepositToAccountRef.Value); + //Assert.AreEqual(expected.PaymentMethodRef.name, actual.PaymentMethodRef.name); + //Assert.AreEqual(expected.PaymentMethodRef.type, actual.PaymentMethodRef.type); + Assert.AreEqual(expected.PaymentMethodRef.Value, actual.PaymentMethodRef.Value); + //Assert.AreEqual(expected.PaymentRefNum, actual.PaymentRefNum); + //Assert.AreEqual(expected.PaymentTypeSpecified, actual.PaymentTypeSpecified); + //Assert.AreEqual(expected.AnyIntuitObject, actual.AnyIntuitObject); + Assert.AreEqual(expected.TotalAmt, actual.TotalAmt); + Assert.AreEqual(expected.TotalAmtSpecified, actual.TotalAmtSpecified); + //Assert.AreEqual(expected.UnappliedAmt, actual.UnappliedAmt); + //Assert.AreEqual(expected.UnappliedAmtSpecified, actual.UnappliedAmtSpecified); + //Assert.AreEqual(expected.ProcessPayment, actual.ProcessPayment); + //Assert.AreEqual(expected.ProcessPaymentSpecified, actual.ProcessPaymentSpecified); + // Assert.AreEqual(expected.PaymentEx.Any, actual.PaymentEx.Any); + //Assert.AreEqual(expected.DocNumber, actual.DocNumber); + Assert.AreEqual(expected.TxnDate, actual.TxnDate); + //Assert.AreEqual(expected.TxnDateSpecified, actual.TxnDateSpecified); + // Assert.AreEqual(expected.DepartmentRef.name, actual.DepartmentRef.name); + // Assert.AreEqual(expected.DepartmentRef.type, actual.DepartmentRef.type); + // Assert.AreEqual(expected.DepartmentRef.Value, actual.DepartmentRef.Value); + // Assert.AreEqual(expected.CurrencyRef.name, actual.CurrencyRef.name); + // Assert.AreEqual(expected.CurrencyRef.type, actual.CurrencyRef.type); + // Assert.AreEqual(expected.CurrencyRef.Value, actual.CurrencyRef.Value); + //Assert.AreEqual(expected.ExchangeRate, actual.ExchangeRate); + //Assert.AreEqual(expected.ExchangeRateSpecified, actual.ExchangeRateSpecified); + //Assert.AreEqual(expected.PrivateNote, actual.PrivateNote); + //Assert.AreEqual(expected.TxnStatus, actual.TxnStatus); + //Assert.IsTrue(Helper.CheckEqual(expected.LinkedTxn, actual.LinkedTxn)); + Assert.IsTrue(Helper.CheckEqual(expected.Line, actual.Line)); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.name, actual.TxnTaxDetail.DefaultTaxCodeRef.name); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.type, actual.TxnTaxDetail.DefaultTaxCodeRef.type); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.Value, actual.TxnTaxDetail.DefaultTaxCodeRef.Value); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.name, actual.TxnTaxDetail.TxnTaxCodeRef.name); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.type, actual.TxnTaxDetail.TxnTaxCodeRef.type); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.Value, actual.TxnTaxDetail.TxnTaxCodeRef.Value); + //Assert.AreEqual(expected.TxnTaxDetail.TotalTax, actual.TxnTaxDetail.TotalTax); + //Assert.AreEqual(expected.TxnTaxDetail.TotalTaxSpecified, actual.TxnTaxDetail.TotalTaxSpecified); + //Assert.IsTrue(Helper.CheckEqual(expected.TxnTaxDetail.TaxLine, actual.TxnTaxDetail.TaxLine)); + } + + internal static void VerifyPaymentSparseUpdate(Payment expected, Payment actual) + { + Assert.AreEqual(expected.PrivateNote, actual.PrivateNote); + } + + internal static void VerifyPaymentMethod(PaymentMethod expected, PaymentMethod actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.Active, actual.Active); + Assert.AreEqual(expected.ActiveSpecified, actual.ActiveSpecified); + Assert.AreEqual(expected.Type, actual.Type); + //Assert.AreEqual(expected.PaymentMethodEx.Any, actual.PaymentMethodEx.Any); + } + + + internal static void VerifyPaymentMethodSparseUpdate(PaymentMethod expected, PaymentMethod actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.Type, actual.Type); + } + + + + internal static void VerifyDepartment(Department expected, Department actual) + { + Assert.AreEqual(expected.Name, actual.Name); + //Assert.AreEqual(expected.SubDepartment, actual.SubDepartment); + //Assert.AreEqual(expected.SubDepartmentSpecified, actual.SubDepartmentSpecified); + //Assert.AreEqual(expected.ParentRef.name, actual.ParentRef.name); + //Assert.AreEqual(expected.ParentRef.type, actual.ParentRef.type); + //Assert.AreEqual(expected.ParentRef.Value, actual.ParentRef.Value); + Assert.AreEqual(expected.FullyQualifiedName, actual.FullyQualifiedName); + Assert.AreEqual(expected.Active, actual.Active); + Assert.AreEqual(expected.ActiveSpecified, actual.ActiveSpecified); + //Assert.AreEqual(expected.DepartmentEx.Any, actual.DepartmentEx.Any); + } + + internal static void VerifyDepartmentSparse(Department expected, Department actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.FullyQualifiedName, actual.FullyQualifiedName); + } + + + internal static void VerifyItem(Item expected, Item actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.Description, actual.Description); + Assert.AreEqual(expected.Active, actual.Active); + Assert.AreEqual(expected.ActiveSpecified, actual.ActiveSpecified); + Assert.AreEqual(expected.SubItem, actual.SubItem); + Assert.AreEqual(expected.SubItemSpecified, actual.SubItemSpecified); + //Assert.AreEqual(expected.ParentRef.name, actual.ParentRef.name); + //Assert.AreEqual(expected.ParentRef.type, actual.ParentRef.type); + //Assert.AreEqual(expected.ParentRef.Value, actual.ParentRef.Value); + Assert.AreEqual(expected.Level, actual.Level); + Assert.AreEqual(expected.LevelSpecified, actual.LevelSpecified); + Assert.AreEqual(expected.Taxable, actual.Taxable); + Assert.AreEqual(expected.TaxableSpecified, actual.TaxableSpecified); + //Assert.AreEqual(expected.SalesTaxIncluded, actual.SalesTaxIncluded); + //Assert.AreEqual(expected.SalesTaxIncludedSpecified, actual.SalesTaxIncludedSpecified); + Assert.AreEqual(expected.PercentBased, actual.PercentBased); + Assert.AreEqual(expected.PercentBasedSpecified, actual.PercentBasedSpecified); + Assert.AreEqual(expected.UnitPrice, actual.UnitPrice); + Assert.AreEqual(expected.UnitPriceSpecified, actual.UnitPriceSpecified); + Assert.AreEqual(expected.RatePercent, actual.RatePercent); + Assert.AreEqual(expected.RatePercentSpecified, actual.RatePercentSpecified); + //Assert.AreEqual(expected.TypeSpecified, actual.TypeSpecified); + //Assert.AreEqual(expected.PaymentMethodRef.name, actual.PaymentMethodRef.name); + //Assert.AreEqual(expected.PaymentMethodRef.type, actual.PaymentMethodRef.type); + //Assert.AreEqual(expected.PaymentMethodRef.Value, actual.PaymentMethodRef.Value); + //Assert.AreEqual(expected.UOMSetRef.name, actual.UOMSetRef.name); + //Assert.AreEqual(expected.UOMSetRef.type, actual.UOMSetRef.type); + //Assert.AreEqual(expected.UOMSetRef.Value, actual.UOMSetRef.Value); + //Assert.AreEqual(expected.IncomeAccountRef.name, actual.IncomeAccountRef.name); + //Assert.AreEqual(expected.IncomeAccountRef.type, actual.IncomeAccountRef.type); + Assert.AreEqual(expected.IncomeAccountRef.Value, actual.IncomeAccountRef.Value); + //Assert.AreEqual(expected.PurchaseDesc, actual.PurchaseDesc); + //Assert.AreEqual(expected.PurchaseTaxIncluded, actual.PurchaseTaxIncluded); + //Assert.AreEqual(expected.PurchaseTaxIncludedSpecified, actual.PurchaseTaxIncludedSpecified); + Assert.AreEqual(expected.PurchaseCost, actual.PurchaseCost); + Assert.AreEqual(expected.PurchaseCostSpecified, actual.PurchaseCostSpecified); + //Assert.AreEqual(expected.ExpenseAccountRef.name, actual.ExpenseAccountRef.name); + //Assert.AreEqual(expected.ExpenseAccountRef.type, actual.ExpenseAccountRef.type); + Assert.AreEqual(expected.ExpenseAccountRef.Value, actual.ExpenseAccountRef.Value); + // Assert.AreEqual(expected.COGSAccountRef.name, actual.COGSAccountRef.name); + // Assert.AreEqual(expected.COGSAccountRef.type, actual.COGSAccountRef.type); + // Assert.AreEqual(expected.COGSAccountRef.Value, actual.COGSAccountRef.Value); + // Assert.AreEqual(expected.AssetAccountRef.name, actual.AssetAccountRef.name); + // Assert.AreEqual(expected.AssetAccountRef.type, actual.AssetAccountRef.type); + // Assert.AreEqual(expected.AssetAccountRef.Value, actual.AssetAccountRef.Value); + // Assert.AreEqual(expected.PrefVendorRef.name, actual.PrefVendorRef.name); + // Assert.AreEqual(expected.PrefVendorRef.type, actual.PrefVendorRef.type); + // Assert.AreEqual(expected.PrefVendorRef.Value, actual.PrefVendorRef.Value); + //Assert.AreEqual(expected.AvgCost, actual.AvgCost); + //Assert.AreEqual(expected.AvgCostSpecified, actual.AvgCostSpecified); + Assert.AreEqual(expected.TrackQtyOnHand, actual.TrackQtyOnHand); + Assert.AreEqual(expected.TrackQtyOnHandSpecified, actual.TrackQtyOnHandSpecified); + Assert.AreEqual(expected.QtyOnHand, actual.QtyOnHand); + Assert.AreEqual(expected.QtyOnHandSpecified, actual.QtyOnHandSpecified); + Assert.AreEqual(expected.QtyOnPurchaseOrder, actual.QtyOnPurchaseOrder); + Assert.AreEqual(expected.QtyOnPurchaseOrderSpecified, actual.QtyOnPurchaseOrderSpecified); + Assert.AreEqual(expected.QtyOnSalesOrder, actual.QtyOnSalesOrder); + Assert.AreEqual(expected.QtyOnSalesOrderSpecified, actual.QtyOnSalesOrderSpecified); + Assert.AreEqual(expected.ReorderPoint, actual.ReorderPoint); + Assert.AreEqual(expected.ReorderPointSpecified, actual.ReorderPointSpecified); + Assert.AreEqual(expected.ManPartNum, actual.ManPartNum); + // Assert.AreEqual(expected.DepositToAccountRef.name, actual.DepositToAccountRef.name); + // Assert.AreEqual(expected.DepositToAccountRef.type, actual.DepositToAccountRef.type); + // Assert.AreEqual(expected.DepositToAccountRef.Value, actual.DepositToAccountRef.Value); + // Assert.AreEqual(expected.SalesTaxCodeRef.name, actual.SalesTaxCodeRef.name); + // Assert.AreEqual(expected.SalesTaxCodeRef.type, actual.SalesTaxCodeRef.type); + // Assert.AreEqual(expected.SalesTaxCodeRef.Value, actual.SalesTaxCodeRef.Value); + // Assert.AreEqual(expected.PurchaseTaxCodeRef.name, actual.PurchaseTaxCodeRef.name); + // Assert.AreEqual(expected.PurchaseTaxCodeRef.type, actual.PurchaseTaxCodeRef.type); + // Assert.AreEqual(expected.PurchaseTaxCodeRef.Value, actual.PurchaseTaxCodeRef.Value); + //Assert.AreEqual(expected.InvStartDate, actual.InvStartDate); + //Assert.AreEqual(expected.InvStartDateSpecified, actual.InvStartDateSpecified); + //Assert.AreEqual(expected.BuildPoint, actual.BuildPoint); + //Assert.AreEqual(expected.BuildPointSpecified, actual.BuildPointSpecified); + //Assert.AreEqual(expected.PrintGroupedItems, actual.PrintGroupedItems); + //Assert.AreEqual(expected.PrintGroupedItemsSpecified, actual.PrintGroupedItemsSpecified); + //Assert.AreEqual(expected.SpecialItem, actual.SpecialItem); + //Assert.AreEqual(expected.SpecialItemSpecified, actual.SpecialItemSpecified); + //Assert.AreEqual(expected.SpecialItemTypeSpecified, actual.SpecialItemTypeSpecified); + //Assert.IsTrue(Helper.CheckEqual(expected.ItemGroupDetail, actual.ItemGroupDetail)); + //Assert.IsTrue(Helper.CheckEqual(expected.ItemAssemblyDetail, actual.ItemAssemblyDetail)); + // Assert.AreEqual(expected.ItemEx.Any, actual.ItemEx.Any); + } + + internal static void VerifyItemFrance(Item expected, Item actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.Description, actual.Description); + Assert.AreEqual(expected.Active, actual.Active); + Assert.AreEqual(expected.ActiveSpecified, actual.ActiveSpecified); + Assert.AreEqual(expected.SubItem, actual.SubItem); + Assert.AreEqual(expected.SubItemSpecified, actual.SubItemSpecified); + + Assert.AreEqual(expected.Level, actual.Level); + Assert.AreEqual(expected.LevelSpecified, actual.LevelSpecified); + Assert.AreEqual(expected.Taxable, actual.Taxable); + Assert.AreEqual(expected.TaxableSpecified, actual.TaxableSpecified); + + Assert.AreEqual(expected.PercentBased, actual.PercentBased); + Assert.AreEqual(expected.PercentBasedSpecified, actual.PercentBasedSpecified); + Assert.AreEqual(expected.UnitPrice, actual.UnitPrice); + Assert.AreEqual(expected.UnitPriceSpecified, actual.UnitPriceSpecified); + Assert.AreEqual(expected.RatePercent, actual.RatePercent); + Assert.AreEqual(expected.RatePercentSpecified, actual.RatePercentSpecified); + + Assert.AreEqual(expected.IncomeAccountRef.Value, actual.IncomeAccountRef.Value); + + Assert.AreEqual(expected.PurchaseCost, actual.PurchaseCost); + Assert.AreEqual(expected.PurchaseCostSpecified, actual.PurchaseCostSpecified); + + Assert.AreEqual(expected.ExpenseAccountRef.Value, actual.ExpenseAccountRef.Value); + + Assert.AreEqual(expected.TrackQtyOnHand, actual.TrackQtyOnHand); + Assert.AreEqual(expected.TrackQtyOnHandSpecified, actual.TrackQtyOnHandSpecified); + Assert.AreEqual(expected.QtyOnHand, actual.QtyOnHand); + Assert.AreEqual(expected.QtyOnHandSpecified, actual.QtyOnHandSpecified); + Assert.AreEqual(expected.QtyOnPurchaseOrder, actual.QtyOnPurchaseOrder); + Assert.AreEqual(expected.QtyOnPurchaseOrderSpecified, actual.QtyOnPurchaseOrderSpecified); + Assert.AreEqual(expected.QtyOnSalesOrder, actual.QtyOnSalesOrder); + Assert.AreEqual(expected.QtyOnSalesOrderSpecified, actual.QtyOnSalesOrderSpecified); + Assert.AreEqual(expected.ReorderPoint, actual.ReorderPoint); + Assert.AreEqual(expected.ReorderPointSpecified, actual.ReorderPointSpecified); + Assert.AreEqual(expected.ManPartNum, actual.ManPartNum); + + Assert.AreEqual(expected.Type, actual.Type); + //Assert.AreEqual(expected.ItemCategoryType, actual.ItemCategoryType); + + } + + internal static void VerifyItemSparseUpdate(Item expected, Item actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.Description, actual.Description); + } + + + + internal static void VerifyTerm(Term expected, Term actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.Active, actual.Active); + Assert.AreEqual(expected.ActiveSpecified, actual.ActiveSpecified); + Assert.AreEqual(expected.Type, actual.Type); + Assert.AreEqual(expected.DiscountPercent, actual.DiscountPercent); + Assert.AreEqual(expected.DiscountPercentSpecified, actual.DiscountPercentSpecified); + //Assert.AreEqual(expected.DueDays, actual.DueDays); + //Assert.IsTrue(Helper.CheckEqual(expected.ItemsElementName, actual.ItemsElementName)); + // Assert.AreEqual(expected.SalesTermEx.Any, actual.SalesTermEx.Any); + } + + + internal static void VerifyTermSparseUpdate(Term expected, Term actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.Active, actual.Active); + } + + + + internal static void VerifyBillPayment(BillPayment expected, BillPayment actual) + { + //Assert.AreEqual(expected.VendorRef.name, actual.VendorRef.name); + //Assert.AreEqual(expected.VendorRef.type, actual.VendorRef.type); + //Assert.AreEqual(expected.VendorRef.Value, actual.VendorRef.Value); + //Assert.AreEqual(expected.APAccountRef.name, actual.APAccountRef.name); + //Assert.AreEqual(expected.APAccountRef.type, actual.APAccountRef.type); + //Assert.AreEqual(expected.APAccountRef.Value, actual.APAccountRef.Value); + //Assert.AreEqual(expected.PayTypeSpecified, actual.PayTypeSpecified); + //Assert.AreEqual(expected.AnyIntuitObject, actual.AnyIntuitObject); + Assert.AreEqual(expected.TotalAmt, actual.TotalAmt); + Assert.AreEqual(expected.TotalAmtSpecified, actual.TotalAmtSpecified); + // Assert.AreEqual(expected.BillPaymentEx.Any, actual.BillPaymentEx.Any); + Assert.AreEqual(expected.DocNumber, actual.DocNumber); + Assert.AreEqual(expected.TxnDate, actual.TxnDate); + Assert.AreEqual(expected.TxnDateSpecified, actual.TxnDateSpecified); + // Assert.AreEqual(expected.DepartmentRef.name, actual.DepartmentRef.name); + // Assert.AreEqual(expected.DepartmentRef.type, actual.DepartmentRef.type); + // Assert.AreEqual(expected.DepartmentRef.Value, actual.DepartmentRef.Value); + // Assert.AreEqual(expected.CurrencyRef.name, actual.CurrencyRef.name); + // Assert.AreEqual(expected.CurrencyRef.type, actual.CurrencyRef.type); + // Assert.AreEqual(expected.CurrencyRef.Value, actual.CurrencyRef.Value); + //Assert.AreEqual(expected.ExchangeRate, actual.ExchangeRate); + //Assert.AreEqual(expected.ExchangeRateSpecified, actual.ExchangeRateSpecified); + Assert.AreEqual(expected.PrivateNote, actual.PrivateNote); + //Assert.AreEqual(expected.TxnStatus, actual.TxnStatus); + //Assert.IsTrue(Helper.CheckEqual(expected.LinkedTxn, actual.LinkedTxn)); + //Assert.IsTrue(Helper.CheckEqual(expected.Line, actual.Line)); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.name, actual.TxnTaxDetail.DefaultTaxCodeRef.name); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.type, actual.TxnTaxDetail.DefaultTaxCodeRef.type); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.Value, actual.TxnTaxDetail.DefaultTaxCodeRef.Value); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.name, actual.TxnTaxDetail.TxnTaxCodeRef.name); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.type, actual.TxnTaxDetail.TxnTaxCodeRef.type); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.Value, actual.TxnTaxDetail.TxnTaxCodeRef.Value); + // Assert.AreEqual(expected.TxnTaxDetail.TotalTax, actual.TxnTaxDetail.TotalTax); + // Assert.AreEqual(expected.TxnTaxDetail.TotalTaxSpecified, actual.TxnTaxDetail.TotalTaxSpecified); + // Assert.IsTrue(Helper.CheckEqual(expected.TxnTaxDetail.TaxLine, actual.TxnTaxDetail.TaxLine)); + } + + + internal static void VerifyBillPaymentSparse(BillPayment expected, BillPayment actual) + { + Assert.AreEqual(expected.PrivateNote, actual.PrivateNote); + } + + internal static void VerifyDeposit(Deposit expected, Deposit actual) + { + //Assert.AreEqual(expected.DepositToAccountRef.name, actual.DepositToAccountRef.name); + //Assert.AreEqual(expected.DepositToAccountRef.type, actual.DepositToAccountRef.type); + //Assert.AreEqual(expected.DepositToAccountRef.Value, actual.DepositToAccountRef.Value); + // Assert.AreEqual(expected.CashBack.AccountRef.name, actual.CashBack.AccountRef.name); + // Assert.AreEqual(expected.CashBack.AccountRef.type, actual.CashBack.AccountRef.type); + // Assert.AreEqual(expected.CashBack.AccountRef.Value, actual.CashBack.AccountRef.Value); + //Assert.AreEqual(expected.CashBack.Amount, actual.CashBack.Amount); + //Assert.AreEqual(expected.CashBack.AmountSpecified, actual.CashBack.AmountSpecified); + //Assert.AreEqual(expected.CashBack.Memo, actual.CashBack.Memo); + Assert.AreEqual(expected.TotalAmt, actual.TotalAmt); + //Assert.AreEqual(expected.TotalAmtSpecified, actual.TotalAmtSpecified); + // Assert.AreEqual(expected.DepositEx.Any, actual.DepositEx.Any); + Assert.AreEqual(expected.DocNumber, actual.DocNumber); + Assert.AreEqual(expected.TxnDate, actual.TxnDate); + //Assert.AreEqual(expected.TxnDateSpecified, actual.TxnDateSpecified); + // Assert.AreEqual(expected.DepartmentRef.name, actual.DepartmentRef.name); + // Assert.AreEqual(expected.DepartmentRef.type, actual.DepartmentRef.type); + // Assert.AreEqual(expected.DepartmentRef.Value, actual.DepartmentRef.Value); + // Assert.AreEqual(expected.CurrencyRef.name, actual.CurrencyRef.name); + // Assert.AreEqual(expected.CurrencyRef.type, actual.CurrencyRef.type); + // Assert.AreEqual(expected.CurrencyRef.Value, actual.CurrencyRef.Value); + //Assert.AreEqual(expected.ExchangeRate, actual.ExchangeRate); + //Assert.AreEqual(expected.ExchangeRateSpecified, actual.ExchangeRateSpecified); + Assert.AreEqual(expected.PrivateNote, actual.PrivateNote); + Assert.AreEqual(expected.TxnStatus, actual.TxnStatus); + //Assert.IsTrue(Helper.CheckEqual(expected.LinkedTxn, actual.LinkedTxn)); + //Assert.IsTrue(Helper.CheckEqual(expected.Line, actual.Line)); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.name, actual.TxnTaxDetail.DefaultTaxCodeRef.name); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.type, actual.TxnTaxDetail.DefaultTaxCodeRef.type); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.Value, actual.TxnTaxDetail.DefaultTaxCodeRef.Value); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.name, actual.TxnTaxDetail.TxnTaxCodeRef.name); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.type, actual.TxnTaxDetail.TxnTaxCodeRef.type); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.Value, actual.TxnTaxDetail.TxnTaxCodeRef.Value); + // Assert.AreEqual(expected.TxnTaxDetail.TotalTax, actual.TxnTaxDetail.TotalTax); + // Assert.AreEqual(expected.TxnTaxDetail.TotalTaxSpecified, actual.TxnTaxDetail.TotalTaxSpecified); + // Assert.IsTrue(Helper.CheckEqual(expected.TxnTaxDetail.TaxLine, actual.TxnTaxDetail.TaxLine)); + } + + + internal static void VerifyDepositSparse(Deposit expected, Deposit actual) + { + Assert.AreEqual(expected.PrivateNote, actual.PrivateNote); + } + + internal static void VerifyTransfer(Transfer expected, Transfer actual) + { + //Assert.AreEqual(expected.FromAccountRef.name, actual.FromAccountRef.name); + //Assert.AreEqual(expected.FromAccountRef.type, actual.FromAccountRef.type); + Assert.AreEqual(expected.FromAccountRef.Value, actual.FromAccountRef.Value); + //Assert.AreEqual(expected.ToAccountRef.name, actual.ToAccountRef.name); + //Assert.AreEqual(expected.ToAccountRef.type, actual.ToAccountRef.type); + Assert.AreEqual(expected.ToAccountRef.Value, actual.ToAccountRef.Value); + Assert.AreEqual(expected.Amount, actual.Amount); + Assert.AreEqual(expected.AmountSpecified, actual.AmountSpecified); + // Assert.AreEqual(expected.ClassRef.name, actual.ClassRef.name); + // Assert.AreEqual(expected.ClassRef.type, actual.ClassRef.type); + // Assert.AreEqual(expected.ClassRef.Value, actual.ClassRef.Value); + // Assert.AreEqual(expected.TransferEx.Any, actual.TransferEx.Any); + //Assert.AreEqual(expected.DocNumber, actual.DocNumber); + //Assert.AreEqual(expected.TxnDate, actual.TxnDate); + //Assert.AreEqual(expected.TxnDateSpecified, actual.TxnDateSpecified); + // Assert.AreEqual(expected.DepartmentRef.name, actual.DepartmentRef.name); + // Assert.AreEqual(expected.DepartmentRef.type, actual.DepartmentRef.type); + // Assert.AreEqual(expected.DepartmentRef.Value, actual.DepartmentRef.Value); + // Assert.AreEqual(expected.CurrencyRef.name, actual.CurrencyRef.name); + // Assert.AreEqual(expected.CurrencyRef.type, actual.CurrencyRef.type); + // Assert.AreEqual(expected.CurrencyRef.Value, actual.CurrencyRef.Value); + //Assert.AreEqual(expected.ExchangeRate, actual.ExchangeRate); + //Assert.AreEqual(expected.ExchangeRateSpecified, actual.ExchangeRateSpecified); + //Assert.AreEqual(expected.PrivateNote, actual.PrivateNote); + //Assert.AreEqual(expected.TxnStatus, actual.TxnStatus); + //Assert.IsTrue(Helper.CheckEqual(expected.LinkedTxn, actual.LinkedTxn)); + //Assert.IsTrue(Helper.CheckEqual(expected.Line, actual.Line)); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.name, actual.TxnTaxDetail.DefaultTaxCodeRef.name); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.type, actual.TxnTaxDetail.DefaultTaxCodeRef.type); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.Value, actual.TxnTaxDetail.DefaultTaxCodeRef.Value); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.name, actual.TxnTaxDetail.TxnTaxCodeRef.name); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.type, actual.TxnTaxDetail.TxnTaxCodeRef.type); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.Value, actual.TxnTaxDetail.TxnTaxCodeRef.Value); + // Assert.AreEqual(expected.TxnTaxDetail.TotalTax, actual.TxnTaxDetail.TotalTax); + // Assert.AreEqual(expected.TxnTaxDetail.TotalTaxSpecified, actual.TxnTaxDetail.TotalTaxSpecified); + // Assert.IsTrue(Helper.CheckEqual(expected.TxnTaxDetail.TaxLine, actual.TxnTaxDetail.TaxLine)); + } + + internal static void VerifyTransferSparse(Transfer expected, Transfer actual) + { + Assert.AreEqual(expected.Amount, actual.Amount); + } + + internal static void VerifyPurchaseOrder(PurchaseOrder expected, PurchaseOrder actual) + { + //Assert.AreEqual(expected.TaxCodeRef.name, actual.TaxCodeRef.name); + //Assert.AreEqual(expected.TaxCodeRef.type, actual.TaxCodeRef.type); + //Assert.AreEqual(expected.TaxCodeRef.Value, actual.TaxCodeRef.Value); + //Assert.AreEqual(expected.ClassRef.name, actual.ClassRef.name); + //Assert.AreEqual(expected.ClassRef.type, actual.ClassRef.type); + //Assert.AreEqual(expected.ClassRef.Value, actual.ClassRef.Value); + //Assert.AreEqual(expected.ReimbursableInfoRef.name, actual.ReimbursableInfoRef.name); + //Assert.AreEqual(expected.ReimbursableInfoRef.type, actual.ReimbursableInfoRef.type); + //Assert.AreEqual(expected.ReimbursableInfoRef.Value, actual.ReimbursableInfoRef.Value); + //Assert.AreEqual(expected.SalesTermRef.name, actual.SalesTermRef.name); + //Assert.AreEqual(expected.SalesTermRef.type, actual.SalesTermRef.type); + //Assert.AreEqual(expected.SalesTermRef.Value, actual.SalesTermRef.Value); + Assert.AreEqual(expected.DueDate, actual.DueDate); + Assert.AreEqual(expected.DueDateSpecified, actual.DueDateSpecified); + Assert.AreEqual(expected.ExpectedDate, actual.ExpectedDate); + Assert.AreEqual(expected.ExpectedDateSpecified, actual.ExpectedDateSpecified); + //Assert.AreEqual(expected.VendorAddr.Line1, actual.VendorAddr.Line1); + //Assert.AreEqual(expected.VendorAddr.Line2, actual.VendorAddr.Line2); + //Assert.AreEqual(expected.VendorAddr.Line3, actual.VendorAddr.Line3); + //Assert.AreEqual(expected.VendorAddr.Line4, actual.VendorAddr.Line4); + //Assert.AreEqual(expected.VendorAddr.Line5, actual.VendorAddr.Line5); + //Assert.AreEqual(expected.VendorAddr.City, actual.VendorAddr.City); + //Assert.AreEqual(expected.VendorAddr.Country, actual.VendorAddr.Country); + //Assert.AreEqual(expected.VendorAddr.CountryCode, actual.VendorAddr.CountryCode); + //Assert.AreEqual(expected.VendorAddr.CountrySubDivisionCode, actual.VendorAddr.CountrySubDivisionCode); + //Assert.AreEqual(expected.VendorAddr.PostalCode, actual.VendorAddr.PostalCode); + //Assert.AreEqual(expected.VendorAddr.PostalCodeSuffix, actual.VendorAddr.PostalCodeSuffix); + //Assert.AreEqual(expected.VendorAddr.Lat, actual.VendorAddr.Lat); + //Assert.AreEqual(expected.VendorAddr.Long, actual.VendorAddr.Long); + //Assert.AreEqual(expected.VendorAddr.Tag, actual.VendorAddr.Tag); + //Assert.AreEqual(expected.VendorAddr.Note, actual.VendorAddr.Note); + //Assert.AreEqual(expected.AnyIntuitObject.name, actual.AnyIntuitObject.name); + //Assert.AreEqual(expected.AnyIntuitObject.type, actual.AnyIntuitObject.type); + //Assert.AreEqual(expected.AnyIntuitObject.Value, actual.AnyIntuitObject.Value); + //Assert.AreEqual(expected.ShipAddr.Line1, actual.ShipAddr.Line1); + //Assert.AreEqual(expected.ShipAddr.Line2, actual.ShipAddr.Line2); + //Assert.AreEqual(expected.ShipAddr.Line3, actual.ShipAddr.Line3); + //Assert.AreEqual(expected.ShipAddr.Line4, actual.ShipAddr.Line4); + //Assert.AreEqual(expected.ShipAddr.Line5, actual.ShipAddr.Line5); + //Assert.AreEqual(expected.ShipAddr.City, actual.ShipAddr.City); + //Assert.AreEqual(expected.ShipAddr.Country, actual.ShipAddr.Country); + //Assert.AreEqual(expected.ShipAddr.CountryCode, actual.ShipAddr.CountryCode); + //Assert.AreEqual(expected.ShipAddr.CountrySubDivisionCode, actual.ShipAddr.CountrySubDivisionCode); + //Assert.AreEqual(expected.ShipAddr.PostalCode, actual.ShipAddr.PostalCode); + //Assert.AreEqual(expected.ShipAddr.PostalCodeSuffix, actual.ShipAddr.PostalCodeSuffix); + //Assert.AreEqual(expected.ShipAddr.Lat, actual.ShipAddr.Lat); + //Assert.AreEqual(expected.ShipAddr.Long, actual.ShipAddr.Long); + //Assert.AreEqual(expected.ShipAddr.Tag, actual.ShipAddr.Tag); + //Assert.AreEqual(expected.ShipAddr.Note, actual.ShipAddr.Note); + //Assert.AreEqual(expected.ShipMethodRef.name, actual.ShipMethodRef.name); + //Assert.AreEqual(expected.ShipMethodRef.type, actual.ShipMethodRef.type); + //Assert.AreEqual(expected.ShipMethodRef.Value, actual.ShipMethodRef.Value); + Assert.AreEqual(expected.FOB, actual.FOB); + //Assert.AreEqual(expected.POEmail.Address, actual.POEmail.Address); + //Assert.AreEqual(expected.POEmail.Default, actual.POEmail.Default); + //Assert.AreEqual(expected.POEmail.DefaultSpecified, actual.POEmail.DefaultSpecified); + //Assert.AreEqual(expected.POEmail.Tag, actual.POEmail.Tag); + //Assert.AreEqual(expected.TemplateRef.name, actual.TemplateRef.name); + //Assert.AreEqual(expected.TemplateRef.type, actual.TemplateRef.type); + //Assert.AreEqual(expected.TemplateRef.Value, actual.TemplateRef.Value); + Assert.AreEqual(expected.PrintStatusSpecified, actual.PrintStatusSpecified); + Assert.AreEqual(expected.EmailStatusSpecified, actual.EmailStatusSpecified); + Assert.AreEqual(expected.ManuallyClosed, actual.ManuallyClosed); + Assert.AreEqual(expected.ManuallyClosedSpecified, actual.ManuallyClosedSpecified); + //Assert.AreEqual(expected.POStatusSpecified, actual.POStatusSpecified); + //Assert.AreEqual(expected.PurchaseOrderEx.Any, actual.PurchaseOrderEx.Any); + Assert.AreEqual(expected.VendorRef.name, actual.VendorRef.name); + Assert.AreEqual(expected.VendorRef.type, actual.VendorRef.type); + Assert.AreEqual(expected.VendorRef.Value, actual.VendorRef.Value); + //Assert.AreEqual(expected.APAccountRef.name, actual.APAccountRef.name); + //Assert.AreEqual(expected.APAccountRef.type, actual.APAccountRef.type); + //Assert.AreEqual(expected.APAccountRef.Value, actual.APAccountRef.Value); + Assert.AreEqual(expected.TotalAmt, actual.TotalAmt); + Assert.AreEqual(expected.TotalAmtSpecified, actual.TotalAmtSpecified); + //Assert.AreEqual(expected.BillEmail.Address, actual.BillEmail.Address); + //Assert.AreEqual(expected.BillEmail.Default, actual.BillEmail.Default); + //Assert.AreEqual(expected.BillEmail.DefaultSpecified, actual.BillEmail.DefaultSpecified); + //Assert.AreEqual(expected.BillEmail.Tag, actual.BillEmail.Tag); + //Assert.AreEqual(expected.ReplyEmail.Address, actual.ReplyEmail.Address); + //Assert.AreEqual(expected.ReplyEmail.Default, actual.ReplyEmail.Default); + //Assert.AreEqual(expected.ReplyEmail.DefaultSpecified, actual.ReplyEmail.DefaultSpecified); + //Assert.AreEqual(expected.ReplyEmail.Tag, actual.ReplyEmail.Tag); + Assert.AreEqual(expected.Memo, actual.Memo); + //Assert.AreEqual(expected.GlobalTaxCalculationSpecified, actual.GlobalTaxCalculationSpecified); //fails for global realms + //Assert.AreEqual(expected.DocNumber, actual.DocNumber); + Assert.AreEqual(expected.TxnDate, actual.TxnDate); + Assert.AreEqual(expected.TxnDateSpecified, actual.TxnDateSpecified); + //Assert.AreEqual(expected.DepartmentRef.name, actual.DepartmentRef.name); + //Assert.AreEqual(expected.DepartmentRef.type, actual.DepartmentRef.type); + //Assert.AreEqual(expected.DepartmentRef.Value, actual.DepartmentRef.Value); + //Assert.AreEqual(expected.CurrencyRef.name, actual.CurrencyRef.name); + //Assert.AreEqual(expected.CurrencyRef.type, actual.CurrencyRef.type); + //Assert.AreEqual(expected.CurrencyRef.Value, actual.CurrencyRef.Value); + //Assert.AreEqual(expected.ExchangeRate, actual.ExchangeRate); + //Assert.AreEqual(expected.ExchangeRateSpecified, actual.ExchangeRateSpecified); + Assert.AreEqual(expected.PrivateNote, actual.PrivateNote); + Assert.AreEqual(expected.TxnStatus, actual.TxnStatus); + Assert.IsTrue(Helper.CheckEqual(expected.LinkedTxn, actual.LinkedTxn)); + Assert.IsTrue(Helper.CheckEqual(expected.Line, actual.Line)); + //Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.name, actual.TxnTaxDetail.DefaultTaxCodeRef.name); + //Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.type, actual.TxnTaxDetail.DefaultTaxCodeRef.type); + //Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.Value, actual.TxnTaxDetail.DefaultTaxCodeRef.Value); + //Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.name, actual.TxnTaxDetail.TxnTaxCodeRef.name); + //Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.type, actual.TxnTaxDetail.TxnTaxCodeRef.type); + //Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.Value, actual.TxnTaxDetail.TxnTaxCodeRef.Value); + //Assert.AreEqual(expected.TxnTaxDetail.TotalTax, actual.TxnTaxDetail.TotalTax); + //Assert.AreEqual(expected.TxnTaxDetail.TotalTaxSpecified, actual.TxnTaxDetail.TotalTaxSpecified); + //Assert.IsTrue(Helper.CheckEqual(expected.TxnTaxDetail.TaxLine, actual.TxnTaxDetail.TaxLine)); + } + + internal static void VerifyPurchaseOrderSparse(PurchaseOrder expected, PurchaseOrder actual) + { + Assert.AreEqual(expected.DocNumber, actual.DocNumber); + } + + internal static void VerifySalesOrder(SalesOrder expected, SalesOrder actual) + { + Assert.AreEqual(expected.ManuallyClosed, actual.ManuallyClosed); + Assert.AreEqual(expected.ManuallyClosedSpecified, actual.ManuallyClosedSpecified); + //Assert.AreEqual(expected.SalesOrderEx.Any, actual.SalesOrderEx.Any); + Assert.AreEqual(expected.AutoDocNumber, actual.AutoDocNumber); + Assert.AreEqual(expected.AutoDocNumberSpecified, actual.AutoDocNumberSpecified); + //Assert.AreEqual(expected.CustomerRef.name, actual.CustomerRef.name); + //Assert.AreEqual(expected.CustomerRef.type, actual.CustomerRef.type); + //Assert.AreEqual(expected.CustomerRef.Value, actual.CustomerRef.Value); + //Assert.AreEqual(expected.CustomerMemo.id, actual.CustomerMemo.id); + //Assert.AreEqual(expected.CustomerMemo.Value, actual.CustomerMemo.Value); + Assert.AreEqual(expected.BillAddr.Line1, actual.BillAddr.Line1); + Assert.AreEqual(expected.BillAddr.Line2, actual.BillAddr.Line2); + Assert.AreEqual(expected.BillAddr.Line3, actual.BillAddr.Line3); + Assert.AreEqual(expected.BillAddr.Line4, actual.BillAddr.Line4); + Assert.AreEqual(expected.BillAddr.Line5, actual.BillAddr.Line5); + Assert.AreEqual(expected.BillAddr.City, actual.BillAddr.City); + Assert.AreEqual(expected.BillAddr.Country, actual.BillAddr.Country); + Assert.AreEqual(expected.BillAddr.CountryCode, actual.BillAddr.CountryCode); + Assert.AreEqual(expected.BillAddr.CountrySubDivisionCode, actual.BillAddr.CountrySubDivisionCode); + Assert.AreEqual(expected.BillAddr.PostalCode, actual.BillAddr.PostalCode); + Assert.AreEqual(expected.BillAddr.PostalCodeSuffix, actual.BillAddr.PostalCodeSuffix); + Assert.AreEqual(expected.BillAddr.Lat, actual.BillAddr.Lat); + Assert.AreEqual(expected.BillAddr.Long, actual.BillAddr.Long); + Assert.AreEqual(expected.BillAddr.Tag, actual.BillAddr.Tag); + Assert.AreEqual(expected.BillAddr.Note, actual.BillAddr.Note); + Assert.AreEqual(expected.ShipAddr.Line1, actual.ShipAddr.Line1); + Assert.AreEqual(expected.ShipAddr.Line2, actual.ShipAddr.Line2); + Assert.AreEqual(expected.ShipAddr.Line3, actual.ShipAddr.Line3); + Assert.AreEqual(expected.ShipAddr.Line4, actual.ShipAddr.Line4); + Assert.AreEqual(expected.ShipAddr.Line5, actual.ShipAddr.Line5); + Assert.AreEqual(expected.ShipAddr.City, actual.ShipAddr.City); + Assert.AreEqual(expected.ShipAddr.Country, actual.ShipAddr.Country); + Assert.AreEqual(expected.ShipAddr.CountryCode, actual.ShipAddr.CountryCode); + Assert.AreEqual(expected.ShipAddr.CountrySubDivisionCode, actual.ShipAddr.CountrySubDivisionCode); + Assert.AreEqual(expected.ShipAddr.PostalCode, actual.ShipAddr.PostalCode); + Assert.AreEqual(expected.ShipAddr.PostalCodeSuffix, actual.ShipAddr.PostalCodeSuffix); + Assert.AreEqual(expected.ShipAddr.Lat, actual.ShipAddr.Lat); + Assert.AreEqual(expected.ShipAddr.Long, actual.ShipAddr.Long); + Assert.AreEqual(expected.ShipAddr.Tag, actual.ShipAddr.Tag); + Assert.AreEqual(expected.ShipAddr.Note, actual.ShipAddr.Note); + //Assert.AreEqual(expected.RemitToRef.name, actual.RemitToRef.name); + //Assert.AreEqual(expected.RemitToRef.type, actual.RemitToRef.type); + //Assert.AreEqual(expected.RemitToRef.Value, actual.RemitToRef.Value); + //Assert.AreEqual(expected.ClassRef.name, actual.ClassRef.name); + //Assert.AreEqual(expected.ClassRef.type, actual.ClassRef.type); + //Assert.AreEqual(expected.ClassRef.Value, actual.ClassRef.Value); + //Assert.AreEqual(expected.SalesTermRef.name, actual.SalesTermRef.name); + //Assert.AreEqual(expected.SalesTermRef.type, actual.SalesTermRef.type); + //Assert.AreEqual(expected.SalesTermRef.Value, actual.SalesTermRef.Value); + Assert.AreEqual(expected.DueDate, actual.DueDate); + Assert.AreEqual(expected.DueDateSpecified, actual.DueDateSpecified); + // Assert.AreEqual(expected.SalesRepRef.name, actual.SalesRepRef.name); + // Assert.AreEqual(expected.SalesRepRef.type, actual.SalesRepRef.type); + // Assert.AreEqual(expected.SalesRepRef.Value, actual.SalesRepRef.Value); + //Assert.AreEqual(expected.PONumber, actual.PONumber); + //Assert.AreEqual(expected.FOB, actual.FOB); + // Assert.AreEqual(expected.ShipMethodRef.name, actual.ShipMethodRef.name); + // Assert.AreEqual(expected.ShipMethodRef.type, actual.ShipMethodRef.type); + // Assert.AreEqual(expected.ShipMethodRef.Value, actual.ShipMethodRef.Value); + Assert.AreEqual(expected.ShipDate, actual.ShipDate); + Assert.AreEqual(expected.ShipDateSpecified, actual.ShipDateSpecified); + Assert.AreEqual(expected.TrackingNum, actual.TrackingNum); + Assert.AreEqual(expected.GlobalTaxCalculationSpecified, actual.GlobalTaxCalculationSpecified); + Assert.AreEqual(expected.TotalAmt, actual.TotalAmt); + Assert.AreEqual(expected.TotalAmtSpecified, actual.TotalAmtSpecified); + Assert.AreEqual(expected.HomeTotalAmt, actual.HomeTotalAmt); + Assert.AreEqual(expected.HomeTotalAmtSpecified, actual.HomeTotalAmtSpecified); + Assert.AreEqual(expected.ApplyTaxAfterDiscount, actual.ApplyTaxAfterDiscount); + Assert.AreEqual(expected.ApplyTaxAfterDiscountSpecified, actual.ApplyTaxAfterDiscountSpecified); + //Assert.AreEqual(expected.TemplateRef.name, actual.TemplateRef.name); + //Assert.AreEqual(expected.TemplateRef.type, actual.TemplateRef.type); + //Assert.AreEqual(expected.TemplateRef.Value, actual.TemplateRef.Value); + Assert.AreEqual(expected.PrintStatusSpecified, actual.PrintStatusSpecified); + Assert.AreEqual(expected.EmailStatusSpecified, actual.EmailStatusSpecified); + //Assert.AreEqual(expected.BillEmail.Address, actual.BillEmail.Address); + //Assert.AreEqual(expected.BillEmail.Default, actual.BillEmail.Default); + //Assert.AreEqual(expected.BillEmail.DefaultSpecified, actual.BillEmail.DefaultSpecified); + //Assert.AreEqual(expected.BillEmail.Tag, actual.BillEmail.Tag); + //Assert.AreEqual(expected.ARAccountRef.name, actual.ARAccountRef.name); + //Assert.AreEqual(expected.ARAccountRef.type, actual.ARAccountRef.type); + //Assert.AreEqual(expected.ARAccountRef.Value, actual.ARAccountRef.Value); + //Assert.AreEqual(expected.Balance, actual.Balance); + //Assert.AreEqual(expected.BalanceSpecified, actual.BalanceSpecified); + //Assert.AreEqual(expected.FinanceCharge, actual.FinanceCharge); + //Assert.AreEqual(expected.FinanceChargeSpecified, actual.FinanceChargeSpecified); + // Assert.AreEqual(expected.PaymentMethodRef.name, actual.PaymentMethodRef.name); + // Assert.AreEqual(expected.PaymentMethodRef.type, actual.PaymentMethodRef.type); + // Assert.AreEqual(expected.PaymentMethodRef.Value, actual.PaymentMethodRef.Value); + //Assert.AreEqual(expected.PaymentRefNum, actual.PaymentRefNum); + //Assert.AreEqual(expected.PaymentTypeSpecified, actual.PaymentTypeSpecified); + //Assert.AreEqual(expected.AnyIntuitObject, actual.AnyIntuitObject); + // Assert.AreEqual(expected.DepositToAccountRef.name, actual.DepositToAccountRef.name); + // Assert.AreEqual(expected.DepositToAccountRef.type, actual.DepositToAccountRef.type); + // Assert.AreEqual(expected.DepositToAccountRef.Value, actual.DepositToAccountRef.Value); + Assert.AreEqual(expected.DocNumber, actual.DocNumber); + Assert.AreEqual(expected.TxnDate, actual.TxnDate); + Assert.AreEqual(expected.TxnDateSpecified, actual.TxnDateSpecified); + // Assert.AreEqual(expected.DepartmentRef.name, actual.DepartmentRef.name); + // Assert.AreEqual(expected.DepartmentRef.type, actual.DepartmentRef.type); + // Assert.AreEqual(expected.DepartmentRef.Value, actual.DepartmentRef.Value); + // Assert.AreEqual(expected.CurrencyRef.name, actual.CurrencyRef.name); + // Assert.AreEqual(expected.CurrencyRef.type, actual.CurrencyRef.type); + // Assert.AreEqual(expected.CurrencyRef.Value, actual.CurrencyRef.Value); + //Assert.AreEqual(expected.ExchangeRate, actual.ExchangeRate); + //Assert.AreEqual(expected.ExchangeRateSpecified, actual.ExchangeRateSpecified); + //Assert.AreEqual(expected.PrivateNote, actual.PrivateNote); + //Assert.AreEqual(expected.TxnStatus, actual.TxnStatus); + //Assert.IsTrue(Helper.CheckEqual(expected.LinkedTxn, actual.LinkedTxn)); + //Assert.IsTrue(Helper.CheckEqual(expected.Line, actual.Line)); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.name, actual.TxnTaxDetail.DefaultTaxCodeRef.name); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.type, actual.TxnTaxDetail.DefaultTaxCodeRef.type); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.Value, actual.TxnTaxDetail.DefaultTaxCodeRef.Value); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.name, actual.TxnTaxDetail.TxnTaxCodeRef.name); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.type, actual.TxnTaxDetail.TxnTaxCodeRef.type); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.Value, actual.TxnTaxDetail.TxnTaxCodeRef.Value); + //Assert.AreEqual(expected.TxnTaxDetail.TotalTax, actual.TxnTaxDetail.TotalTax); + //Assert.AreEqual(expected.TxnTaxDetail.TotalTaxSpecified, actual.TxnTaxDetail.TotalTaxSpecified); + //Assert.IsTrue(Helper.CheckEqual(expected.TxnTaxDetail.TaxLine, actual.TxnTaxDetail.TaxLine)); + } + + internal static void VerifySalesOrderSparse(SalesOrder expected, SalesOrder actual) + { + Assert.AreEqual(expected.TrackingNum, actual.TrackingNum); + Assert.AreEqual(expected.DocNumber, actual.DocNumber); + } + + + internal static void VerifyCreditMemo(CreditMemo expected, CreditMemo actual) + { + //Assert.AreEqual(expected.RemainingCredit, actual.RemainingCredit); + //Assert.AreEqual(expected.RemainingCreditSpecified, actual.RemainingCreditSpecified); + // Assert.AreEqual(expected.CreditMemoEx.Any, actual.CreditMemoEx.Any); + //Assert.AreEqual(expected.AutoDocNumber, actual.AutoDocNumber); + //Assert.AreEqual(expected.AutoDocNumberSpecified, actual.AutoDocNumberSpecified); + // Assert.AreEqual(expected.CustomerRef.name, actual.CustomerRef.name); + // Assert.AreEqual(expected.CustomerRef.type, actual.CustomerRef.type); + Assert.AreEqual(expected.CustomerRef.Value, actual.CustomerRef.Value); + // Assert.AreEqual(expected.CustomerMemo.id, actual.CustomerMemo.id); + // Assert.AreEqual(expected.CustomerMemo.Value, actual.CustomerMemo.Value); + // Assert.AreEqual(expected.BillAddr.Line1, actual.BillAddr.Line1); + // Assert.AreEqual(expected.BillAddr.Line2, actual.BillAddr.Line2); + // Assert.AreEqual(expected.BillAddr.Line3, actual.BillAddr.Line3); + // Assert.AreEqual(expected.BillAddr.Line4, actual.BillAddr.Line4); + // Assert.AreEqual(expected.BillAddr.Line5, actual.BillAddr.Line5); + // Assert.AreEqual(expected.BillAddr.City, actual.BillAddr.City); + // Assert.AreEqual(expected.BillAddr.Country, actual.BillAddr.Country); + // Assert.AreEqual(expected.BillAddr.CountryCode, actual.BillAddr.CountryCode); + // Assert.AreEqual(expected.BillAddr.CountrySubDivisionCode, actual.BillAddr.CountrySubDivisionCode); + // Assert.AreEqual(expected.BillAddr.PostalCode, actual.BillAddr.PostalCode); + // Assert.AreEqual(expected.BillAddr.PostalCodeSuffix, actual.BillAddr.PostalCodeSuffix); + // Assert.AreEqual(expected.BillAddr.Lat, actual.BillAddr.Lat); + // Assert.AreEqual(expected.BillAddr.Long, actual.BillAddr.Long); + // Assert.AreEqual(expected.BillAddr.Tag, actual.BillAddr.Tag); + // Assert.AreEqual(expected.BillAddr.Note, actual.BillAddr.Note); + // Assert.AreEqual(expected.ShipAddr.Line1, actual.ShipAddr.Line1); + // Assert.AreEqual(expected.ShipAddr.Line2, actual.ShipAddr.Line2); + // Assert.AreEqual(expected.ShipAddr.Line3, actual.ShipAddr.Line3); + // Assert.AreEqual(expected.ShipAddr.Line4, actual.ShipAddr.Line4); + // Assert.AreEqual(expected.ShipAddr.Line5, actual.ShipAddr.Line5); + // Assert.AreEqual(expected.ShipAddr.City, actual.ShipAddr.City); + // Assert.AreEqual(expected.ShipAddr.Country, actual.ShipAddr.Country); + // Assert.AreEqual(expected.ShipAddr.CountryCode, actual.ShipAddr.CountryCode); + // Assert.AreEqual(expected.ShipAddr.CountrySubDivisionCode, actual.ShipAddr.CountrySubDivisionCode); + // Assert.AreEqual(expected.ShipAddr.PostalCode, actual.ShipAddr.PostalCode); + // Assert.AreEqual(expected.ShipAddr.PostalCodeSuffix, actual.ShipAddr.PostalCodeSuffix); + // Assert.AreEqual(expected.ShipAddr.Lat, actual.ShipAddr.Lat); + // Assert.AreEqual(expected.ShipAddr.Long, actual.ShipAddr.Long); + // Assert.AreEqual(expected.ShipAddr.Tag, actual.ShipAddr.Tag); + // Assert.AreEqual(expected.ShipAddr.Note, actual.ShipAddr.Note); + // Assert.AreEqual(expected.RemitToRef.name, actual.RemitToRef.name); + // Assert.AreEqual(expected.RemitToRef.type, actual.RemitToRef.type); + // Assert.AreEqual(expected.RemitToRef.Value, actual.RemitToRef.Value); + // Assert.AreEqual(expected.ClassRef.name, actual.ClassRef.name); + // Assert.AreEqual(expected.ClassRef.type, actual.ClassRef.type); + // Assert.AreEqual(expected.ClassRef.Value, actual.ClassRef.Value); + // Assert.AreEqual(expected.SalesTermRef.name, actual.SalesTermRef.name); + // Assert.AreEqual(expected.SalesTermRef.type, actual.SalesTermRef.type); + // Assert.AreEqual(expected.SalesTermRef.Value, actual.SalesTermRef.Value); + //Assert.AreEqual(expected.DueDate, actual.DueDate); + //Assert.AreEqual(expected.DueDateSpecified, actual.DueDateSpecified); + // Assert.AreEqual(expected.SalesRepRef.name, actual.SalesRepRef.name); + // Assert.AreEqual(expected.SalesRepRef.type, actual.SalesRepRef.type); + // Assert.AreEqual(expected.SalesRepRef.Value, actual.SalesRepRef.Value); + //Assert.AreEqual(expected.PONumber, actual.PONumber); + //Assert.AreEqual(expected.FOB, actual.FOB); + // Assert.AreEqual(expected.ShipMethodRef.name, actual.ShipMethodRef.name); + // Assert.AreEqual(expected.ShipMethodRef.type, actual.ShipMethodRef.type); + // Assert.AreEqual(expected.ShipMethodRef.Value, actual.ShipMethodRef.Value); + //Assert.AreEqual(expected.ShipDate, actual.ShipDate); + //Assert.AreEqual(expected.ShipDateSpecified, actual.ShipDateSpecified); + //Assert.AreEqual(expected.TrackingNum, actual.TrackingNum); + //Assert.AreEqual(expected.GlobalTaxCalculationSpecified, actual.GlobalTaxCalculationSpecified); + //Assert.AreEqual(expected.TotalAmt, actual.TotalAmt); + //Assert.AreEqual(expected.TotalAmtSpecified, actual.TotalAmtSpecified); + //Assert.AreEqual(expected.HomeTotalAmt, actual.HomeTotalAmt); + //Assert.AreEqual(expected.HomeTotalAmtSpecified, actual.HomeTotalAmtSpecified); + //Assert.AreEqual(expected.ApplyTaxAfterDiscount, actual.ApplyTaxAfterDiscount); + //Assert.AreEqual(expected.ApplyTaxAfterDiscountSpecified, actual.ApplyTaxAfterDiscountSpecified); + // Assert.AreEqual(expected.TemplateRef.name, actual.TemplateRef.name); + // Assert.AreEqual(expected.TemplateRef.type, actual.TemplateRef.type); + // Assert.AreEqual(expected.TemplateRef.Value, actual.TemplateRef.Value); + //Assert.AreEqual(expected.PrintStatusSpecified, actual.PrintStatusSpecified); + //Assert.AreEqual(expected.EmailStatusSpecified, actual.EmailStatusSpecified); + // Assert.AreEqual(expected.BillEmail.Address, actual.BillEmail.Address); + // Assert.AreEqual(expected.BillEmail.Default, actual.BillEmail.Default); + // Assert.AreEqual(expected.BillEmail.DefaultSpecified, actual.BillEmail.DefaultSpecified); + // Assert.AreEqual(expected.BillEmail.Tag, actual.BillEmail.Tag); + // Assert.AreEqual(expected.ARAccountRef.name, actual.ARAccountRef.name); + // Assert.AreEqual(expected.ARAccountRef.type, actual.ARAccountRef.type); + // Assert.AreEqual(expected.ARAccountRef.Value, actual.ARAccountRef.Value); + //Assert.AreEqual(expected.Balance, actual.Balance); + //Assert.AreEqual(expected.BalanceSpecified, actual.BalanceSpecified); + //Assert.AreEqual(expected.FinanceCharge, actual.FinanceCharge); + //Assert.AreEqual(expected.FinanceChargeSpecified, actual.FinanceChargeSpecified); + // Assert.AreEqual(expected.PaymentMethodRef.name, actual.PaymentMethodRef.name); + // Assert.AreEqual(expected.PaymentMethodRef.type, actual.PaymentMethodRef.type); + // Assert.AreEqual(expected.PaymentMethodRef.Value, actual.PaymentMethodRef.Value); + //Assert.AreEqual(expected.PaymentRefNum, actual.PaymentRefNum); + //Assert.AreEqual(expected.PaymentTypeSpecified, actual.PaymentTypeSpecified); + //Assert.AreEqual(expected.AnyIntuitObject, actual.AnyIntuitObject); + //Assert.AreEqual(expected.DepositToAccountRef.name, actual.DepositToAccountRef.name); + //Assert.AreEqual(expected.DepositToAccountRef.type, actual.DepositToAccountRef.type); + //Assert.AreEqual(expected.DepositToAccountRef.Value, actual.DepositToAccountRef.Value); + Assert.AreEqual(expected.DocNumber, actual.DocNumber); + Assert.AreEqual(expected.TxnDate, actual.TxnDate); + Assert.AreEqual(expected.TxnDateSpecified, actual.TxnDateSpecified); + // Assert.AreEqual(expected.DepartmentRef.name, actual.DepartmentRef.name); + // Assert.AreEqual(expected.DepartmentRef.type, actual.DepartmentRef.type); + // Assert.AreEqual(expected.DepartmentRef.Value, actual.DepartmentRef.Value); + // Assert.AreEqual(expected.CurrencyRef.name, actual.CurrencyRef.name); + // Assert.AreEqual(expected.CurrencyRef.type, actual.CurrencyRef.type); + // Assert.AreEqual(expected.CurrencyRef.Value, actual.CurrencyRef.Value); + //Assert.AreEqual(expected.ExchangeRate, actual.ExchangeRate); + //Assert.AreEqual(expected.ExchangeRateSpecified, actual.ExchangeRateSpecified); + //Assert.AreEqual(expected.PrivateNote, actual.PrivateNote); + //Assert.AreEqual(expected.TxnStatus, actual.TxnStatus); + //Assert.IsTrue(Helper.CheckEqual(expected.LinkedTxn, actual.LinkedTxn)); + Assert.IsTrue(Helper.CheckEqual(expected.Line, actual.Line)); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.name, actual.TxnTaxDetail.DefaultTaxCodeRef.name); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.type, actual.TxnTaxDetail.DefaultTaxCodeRef.type); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.Value, actual.TxnTaxDetail.DefaultTaxCodeRef.Value); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.name, actual.TxnTaxDetail.TxnTaxCodeRef.name); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.type, actual.TxnTaxDetail.TxnTaxCodeRef.type); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.Value, actual.TxnTaxDetail.TxnTaxCodeRef.Value); + //Assert.AreEqual(expected.TxnTaxDetail.TotalTax, actual.TxnTaxDetail.TotalTax); + //Assert.AreEqual(expected.TxnTaxDetail.TotalTaxSpecified, actual.TxnTaxDetail.TotalTaxSpecified); + //Assert.IsTrue(Helper.CheckEqual(expected.TxnTaxDetail.TaxLine, actual.TxnTaxDetail.TaxLine)); + } + + + internal static void VerifyCreditMemoSparse(CreditMemo expected, CreditMemo actual) + { + Assert.AreEqual(expected.DocNumber, actual.DocNumber); + Assert.AreEqual(expected.TxnDate, actual.TxnDate); + } + + internal static void VerifyRefundReceipt(RefundReceipt expected, RefundReceipt actual) + { + //Assert.AreEqual(expected.RemainingCredit, actual.RemainingCredit); + //Assert.AreEqual(expected.RemainingCreditSpecified, actual.RemainingCreditSpecified); + //Assert.AreEqual(expected.RefundReceiptEx.Any, actual.RefundReceiptEx.Any); + //Assert.AreEqual(expected.AutoDocNumber, actual.AutoDocNumber); + //Assert.AreEqual(expected.AutoDocNumberSpecified, actual.AutoDocNumberSpecified); + Assert.AreEqual(expected.CustomerRef.name, actual.CustomerRef.name); + //Assert.AreEqual(expected.CustomerRef.type, actual.CustomerRef.type); + Assert.AreEqual(expected.CustomerRef.Value, actual.CustomerRef.Value); + //Assert.AreEqual(expected.CustomerMemo.id, actual.CustomerMemo.id); + //Assert.AreEqual(expected.CustomerMemo.Value, actual.CustomerMemo.Value); + // Assert.AreEqual(expected.BillAddr.Line1, actual.BillAddr.Line1); + // Assert.AreEqual(expected.BillAddr.Line2, actual.BillAddr.Line2); + // Assert.AreEqual(expected.BillAddr.Line3, actual.BillAddr.Line3); + // Assert.AreEqual(expected.BillAddr.Line4, actual.BillAddr.Line4); + // Assert.AreEqual(expected.BillAddr.Line5, actual.BillAddr.Line5); + // Assert.AreEqual(expected.BillAddr.City, actual.BillAddr.City); + // Assert.AreEqual(expected.BillAddr.Country, actual.BillAddr.Country); + // Assert.AreEqual(expected.BillAddr.CountryCode, actual.BillAddr.CountryCode); + // Assert.AreEqual(expected.BillAddr.CountrySubDivisionCode, actual.BillAddr.CountrySubDivisionCode); + // Assert.AreEqual(expected.BillAddr.PostalCode, actual.BillAddr.PostalCode); + // Assert.AreEqual(expected.BillAddr.PostalCodeSuffix, actual.BillAddr.PostalCodeSuffix); + // Assert.AreEqual(expected.BillAddr.Lat, actual.BillAddr.Lat); + // Assert.AreEqual(expected.BillAddr.Long, actual.BillAddr.Long); + // Assert.AreEqual(expected.BillAddr.Tag, actual.BillAddr.Tag); + // Assert.AreEqual(expected.BillAddr.Note, actual.BillAddr.Note); + // Assert.AreEqual(expected.ShipAddr.Line1, actual.ShipAddr.Line1); + // Assert.AreEqual(expected.ShipAddr.Line2, actual.ShipAddr.Line2); + // Assert.AreEqual(expected.ShipAddr.Line3, actual.ShipAddr.Line3); + // Assert.AreEqual(expected.ShipAddr.Line4, actual.ShipAddr.Line4); + // Assert.AreEqual(expected.ShipAddr.Line5, actual.ShipAddr.Line5); + // Assert.AreEqual(expected.ShipAddr.City, actual.ShipAddr.City); + // Assert.AreEqual(expected.ShipAddr.Country, actual.ShipAddr.Country); + // Assert.AreEqual(expected.ShipAddr.CountryCode, actual.ShipAddr.CountryCode); + // Assert.AreEqual(expected.ShipAddr.CountrySubDivisionCode, actual.ShipAddr.CountrySubDivisionCode); + // Assert.AreEqual(expected.ShipAddr.PostalCode, actual.ShipAddr.PostalCode); + // Assert.AreEqual(expected.ShipAddr.PostalCodeSuffix, actual.ShipAddr.PostalCodeSuffix); + // Assert.AreEqual(expected.ShipAddr.Lat, actual.ShipAddr.Lat); + // Assert.AreEqual(expected.ShipAddr.Long, actual.ShipAddr.Long); + // Assert.AreEqual(expected.ShipAddr.Tag, actual.ShipAddr.Tag); + // Assert.AreEqual(expected.ShipAddr.Note, actual.ShipAddr.Note); + // Assert.AreEqual(expected.RemitToRef.name, actual.RemitToRef.name); + // Assert.AreEqual(expected.RemitToRef.type, actual.RemitToRef.type); + // Assert.AreEqual(expected.RemitToRef.Value, actual.RemitToRef.Value); + // Assert.AreEqual(expected.ClassRef.name, actual.ClassRef.name); + // Assert.AreEqual(expected.ClassRef.type, actual.ClassRef.type); + // Assert.AreEqual(expected.ClassRef.Value, actual.ClassRef.Value); + // Assert.AreEqual(expected.SalesTermRef.name, actual.SalesTermRef.name); + // Assert.AreEqual(expected.SalesTermRef.type, actual.SalesTermRef.type); + // Assert.AreEqual(expected.SalesTermRef.Value, actual.SalesTermRef.Value); + //Assert.AreEqual(expected.DueDate, actual.DueDate); + //Assert.AreEqual(expected.DueDateSpecified, actual.DueDateSpecified); + // Assert.AreEqual(expected.SalesRepRef.name, actual.SalesRepRef.name); + // Assert.AreEqual(expected.SalesRepRef.type, actual.SalesRepRef.type); + // Assert.AreEqual(expected.SalesRepRef.Value, actual.SalesRepRef.Value); + //Assert.AreEqual(expected.PONumber, actual.PONumber); + //Assert.AreEqual(expected.FOB, actual.FOB); + // Assert.AreEqual(expected.ShipMethodRef.name, actual.ShipMethodRef.name); + // Assert.AreEqual(expected.ShipMethodRef.type, actual.ShipMethodRef.type); + // Assert.AreEqual(expected.ShipMethodRef.Value, actual.ShipMethodRef.Value); + //Assert.AreEqual(expected.ShipDate, actual.ShipDate); + //Assert.AreEqual(expected.ShipDateSpecified, actual.ShipDateSpecified); + //Assert.AreEqual(expected.TrackingNum, actual.TrackingNum); + //Assert.AreEqual(expected.GlobalTaxCalculationSpecified, actual.GlobalTaxCalculationSpecified); + //Assert.AreEqual(expected.TotalAmt, actual.TotalAmt); + //Assert.AreEqual(expected.TotalAmtSpecified, actual.TotalAmtSpecified); + //Assert.AreEqual(expected.HomeTotalAmt, actual.HomeTotalAmt); + //Assert.AreEqual(expected.HomeTotalAmtSpecified, actual.HomeTotalAmtSpecified); + //Assert.AreEqual(expected.ApplyTaxAfterDiscount, actual.ApplyTaxAfterDiscount); + //Assert.AreEqual(expected.ApplyTaxAfterDiscountSpecified, actual.ApplyTaxAfterDiscountSpecified); + // Assert.AreEqual(expected.TemplateRef.name, actual.TemplateRef.name); + // Assert.AreEqual(expected.TemplateRef.type, actual.TemplateRef.type); + // Assert.AreEqual(expected.TemplateRef.Value, actual.TemplateRef.Value); + Assert.AreEqual(expected.PrintStatusSpecified, actual.PrintStatusSpecified); + //Assert.AreEqual(expected.EmailStatusSpecified, actual.EmailStatusSpecified); + Assert.AreEqual(expected.BillEmail.Address, actual.BillEmail.Address); + //Assert.AreEqual(expected.BillEmail.Default, actual.BillEmail.Default); + //Assert.AreEqual(expected.BillEmail.DefaultSpecified, actual.BillEmail.DefaultSpecified); + //Assert.AreEqual(expected.BillEmail.Tag, actual.BillEmail.Tag); + //Assert.AreEqual(expected.ARAccountRef.name, actual.ARAccountRef.name); + //Assert.AreEqual(expected.ARAccountRef.type, actual.ARAccountRef.type); + //Assert.AreEqual(expected.ARAccountRef.Value, actual.ARAccountRef.Value); + Assert.AreEqual(expected.Balance, actual.Balance); + Assert.AreEqual(expected.BalanceSpecified, actual.BalanceSpecified); + //Assert.AreEqual(expected.FinanceCharge, actual.FinanceCharge); + //Assert.AreEqual(expected.FinanceChargeSpecified, actual.FinanceChargeSpecified); + //Assert.AreEqual(expected.PaymentMethodRef.name, actual.PaymentMethodRef.name); + //Assert.AreEqual(expected.PaymentMethodRef.type, actual.PaymentMethodRef.type); + //Assert.AreEqual(expected.PaymentMethodRef.Value, actual.PaymentMethodRef.Value); + //Assert.AreEqual(expected.PaymentRefNum, actual.PaymentRefNum); + //Assert.AreEqual(expected.PaymentTypeSpecified, actual.PaymentTypeSpecified); + //Assert.AreEqual(expected.AnyIntuitObject, actual.AnyIntuitObject); + // Assert.AreEqual(expected.DepositToAccountRef.name, actual.DepositToAccountRef.name); + // Assert.AreEqual(expected.DepositToAccountRef.type, actual.DepositToAccountRef.type); + // Assert.AreEqual(expected.DepositToAccountRef.Value, actual.DepositToAccountRef.Value); + Assert.AreEqual(expected.DocNumber, actual.DocNumber); + Assert.AreEqual(expected.TxnDate, actual.TxnDate); + //Assert.AreEqual(expected.TxnDateSpecified, actual.TxnDateSpecified); + // Assert.AreEqual(expected.DepartmentRef.name, actual.DepartmentRef.name); + // Assert.AreEqual(expected.DepartmentRef.type, actual.DepartmentRef.type); + // Assert.AreEqual(expected.DepartmentRef.Value, actual.DepartmentRef.Value); + // Assert.AreEqual(expected.CurrencyRef.name, actual.CurrencyRef.name); + // Assert.AreEqual(expected.CurrencyRef.type, actual.CurrencyRef.type); + // Assert.AreEqual(expected.CurrencyRef.Value, actual.CurrencyRef.Value); + //Assert.AreEqual(expected.ExchangeRate, actual.ExchangeRate); + //Assert.AreEqual(expected.ExchangeRateSpecified, actual.ExchangeRateSpecified); + Assert.AreEqual(expected.PrivateNote, actual.PrivateNote); + //Assert.AreEqual(expected.TxnStatus, actual.TxnStatus); + //Assert.IsTrue(Helper.CheckEqual(expected.LinkedTxn, actual.LinkedTxn)); + //Assert.IsTrue(Helper.CheckEqual(expected.Line, actual.Line)); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.name, actual.TxnTaxDetail.DefaultTaxCodeRef.name); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.type, actual.TxnTaxDetail.DefaultTaxCodeRef.type); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.Value, actual.TxnTaxDetail.DefaultTaxCodeRef.Value); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.name, actual.TxnTaxDetail.TxnTaxCodeRef.name); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.type, actual.TxnTaxDetail.TxnTaxCodeRef.type); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.Value, actual.TxnTaxDetail.TxnTaxCodeRef.Value); + // Assert.AreEqual(expected.TxnTaxDetail.TotalTax, actual.TxnTaxDetail.TotalTax); + // Assert.AreEqual(expected.TxnTaxDetail.TotalTaxSpecified, actual.TxnTaxDetail.TotalTaxSpecified); + // Assert.IsTrue(Helper.CheckEqual(expected.TxnTaxDetail.TaxLine, actual.TxnTaxDetail.TaxLine)); + } + + + internal static void VerifyRefundReceiptSparse(RefundReceipt expected, RefundReceipt actual) + { + Assert.AreEqual(expected.PrintStatus, actual.PrintStatus); + Assert.AreEqual(expected.EmailStatus, actual.EmailStatus); + } + + internal static void VerifyCompanyCurrency(CompanyCurrency expected, CompanyCurrency actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.Code, actual.Code); + Assert.AreEqual(expected.Active, actual.Active); + Assert.AreEqual(expected.ActiveSpecified, actual.ActiveSpecified); + //Assert.AreEqual(expected.CodeSpecified, actual.CodeSpecified); + //Assert.AreEqual(expected.Separator, actual.Separator); + //Assert.AreEqual(expected.Format, actual.Format); + //Assert.AreEqual(expected.DecimalPlaces, actual.DecimalPlaces); + //Assert.AreEqual(expected.DecimalSeparator, actual.DecimalSeparator); + //Assert.AreEqual(expected.Symbol, actual.Symbol); + //Assert.AreEqual(expected.SymbolPositionSpecified, actual.SymbolPositionSpecified); + //Assert.AreEqual(expected.UserDefined, actual.UserDefined); + //Assert.AreEqual(expected.UserDefinedSpecified, actual.UserDefinedSpecified); + //Assert.AreEqual(expected.ExchangeRate, actual.ExchangeRate); + //Assert.AreEqual(expected.ExchangeRateSpecified, actual.ExchangeRateSpecified); + //Assert.AreEqual(expected.AsOfDate, actual.AsOfDate); + //Assert.AreEqual(expected.AsOfDateSpecified, actual.AsOfDateSpecified); + //Assert.AreEqual(expected.CurrencyEx.Any, actual.CurrencyEx.Any); + } + + + internal static void VerifyCompanyCurrencySparse(CompanyCurrency expected, CompanyCurrency actual) + { + Assert.AreEqual(expected.Name, actual.Name); + } + + internal static void VerifySalesRep(SalesRep expected, SalesRep actual) + { + Assert.AreEqual(expected.NameOfSpecified, actual.NameOfSpecified); + Assert.AreEqual(expected.Active, actual.Active); + Assert.AreEqual(expected.ActiveSpecified, actual.ActiveSpecified); + //Assert.AreEqual(expected.AnyIntuitObject.name, actual.AnyIntuitObject.name); + //Assert.AreEqual(expected.AnyIntuitObject.type, actual.AnyIntuitObject.type); + //Assert.AreEqual(expected.AnyIntuitObject.Value, actual.AnyIntuitObject.Value); + Assert.AreEqual(expected.Initials, actual.Initials); + //Assert.AreEqual(expected.SalesRepEx.Any, actual.SalesRepEx.Any); + } + + internal static void VerifySalesRepSparse(SalesRep expected, SalesRep actual) + { + Assert.AreEqual(expected.Initials, actual.Initials); + } + + internal static void VerifyPriceLevel(PriceLevel expected, PriceLevel actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.Active, actual.Active); + //Assert.AreEqual(expected.AnyIntuitObjects, actual.AnyIntuitObjects); + Assert.AreEqual(expected.CurrencyRef.name, actual.CurrencyRef.name); + //Assert.AreEqual(expected.CurrencyRef.type, actual.CurrencyRef.type); + Assert.AreEqual(expected.CurrencyRef.Value, actual.CurrencyRef.Value); + //Assert.AreEqual(expected.PriceLevelEx.Any, actual.PriceLevelEx.Any); + } + + internal static void VerifyPriceLevelSparse(PriceLevel expected, PriceLevel actual) + { + Assert.AreEqual(expected.Name, actual.Name); + } + + internal static void VerifyPriceLevelPerItem(PriceLevelPerItem expected, PriceLevelPerItem actual) + { + Assert.AreEqual(expected.Overview, actual.Overview); + } + + + internal static void VerifyPriceLevelPerItemSparse(PriceLevelPerItem expected, PriceLevelPerItem actual) + { + Assert.AreEqual(expected.Overview, actual.Overview); + } + + internal static void VerifyCustomerMsg(CustomerMsg expected, CustomerMsg actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.Active, actual.Active); + Assert.AreEqual(expected.ActiveSpecified, actual.ActiveSpecified); + //Assert.AreEqual(expected.CustomerMsgEx.Any, actual.CustomerMsgEx.Any); + } + + internal static void VerifyCustomerMsgSparse(CustomerMsg expected, CustomerMsg actual) + { + Assert.AreEqual(expected.Name, actual.Name); + } + + + internal static void VerifyJournalCode(JournalCode expected, JournalCode actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.Type, actual.Type); + + } + + internal static void VerifyJournalCodeSparse(JournalCode expected, JournalCode actual) + { + Assert.AreEqual(expected.Description, actual.Description); + } + + + internal static void VerifyJournalEntry(JournalEntry expected, JournalEntry actual) + { + Assert.AreEqual(expected.Adjustment, actual.Adjustment); + Assert.AreEqual(expected.AdjustmentSpecified, actual.AdjustmentSpecified); + // Assert.AreEqual(expected.JournalEntryEx.Any, actual.JournalEntryEx.Any); + Assert.AreEqual(expected.DocNumber, actual.DocNumber); + Assert.AreEqual(expected.TxnDate, actual.TxnDate); + Assert.AreEqual(expected.TxnDateSpecified, actual.TxnDateSpecified); + // Assert.AreEqual(expected.DepartmentRef.name, actual.DepartmentRef.name); + // Assert.AreEqual(expected.DepartmentRef.type, actual.DepartmentRef.type); + // Assert.AreEqual(expected.DepartmentRef.Value, actual.DepartmentRef.Value); + // Assert.AreEqual(expected.CurrencyRef.name, actual.CurrencyRef.name); + // Assert.AreEqual(expected.CurrencyRef.type, actual.CurrencyRef.type); + // Assert.AreEqual(expected.CurrencyRef.Value, actual.CurrencyRef.Value); + //Assert.AreEqual(expected.PrivateNote, actual.PrivateNote); + //Assert.AreEqual(expected.TxnStatus, actual.TxnStatus); + //Assert.IsTrue(Helper.CheckEqual(expected.LinkedTxn, actual.LinkedTxn)); + //Assert.IsTrue(Helper.CheckEqual(expected.Line, actual.Line)); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.name, actual.TxnTaxDetail.DefaultTaxCodeRef.name); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.type, actual.TxnTaxDetail.DefaultTaxCodeRef.type); + // Assert.AreEqual(expected.TxnTaxDetail.DefaultTaxCodeRef.Value, actual.TxnTaxDetail.DefaultTaxCodeRef.Value); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.name, actual.TxnTaxDetail.TxnTaxCodeRef.name); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.type, actual.TxnTaxDetail.TxnTaxCodeRef.type); + // Assert.AreEqual(expected.TxnTaxDetail.TxnTaxCodeRef.Value, actual.TxnTaxDetail.TxnTaxCodeRef.Value); + // Assert.AreEqual(expected.TxnTaxDetail.TotalTax, actual.TxnTaxDetail.TotalTax); + // Assert.AreEqual(expected.TxnTaxDetail.TotalTaxSpecified, actual.TxnTaxDetail.TotalTaxSpecified); + // Assert.IsTrue(Helper.CheckEqual(expected.TxnTaxDetail.TaxLine, actual.TxnTaxDetail.TaxLine)); + } + + + internal static void VerifyJournalEntrySparse(JournalEntry expected, JournalEntry actual) + { + Assert.AreEqual(expected.DocNumber, actual.DocNumber); + } + + internal static void VerifyTimeActivity(TimeActivity expected, TimeActivity actual) + { + Assert.AreEqual(expected.TimeZone, actual.TimeZone); + Assert.AreEqual(expected.TxnDate, actual.TxnDate); + Assert.AreEqual(expected.TxnDateSpecified, actual.TxnDateSpecified); + Assert.AreEqual(expected.NameOfSpecified, actual.NameOfSpecified); + //Assert.AreEqual(expected.AnyIntuitObject.name, actual.AnyIntuitObject.name); + //Assert.AreEqual(expected.AnyIntuitObject.type, actual.AnyIntuitObject.type); + //Assert.AreEqual(expected.AnyIntuitObject.Value, actual.AnyIntuitObject.Value); + // Assert.AreEqual(expected.CustomerRef.name, actual.CustomerRef.name); + // Assert.AreEqual(expected.CustomerRef.type, actual.CustomerRef.type); + // Assert.AreEqual(expected.CustomerRef.Value, actual.CustomerRef.Value); + // Assert.AreEqual(expected.ItemRef.name, actual.ItemRef.name); + // Assert.AreEqual(expected.ItemRef.type, actual.ItemRef.type); + // Assert.AreEqual(expected.ItemRef.Value, actual.ItemRef.Value); + // Assert.AreEqual(expected.ClassRef.name, actual.ClassRef.name); + // Assert.AreEqual(expected.ClassRef.type, actual.ClassRef.type); + // Assert.AreEqual(expected.ClassRef.Value, actual.ClassRef.Value); + // Assert.AreEqual(expected.PayrollItemRef.name, actual.PayrollItemRef.name); + // Assert.AreEqual(expected.PayrollItemRef.type, actual.PayrollItemRef.type); + // Assert.AreEqual(expected.PayrollItemRef.Value, actual.PayrollItemRef.Value); + //Assert.AreEqual(expected.BillableStatusSpecified, actual.BillableStatusSpecified); + Assert.AreEqual(expected.Taxable, actual.Taxable); + //Assert.AreEqual(expected.TaxableSpecified, actual.TaxableSpecified); + Assert.AreEqual(expected.HourlyRate, actual.HourlyRate); + //Assert.AreEqual(expected.HourlyRateSpecified, actual.HourlyRateSpecified); + Assert.AreEqual(expected.Hours, actual.Hours); + //Assert.AreEqual(expected.HoursSpecified, actual.HoursSpecified); + //Assert.AreEqual(expected.Minutes, actual.Minutes); + //Assert.AreEqual(expected.MinutesSpecified, actual.MinutesSpecified); + //Assert.AreEqual(expected.BreakHours, actual.BreakHours); + //Assert.AreEqual(expected.BreakHoursSpecified, actual.BreakHoursSpecified); + //Assert.AreEqual(expected.BreakMinutes, actual.BreakMinutes); + //Assert.AreEqual(expected.BreakMinutesSpecified, actual.BreakMinutesSpecified); + Assert.AreEqual(expected.StartTime, actual.StartTime); + Assert.AreEqual(expected.StartTimeSpecified, actual.StartTimeSpecified); + Assert.AreEqual(expected.EndTime, actual.EndTime); + Assert.AreEqual(expected.EndTimeSpecified, actual.EndTimeSpecified); + Assert.AreEqual(expected.Description, actual.Description); + //Assert.AreEqual(expected.TimeActivityEx.Any, actual.TimeActivityEx.Any); + } + + internal static void VerifyTimeActivitySparse(TimeActivity expected, TimeActivity actual) + { + Assert.AreEqual(expected.Description, actual.Description); + } + + internal static void VerifyInventorySite(InventorySite expected, InventorySite actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.Active, actual.Active); + Assert.AreEqual(expected.ActiveSpecified, actual.ActiveSpecified); + //Assert.AreEqual(expected.DefaultSite, actual.DefaultSite); + //Assert.AreEqual(expected.DefaultSiteSpecified, actual.DefaultSiteSpecified); + Assert.AreEqual(expected.Description, actual.Description); + //Assert.AreEqual(expected.Contact, actual.Contact); + //Assert.IsTrue(Helper.CheckEqual(expected.Addr, actual.Addr)); + //Assert.IsTrue(Helper.CheckEqual(expected.ContactInfo, actual.ContactInfo)); + // Assert.AreEqual(expected.InventorySiteEx.Any, actual.InventorySiteEx.Any); + } + + + internal static void VerifyInventorySiteSparse(InventorySite expected, InventorySite actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.Description, actual.Description); + } + + internal static void VerifyShipMethod(ShipMethod expected, ShipMethod actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.Active, actual.Active); + // Assert.AreEqual(expected.ShipMethodEx.Any, actual.ShipMethodEx.Any); + } + + internal static void VerifyShipMethodSparse(ShipMethod expected, ShipMethod actual) + { + Assert.AreEqual(expected.Name, actual.Name); + } + + internal static void VerifyTask(Task expected, Task actual) + { + //Assert.AreEqual(expected.Notes, actual.Notes); + Assert.AreEqual(expected.From, actual.From); + Assert.AreEqual(expected.Active, actual.Active); + Assert.AreEqual(expected.ActiveSpecified, actual.ActiveSpecified); + Assert.AreEqual(expected.Done, actual.Done); + Assert.AreEqual(expected.DoneSpecified, actual.DoneSpecified); + Assert.AreEqual(expected.ReminderDate, actual.ReminderDate); + Assert.AreEqual(expected.ReminderDateSpecified, actual.ReminderDateSpecified); + //Assert.AreEqual(expected.TaskEx.Any, actual.TaskEx.Any); + } + + internal static void VerifyTaskSparse(Task expected, Task actual) + { + Assert.AreEqual(expected.From, actual.From); + } + + internal static void VerifyPreferences(Preferences expected, Preferences actual) + { + //Assert.AreEqual(expected.AccountingInfoPrefs.UseAccountNumbers, actual.AccountingInfoPrefs.UseAccountNumbers); + //Assert.AreEqual(expected.AccountingInfoPrefs.UseAccountNumbersSpecified, actual.AccountingInfoPrefs.UseAccountNumbersSpecified); + // Assert.AreEqual(expected.AccountingInfoPrefs.DefaultARAccount.name, actual.AccountingInfoPrefs.DefaultARAccount.name); + // Assert.AreEqual(expected.AccountingInfoPrefs.DefaultARAccount.type, actual.AccountingInfoPrefs.DefaultARAccount.type); + // Assert.AreEqual(expected.AccountingInfoPrefs.DefaultARAccount.Value, actual.AccountingInfoPrefs.DefaultARAccount.Value); + // Assert.AreEqual(expected.AccountingInfoPrefs.DefaultAPAccount.name, actual.AccountingInfoPrefs.DefaultAPAccount.name); + // Assert.AreEqual(expected.AccountingInfoPrefs.DefaultAPAccount.type, actual.AccountingInfoPrefs.DefaultAPAccount.type); + // Assert.AreEqual(expected.AccountingInfoPrefs.DefaultAPAccount.Value, actual.AccountingInfoPrefs.DefaultAPAccount.Value); + //Assert.AreEqual(expected.AccountingInfoPrefs.RequiresAccounts, actual.AccountingInfoPrefs.RequiresAccounts); + //Assert.AreEqual(expected.AccountingInfoPrefs.RequiresAccountsSpecified, actual.AccountingInfoPrefs.RequiresAccountsSpecified); + //Assert.AreEqual(expected.AccountingInfoPrefs.TrackDepartments, actual.AccountingInfoPrefs.TrackDepartments); + //Assert.AreEqual(expected.AccountingInfoPrefs.TrackDepartmentsSpecified, actual.AccountingInfoPrefs.TrackDepartmentsSpecified); + //Assert.AreEqual(expected.AccountingInfoPrefs.DepartmentTerminology, actual.AccountingInfoPrefs.DepartmentTerminology); + //Assert.AreEqual(expected.AccountingInfoPrefs.ClassTrackingPerTxn, actual.AccountingInfoPrefs.ClassTrackingPerTxn); + //Assert.AreEqual(expected.AccountingInfoPrefs.ClassTrackingPerTxnSpecified, actual.AccountingInfoPrefs.ClassTrackingPerTxnSpecified); + //Assert.AreEqual(expected.AccountingInfoPrefs.ClassTrackingPerTxnLine, actual.AccountingInfoPrefs.ClassTrackingPerTxnLine); + //Assert.AreEqual(expected.AccountingInfoPrefs.ClassTrackingPerTxnLineSpecified, actual.AccountingInfoPrefs.ClassTrackingPerTxnLineSpecified); + //Assert.AreEqual(expected.AccountingInfoPrefs.AutoJournalEntryNumber, actual.AccountingInfoPrefs.AutoJournalEntryNumber); + //Assert.AreEqual(expected.AccountingInfoPrefs.AutoJournalEntryNumberSpecified, actual.AccountingInfoPrefs.AutoJournalEntryNumberSpecified); + //Assert.AreEqual(expected.AccountingInfoPrefs.FirstMonthOfFiscalYearSpecified, actual.AccountingInfoPrefs.FirstMonthOfFiscalYearSpecified); + //Assert.AreEqual(expected.AccountingInfoPrefs.TaxYearMonthSpecified, actual.AccountingInfoPrefs.TaxYearMonthSpecified); + //Assert.AreEqual(expected.AccountingInfoPrefs.TaxForm, actual.AccountingInfoPrefs.TaxForm); + //Assert.AreEqual(expected.AccountingInfoPrefs.BookCloseDate, actual.AccountingInfoPrefs.BookCloseDate); + //Assert.AreEqual(expected.AccountingInfoPrefs.BookCloseDateSpecified, actual.AccountingInfoPrefs.BookCloseDateSpecified); + //Assert.IsTrue(Helper.CheckEqual(expected.AccountingInfoPrefs.OtherContactInfo, actual.AccountingInfoPrefs.OtherContactInfo)); + //Assert.AreEqual(expected.AccountingInfoPrefs.CustomerTerminology, actual.AccountingInfoPrefs.CustomerTerminology); + //Assert.AreEqual(expected.AdvancedInventoryPrefs.MLIAvailable, actual.AdvancedInventoryPrefs.MLIAvailable); + //Assert.AreEqual(expected.AdvancedInventoryPrefs.MLIAvailableSpecified, actual.AdvancedInventoryPrefs.MLIAvailableSpecified); + //Assert.AreEqual(expected.AdvancedInventoryPrefs.MLIEnabled, actual.AdvancedInventoryPrefs.MLIEnabled); + //Assert.AreEqual(expected.AdvancedInventoryPrefs.MLIEnabledSpecified, actual.AdvancedInventoryPrefs.MLIEnabledSpecified); + //Assert.AreEqual(expected.AdvancedInventoryPrefs.EnhancedInventoryReceivingEnabled, actual.AdvancedInventoryPrefs.EnhancedInventoryReceivingEnabled); + //Assert.AreEqual(expected.AdvancedInventoryPrefs.EnhancedInventoryReceivingEnabledSpecified, actual.AdvancedInventoryPrefs.EnhancedInventoryReceivingEnabledSpecified); + //Assert.AreEqual(expected.AdvancedInventoryPrefs.TrackingSerialOrLotNumber, actual.AdvancedInventoryPrefs.TrackingSerialOrLotNumber); + //Assert.AreEqual(expected.AdvancedInventoryPrefs.TrackingSerialOrLotNumberSpecified, actual.AdvancedInventoryPrefs.TrackingSerialOrLotNumberSpecified); + //Assert.AreEqual(expected.AdvancedInventoryPrefs.TrackingOnSalesTransactionsEnabled, actual.AdvancedInventoryPrefs.TrackingOnSalesTransactionsEnabled); + //Assert.AreEqual(expected.AdvancedInventoryPrefs.TrackingOnSalesTransactionsEnabledSpecified, actual.AdvancedInventoryPrefs.TrackingOnSalesTransactionsEnabledSpecified); + //Assert.AreEqual(expected.AdvancedInventoryPrefs.TrackingOnPurchaseTransactionsEnabled, actual.AdvancedInventoryPrefs.TrackingOnPurchaseTransactionsEnabled); + //Assert.AreEqual(expected.AdvancedInventoryPrefs.TrackingOnPurchaseTransactionsEnabledSpecified, actual.AdvancedInventoryPrefs.TrackingOnPurchaseTransactionsEnabledSpecified); + //Assert.AreEqual(expected.AdvancedInventoryPrefs.TrackingOnInventoryAdjustmentEnabled, actual.AdvancedInventoryPrefs.TrackingOnInventoryAdjustmentEnabled); + //Assert.AreEqual(expected.AdvancedInventoryPrefs.TrackingOnInventoryAdjustmentEnabledSpecified, actual.AdvancedInventoryPrefs.TrackingOnInventoryAdjustmentEnabledSpecified); + //Assert.AreEqual(expected.AdvancedInventoryPrefs.TrackingOnBuildAssemblyEnabled, actual.AdvancedInventoryPrefs.TrackingOnBuildAssemblyEnabled); + //Assert.AreEqual(expected.AdvancedInventoryPrefs.TrackingOnBuildAssemblyEnabledSpecified, actual.AdvancedInventoryPrefs.TrackingOnBuildAssemblyEnabledSpecified); + //Assert.AreEqual(expected.AdvancedInventoryPrefs.FIFOEnabled, actual.AdvancedInventoryPrefs.FIFOEnabled); + //Assert.AreEqual(expected.AdvancedInventoryPrefs.FIFOEnabledSpecified, actual.AdvancedInventoryPrefs.FIFOEnabledSpecified); + //Assert.AreEqual(expected.AdvancedInventoryPrefs.FIFOEffectiveDate, actual.AdvancedInventoryPrefs.FIFOEffectiveDate); + //Assert.AreEqual(expected.AdvancedInventoryPrefs.FIFOEffectiveDateSpecified, actual.AdvancedInventoryPrefs.FIFOEffectiveDateSpecified); + //Assert.AreEqual(expected.AdvancedInventoryPrefs.RowShelfBinEnabled, actual.AdvancedInventoryPrefs.RowShelfBinEnabled); + //Assert.AreEqual(expected.AdvancedInventoryPrefs.RowShelfBinEnabledSpecified, actual.AdvancedInventoryPrefs.RowShelfBinEnabledSpecified); + //Assert.AreEqual(expected.AdvancedInventoryPrefs.BarcodeEnabled, actual.AdvancedInventoryPrefs.BarcodeEnabled); + //Assert.AreEqual(expected.AdvancedInventoryPrefs.BarcodeEnabledSpecified, actual.AdvancedInventoryPrefs.BarcodeEnabledSpecified); + Assert.AreEqual(expected.ProductAndServicesPrefs.ForSales, actual.ProductAndServicesPrefs.ForSales); + Assert.AreEqual(expected.ProductAndServicesPrefs.ForSalesSpecified, actual.ProductAndServicesPrefs.ForSalesSpecified); + Assert.AreEqual(expected.ProductAndServicesPrefs.ForPurchase, actual.ProductAndServicesPrefs.ForPurchase); + Assert.AreEqual(expected.ProductAndServicesPrefs.ForPurchaseSpecified, actual.ProductAndServicesPrefs.ForPurchaseSpecified); + Assert.AreEqual(expected.ProductAndServicesPrefs.InventoryAndPurchaseOrder, actual.ProductAndServicesPrefs.InventoryAndPurchaseOrder); + Assert.AreEqual(expected.ProductAndServicesPrefs.InventoryAndPurchaseOrderSpecified, actual.ProductAndServicesPrefs.InventoryAndPurchaseOrderSpecified); + Assert.AreEqual(expected.ProductAndServicesPrefs.QuantityWithPriceAndRate, actual.ProductAndServicesPrefs.QuantityWithPriceAndRate); + Assert.AreEqual(expected.ProductAndServicesPrefs.QuantityWithPriceAndRateSpecified, actual.ProductAndServicesPrefs.QuantityWithPriceAndRateSpecified); + Assert.AreEqual(expected.ProductAndServicesPrefs.QuantityOnHand, actual.ProductAndServicesPrefs.QuantityOnHand); + Assert.AreEqual(expected.ProductAndServicesPrefs.QuantityOnHandSpecified, actual.ProductAndServicesPrefs.QuantityOnHandSpecified); + Assert.AreEqual(expected.ProductAndServicesPrefs.UOMSpecified, actual.ProductAndServicesPrefs.UOMSpecified); + //Assert.AreEqual(expected.SalesFormsPrefs.UsingProgressInvoicing, actual.SalesFormsPrefs.UsingProgressInvoicing); + //Assert.AreEqual(expected.SalesFormsPrefs.UsingProgressInvoicingSpecified, actual.SalesFormsPrefs.UsingProgressInvoicingSpecified); + //Assert.IsTrue(Helper.CheckEqual(expected.SalesFormsPrefs.CustomField, actual.SalesFormsPrefs.CustomField)); + //Assert.AreEqual(expected.SalesFormsPrefs.CustomTxnNumbers, actual.SalesFormsPrefs.CustomTxnNumbers); + //Assert.AreEqual(expected.SalesFormsPrefs.CustomTxnNumbersSpecified, actual.SalesFormsPrefs.CustomTxnNumbersSpecified); + //Assert.AreEqual(expected.SalesFormsPrefs.DelayedCharges, actual.SalesFormsPrefs.DelayedCharges); + //Assert.AreEqual(expected.SalesFormsPrefs.DelayedChargesSpecified, actual.SalesFormsPrefs.DelayedChargesSpecified); + //Assert.AreEqual(expected.SalesFormsPrefs.AllowDeposit, actual.SalesFormsPrefs.AllowDeposit); + //Assert.AreEqual(expected.SalesFormsPrefs.AllowDepositSpecified, actual.SalesFormsPrefs.AllowDepositSpecified); + //Assert.AreEqual(expected.SalesFormsPrefs.AllowDiscount, actual.SalesFormsPrefs.AllowDiscount); + //Assert.AreEqual(expected.SalesFormsPrefs.AllowDiscountSpecified, actual.SalesFormsPrefs.AllowDiscountSpecified); + //Assert.AreEqual(expected.SalesFormsPrefs.DefaultDiscountAccount, actual.SalesFormsPrefs.DefaultDiscountAccount); + //Assert.AreEqual(expected.SalesFormsPrefs.AllowEstimates, actual.SalesFormsPrefs.AllowEstimates); + //Assert.AreEqual(expected.SalesFormsPrefs.AllowEstimatesSpecified, actual.SalesFormsPrefs.AllowEstimatesSpecified); + //Assert.AreEqual(expected.SalesFormsPrefs.IPNSupportEnabled, actual.SalesFormsPrefs.IPNSupportEnabled); + //Assert.AreEqual(expected.SalesFormsPrefs.IPNSupportEnabledSpecified, actual.SalesFormsPrefs.IPNSupportEnabledSpecified); + //Assert.AreEqual(expected.SalesFormsPrefs.InvoiceMessage, actual.SalesFormsPrefs.InvoiceMessage); + //Assert.AreEqual(expected.SalesFormsPrefs.AllowServiceDate, actual.SalesFormsPrefs.AllowServiceDate); + //Assert.AreEqual(expected.SalesFormsPrefs.AllowServiceDateSpecified, actual.SalesFormsPrefs.AllowServiceDateSpecified); + //Assert.AreEqual(expected.SalesFormsPrefs.AllowShipping, actual.SalesFormsPrefs.AllowShipping); + //Assert.AreEqual(expected.SalesFormsPrefs.AllowShippingSpecified, actual.SalesFormsPrefs.AllowShippingSpecified); + //Assert.AreEqual(expected.SalesFormsPrefs.DefaultShippingAccount, actual.SalesFormsPrefs.DefaultShippingAccount); + // Assert.AreEqual(expected.SalesFormsPrefs.DefaultItem.name, actual.SalesFormsPrefs.DefaultItem.name); + // Assert.AreEqual(expected.SalesFormsPrefs.DefaultItem.type, actual.SalesFormsPrefs.DefaultItem.type); + // Assert.AreEqual(expected.SalesFormsPrefs.DefaultItem.Value, actual.SalesFormsPrefs.DefaultItem.Value); + // Assert.AreEqual(expected.SalesFormsPrefs.DefaultTerms.name, actual.SalesFormsPrefs.DefaultTerms.name); + // Assert.AreEqual(expected.SalesFormsPrefs.DefaultTerms.type, actual.SalesFormsPrefs.DefaultTerms.type); + // Assert.AreEqual(expected.SalesFormsPrefs.DefaultTerms.Value, actual.SalesFormsPrefs.DefaultTerms.Value); + // Assert.AreEqual(expected.SalesFormsPrefs.DefaultDeliveryMethod, actual.SalesFormsPrefs.DefaultDeliveryMethod); + // Assert.AreEqual(expected.SalesFormsPrefs.AutoApplyCredit, actual.SalesFormsPrefs.AutoApplyCredit); + // Assert.AreEqual(expected.SalesFormsPrefs.AutoApplyCreditSpecified, actual.SalesFormsPrefs.AutoApplyCreditSpecified); + // Assert.AreEqual(expected.SalesFormsPrefs.AutoApplyPayments, actual.SalesFormsPrefs.AutoApplyPayments); + // Assert.AreEqual(expected.SalesFormsPrefs.AutoApplyPaymentsSpecified, actual.SalesFormsPrefs.AutoApplyPaymentsSpecified); + // Assert.AreEqual(expected.SalesFormsPrefs.PrintItemWithZeroAmount, actual.SalesFormsPrefs.PrintItemWithZeroAmount); + // Assert.AreEqual(expected.SalesFormsPrefs.PrintItemWithZeroAmountSpecified, actual.SalesFormsPrefs.PrintItemWithZeroAmountSpecified); + // Assert.AreEqual(expected.SalesFormsPrefs.DefaultShipMethodRef.name, actual.SalesFormsPrefs.DefaultShipMethodRef.name); + // Assert.AreEqual(expected.SalesFormsPrefs.DefaultShipMethodRef.type, actual.SalesFormsPrefs.DefaultShipMethodRef.type); + // Assert.AreEqual(expected.SalesFormsPrefs.DefaultShipMethodRef.Value, actual.SalesFormsPrefs.DefaultShipMethodRef.Value); + // Assert.AreEqual(expected.SalesFormsPrefs.DefaultMarkup, actual.SalesFormsPrefs.DefaultMarkup); + // Assert.AreEqual(expected.SalesFormsPrefs.DefaultMarkupSpecified, actual.SalesFormsPrefs.DefaultMarkupSpecified); + // Assert.AreEqual(expected.SalesFormsPrefs.TrackReimbursableExpensesAsIncome, actual.SalesFormsPrefs.TrackReimbursableExpensesAsIncome); + // Assert.AreEqual(expected.SalesFormsPrefs.TrackReimbursableExpensesAsIncomeSpecified, actual.SalesFormsPrefs.TrackReimbursableExpensesAsIncomeSpecified); + // Assert.AreEqual(expected.SalesFormsPrefs.UsingSalesOrders, actual.SalesFormsPrefs.UsingSalesOrders); + // Assert.AreEqual(expected.SalesFormsPrefs.UsingSalesOrdersSpecified, actual.SalesFormsPrefs.UsingSalesOrdersSpecified); + // Assert.AreEqual(expected.SalesFormsPrefs.UsingPriceLevels, actual.SalesFormsPrefs.UsingPriceLevels); + // Assert.AreEqual(expected.SalesFormsPrefs.UsingPriceLevelsSpecified, actual.SalesFormsPrefs.UsingPriceLevelsSpecified); + // Assert.AreEqual(expected.SalesFormsPrefs.DefaultFOB, actual.SalesFormsPrefs.DefaultFOB); + // Assert.AreEqual(expected.SalesFormsPrefs.DefaultCustomerMessage, actual.SalesFormsPrefs.DefaultCustomerMessage); + //Assert.IsTrue(Helper.CheckEqual(expected.EmailMessagesPrefs, actual.EmailMessagesPrefs)); + //Assert.IsTrue(Helper.CheckEqual(expected.PrintDocumentPrefs, actual.PrintDocumentPrefs)); + //Assert.AreEqual(expected.VendorAndPurchasesPrefs.EnableBills, actual.VendorAndPurchasesPrefs.EnableBills); + //Assert.AreEqual(expected.VendorAndPurchasesPrefs.EnableBillsSpecified, actual.VendorAndPurchasesPrefs.EnableBillsSpecified); + //Assert.AreEqual(expected.VendorAndPurchasesPrefs.TrackingByCustomer, actual.VendorAndPurchasesPrefs.TrackingByCustomer); + //Assert.AreEqual(expected.VendorAndPurchasesPrefs.TrackingByCustomerSpecified, actual.VendorAndPurchasesPrefs.TrackingByCustomerSpecified); + //Assert.AreEqual(expected.VendorAndPurchasesPrefs.BillableExpenseTracking, actual.VendorAndPurchasesPrefs.BillableExpenseTracking); + //Assert.AreEqual(expected.VendorAndPurchasesPrefs.BillableExpenseTrackingSpecified, actual.VendorAndPurchasesPrefs.BillableExpenseTrackingSpecified); + // Assert.AreEqual(expected.VendorAndPurchasesPrefs.DefaultTerms.name, actual.VendorAndPurchasesPrefs.DefaultTerms.name); + // Assert.AreEqual(expected.VendorAndPurchasesPrefs.DefaultTerms.type, actual.VendorAndPurchasesPrefs.DefaultTerms.type); + // Assert.AreEqual(expected.VendorAndPurchasesPrefs.DefaultTerms.Value, actual.VendorAndPurchasesPrefs.DefaultTerms.Value); + //Assert.AreEqual(expected.VendorAndPurchasesPrefs.DefaultMarkup, actual.VendorAndPurchasesPrefs.DefaultMarkup); + //Assert.AreEqual(expected.VendorAndPurchasesPrefs.DefaultMarkupSpecified, actual.VendorAndPurchasesPrefs.DefaultMarkupSpecified); + // Assert.AreEqual(expected.VendorAndPurchasesPrefs.DefaultMarkupAccount.name, actual.VendorAndPurchasesPrefs.DefaultMarkupAccount.name); + // Assert.AreEqual(expected.VendorAndPurchasesPrefs.DefaultMarkupAccount.type, actual.VendorAndPurchasesPrefs.DefaultMarkupAccount.type); + // Assert.AreEqual(expected.VendorAndPurchasesPrefs.DefaultMarkupAccount.Value, actual.VendorAndPurchasesPrefs.DefaultMarkupAccount.Value); + //Assert.AreEqual(expected.VendorAndPurchasesPrefs.AutomaticBillPayment, actual.VendorAndPurchasesPrefs.AutomaticBillPayment); + //Assert.AreEqual(expected.VendorAndPurchasesPrefs.AutomaticBillPaymentSpecified, actual.VendorAndPurchasesPrefs.AutomaticBillPaymentSpecified); + //Assert.IsTrue(Helper.CheckEqual(expected.VendorAndPurchasesPrefs.POCustomField, actual.VendorAndPurchasesPrefs.POCustomField)); + //Assert.AreEqual(expected.VendorAndPurchasesPrefs.MsgToVendors, actual.VendorAndPurchasesPrefs.MsgToVendors); + //Assert.AreEqual(expected.VendorAndPurchasesPrefs.UsingInventory, actual.VendorAndPurchasesPrefs.UsingInventory); + //Assert.AreEqual(expected.VendorAndPurchasesPrefs.UsingInventorySpecified, actual.VendorAndPurchasesPrefs.UsingInventorySpecified); + //Assert.AreEqual(expected.VendorAndPurchasesPrefs.UsingMultiLocationInventory, actual.VendorAndPurchasesPrefs.UsingMultiLocationInventory); + //Assert.AreEqual(expected.VendorAndPurchasesPrefs.UsingMultiLocationInventorySpecified, actual.VendorAndPurchasesPrefs.UsingMultiLocationInventorySpecified); + //Assert.AreEqual(expected.VendorAndPurchasesPrefs.DaysBillsAreDue, actual.VendorAndPurchasesPrefs.DaysBillsAreDue); + //Assert.AreEqual(expected.VendorAndPurchasesPrefs.DaysBillsAreDueSpecified, actual.VendorAndPurchasesPrefs.DaysBillsAreDueSpecified); + // Assert.AreEqual(expected.VendorAndPurchasesPrefs.DiscountAccountRef.name, actual.VendorAndPurchasesPrefs.DiscountAccountRef.name); + // Assert.AreEqual(expected.VendorAndPurchasesPrefs.DiscountAccountRef.type, actual.VendorAndPurchasesPrefs.DiscountAccountRef.type); + // Assert.AreEqual(expected.VendorAndPurchasesPrefs.DiscountAccountRef.Value, actual.VendorAndPurchasesPrefs.DiscountAccountRef.Value); + //Assert.AreEqual(expected.TimeTrackingPrefs.UseServices, actual.TimeTrackingPrefs.UseServices); + //Assert.AreEqual(expected.TimeTrackingPrefs.UseServicesSpecified, actual.TimeTrackingPrefs.UseServicesSpecified); + // Assert.AreEqual(expected.TimeTrackingPrefs.DefaultTimeItem.name, actual.TimeTrackingPrefs.DefaultTimeItem.name); + // Assert.AreEqual(expected.TimeTrackingPrefs.DefaultTimeItem.type, actual.TimeTrackingPrefs.DefaultTimeItem.type); + // Assert.AreEqual(expected.TimeTrackingPrefs.DefaultTimeItem.Value, actual.TimeTrackingPrefs.DefaultTimeItem.Value); + //Assert.AreEqual(expected.TimeTrackingPrefs.BillCustomers, actual.TimeTrackingPrefs.BillCustomers); + //Assert.AreEqual(expected.TimeTrackingPrefs.BillCustomersSpecified, actual.TimeTrackingPrefs.BillCustomersSpecified); + //Assert.AreEqual(expected.TimeTrackingPrefs.ShowBillRateToAll, actual.TimeTrackingPrefs.ShowBillRateToAll); + //Assert.AreEqual(expected.TimeTrackingPrefs.ShowBillRateToAllSpecified, actual.TimeTrackingPrefs.ShowBillRateToAllSpecified); + //Assert.AreEqual(expected.TimeTrackingPrefs.WorkWeekStartDateSpecified, actual.TimeTrackingPrefs.WorkWeekStartDateSpecified); + //Assert.AreEqual(expected.TimeTrackingPrefs.TimeTrackingEnabled, actual.TimeTrackingPrefs.TimeTrackingEnabled); + //Assert.AreEqual(expected.TimeTrackingPrefs.TimeTrackingEnabledSpecified, actual.TimeTrackingPrefs.TimeTrackingEnabledSpecified); + //Assert.AreEqual(expected.TimeTrackingPrefs.MarkTimeEntriesBillable, actual.TimeTrackingPrefs.MarkTimeEntriesBillable); + //Assert.AreEqual(expected.TimeTrackingPrefs.MarkTimeEntriesBillableSpecified, actual.TimeTrackingPrefs.MarkTimeEntriesBillableSpecified); + //Assert.AreEqual(expected.TimeTrackingPrefs.MarkExpensesAsBillable, actual.TimeTrackingPrefs.MarkExpensesAsBillable); + //Assert.AreEqual(expected.TimeTrackingPrefs.MarkExpensesAsBillableSpecified, actual.TimeTrackingPrefs.MarkExpensesAsBillableSpecified); + Assert.AreEqual(expected.TaxPrefs.UsingSalesTax, actual.TaxPrefs.UsingSalesTax); + Assert.AreEqual(expected.TaxPrefs.UsingSalesTaxSpecified, actual.TaxPrefs.UsingSalesTaxSpecified); + //Assert.AreEqual(expected.TaxPrefs.AnyIntuitObject.name, actual.TaxPrefs.AnyIntuitObject.name); + //Assert.AreEqual(expected.TaxPrefs.AnyIntuitObject.type, actual.TaxPrefs.AnyIntuitObject.type); + //Assert.AreEqual(expected.TaxPrefs.AnyIntuitObject.Value, actual.TaxPrefs.AnyIntuitObject.Value); + Assert.AreEqual(expected.TaxPrefs.PaySalesTaxSpecified, actual.TaxPrefs.PaySalesTaxSpecified); + // Assert.AreEqual(expected.TaxPrefs.NonTaxableSalesTaxCodeRef.name, actual.TaxPrefs.NonTaxableSalesTaxCodeRef.name); + // Assert.AreEqual(expected.TaxPrefs.NonTaxableSalesTaxCodeRef.type, actual.TaxPrefs.NonTaxableSalesTaxCodeRef.type); + // Assert.AreEqual(expected.TaxPrefs.NonTaxableSalesTaxCodeRef.Value, actual.TaxPrefs.NonTaxableSalesTaxCodeRef.Value); + // Assert.AreEqual(expected.TaxPrefs.TaxableSalesTaxCodeRef.name, actual.TaxPrefs.TaxableSalesTaxCodeRef.name); + // Assert.AreEqual(expected.TaxPrefs.TaxableSalesTaxCodeRef.type, actual.TaxPrefs.TaxableSalesTaxCodeRef.type); + // Assert.AreEqual(expected.TaxPrefs.TaxableSalesTaxCodeRef.Value, actual.TaxPrefs.TaxableSalesTaxCodeRef.Value); + //Assert.AreEqual(expected.FinanceChargesPrefs.AnnualInterestRate, actual.FinanceChargesPrefs.AnnualInterestRate); + //Assert.AreEqual(expected.FinanceChargesPrefs.AnnualInterestRateSpecified, actual.FinanceChargesPrefs.AnnualInterestRateSpecified); + //Assert.AreEqual(expected.FinanceChargesPrefs.MinFinChrg, actual.FinanceChargesPrefs.MinFinChrg); + //Assert.AreEqual(expected.FinanceChargesPrefs.MinFinChrgSpecified, actual.FinanceChargesPrefs.MinFinChrgSpecified); + //Assert.AreEqual(expected.FinanceChargesPrefs.GracePeriod, actual.FinanceChargesPrefs.GracePeriod); + //Assert.AreEqual(expected.FinanceChargesPrefs.CalcFinChrgFromTxnDate, actual.FinanceChargesPrefs.CalcFinChrgFromTxnDate); + //Assert.AreEqual(expected.FinanceChargesPrefs.CalcFinChrgFromTxnDateSpecified, actual.FinanceChargesPrefs.CalcFinChrgFromTxnDateSpecified); + //Assert.AreEqual(expected.FinanceChargesPrefs.AssessFinChrgForOverdueCharges, actual.FinanceChargesPrefs.AssessFinChrgForOverdueCharges); + //Assert.AreEqual(expected.FinanceChargesPrefs.AssessFinChrgForOverdueChargesSpecified, actual.FinanceChargesPrefs.AssessFinChrgForOverdueChargesSpecified); + // Assert.AreEqual(expected.FinanceChargesPrefs.FinChrgAccountRef.name, actual.FinanceChargesPrefs.FinChrgAccountRef.name); + // Assert.AreEqual(expected.FinanceChargesPrefs.FinChrgAccountRef.type, actual.FinanceChargesPrefs.FinChrgAccountRef.type); + // Assert.AreEqual(expected.FinanceChargesPrefs.FinChrgAccountRef.Value, actual.FinanceChargesPrefs.FinChrgAccountRef.Value); + Assert.AreEqual(expected.CurrencyPrefs.MultiCurrencyEnabled, actual.CurrencyPrefs.MultiCurrencyEnabled); + Assert.AreEqual(expected.CurrencyPrefs.MultiCurrencyEnabledSpecified, actual.CurrencyPrefs.MultiCurrencyEnabledSpecified); + // Assert.AreEqual(expected.CurrencyPrefs.HomeCurrency.name, actual.CurrencyPrefs.HomeCurrency.name); + // Assert.AreEqual(expected.CurrencyPrefs.HomeCurrency.type, actual.CurrencyPrefs.HomeCurrency.type); + // Assert.AreEqual(expected.CurrencyPrefs.HomeCurrency.Value, actual.CurrencyPrefs.HomeCurrency.Value); + // Assert.AreEqual(expected.ReportPrefs.ReportBasisSpecified, actual.ReportPrefs.ReportBasisSpecified); + // Assert.AreEqual(expected.ReportPrefs.CalcAgingReportFromTxnDate, actual.ReportPrefs.CalcAgingReportFromTxnDate); + // Assert.AreEqual(expected.ReportPrefs.CalcAgingReportFromTxnDateSpecified, actual.ReportPrefs.CalcAgingReportFromTxnDateSpecified); + //Assert.IsTrue(Helper.CheckEqual(expected.OtherPrefs, actual.OtherPrefs)); + } + + + internal static void VerifyPreferencesSparseUpdate(Preferences expected, Preferences actual) + { + Assert.AreEqual(expected.EmailMessagesPrefs.InvoiceMessage.Subject, actual.EmailMessagesPrefs.InvoiceMessage.Subject); + } + + + + internal static void VerifyUOM(UOM expected, UOM actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.Abbrv, actual.Abbrv); + Assert.AreEqual(expected.BaseTypeSpecified, actual.BaseTypeSpecified); + Assert.IsTrue(Helper.CheckEqual(expected.ConvUnit, actual.ConvUnit)); + } + + internal static void VerifyUOMSparse(UOM expected, UOM actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.Abbrv, actual.Abbrv); + } + + internal static void VerifyTemplateName(TemplateName expected, TemplateName actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.Active, actual.Active); + Assert.AreEqual(expected.ActiveSpecified, actual.ActiveSpecified); + Assert.AreEqual(expected.TypeSpecified, actual.TypeSpecified); + } + + internal static void VerifyTemplateNameSparse(TemplateName expected, TemplateName actual) + { + Assert.AreEqual(expected.Type, actual.Type); + } + + + internal static void VerifyAttachable(Attachable expected, Attachable actual) + { + //Assert.AreEqual(expected.FileName, actual.FileName); + Assert.AreEqual(expected.FileAccessUri, actual.FileAccessUri); + Assert.AreEqual(expected.TempDownloadUri, actual.TempDownloadUri); + Assert.AreEqual(expected.Size, actual.Size); + Assert.AreEqual(expected.SizeSpecified, actual.SizeSpecified); + //Assert.AreEqual(expected.ContentType, actual.ContentType); + Assert.AreEqual(expected.Category, actual.Category); + Assert.AreEqual(expected.Lat, actual.Lat); + Assert.AreEqual(expected.Long, actual.Long); + Assert.AreEqual(expected.PlaceName, actual.PlaceName); + Assert.AreEqual(expected.Note, actual.Note); + Assert.AreEqual(expected.Tag, actual.Tag); + //Assert.AreEqual(expected.ThumbnailFileAccessUri, actual.ThumbnailFileAccessUri); + //Assert.AreEqual(expected.ThumbnailTempDownloadUri, actual.ThumbnailTempDownloadUri); + //Assert.AreEqual(expected.AttachableEx.Any, actual.AttachableEx.Any); + VerifyAttachableRefs(expected.AttachableRef, actual.AttachableRef); + } + + internal static void VerifyAttachableSparseUpdate(Attachable expected, Attachable actual) + { + Assert.AreEqual(expected.Note, actual.Note); + Assert.AreEqual(expected.Tag, actual.Tag); + } + + private static void VerifyAttachableRefs(AttachableRef[] expectedAttachableRef, AttachableRef[] actualAttachableRef) + { + if (expectedAttachableRef != null && actualAttachableRef != null) + { + int size = actualAttachableRef.Length; + for (int i = 0; i < size; i++) + { + Assert.AreEqual(expectedAttachableRef[i].EntityRef.Value, actualAttachableRef[i].EntityRef.Value); + //Assert.AreEqual(expectedAttachableRef[i].EntityRef.name, actualAttachableRef[i].EntityRef.name); + //Assert.AreEqual(expectedAttachableRef[i].EntityRef.type, actualAttachableRef[i].EntityRef.type); + } + } + } + + internal static void VerifyStringTypeCustomFieldDefinition(StringTypeCustomFieldDefinition expected, StringTypeCustomFieldDefinition actual) + { + Assert.AreEqual(expected.DefaultString, actual.DefaultString); + Assert.AreEqual(expected.RegularExpression, actual.RegularExpression); + Assert.AreEqual(expected.MaxLength, actual.MaxLength); + Assert.AreEqual(expected.MaxLengthSpecified, actual.MaxLengthSpecified); + Assert.AreEqual(expected.EntityType, actual.EntityType); + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.Hidden, actual.Hidden); + Assert.AreEqual(expected.Required, actual.Required); + } + + + + internal static void VerifyNumberTypeCustomFieldDefinition(NumberTypeCustomFieldDefinition expected, NumberTypeCustomFieldDefinition actual) + { + Assert.AreEqual(expected.DefaultValue, actual.DefaultValue); + Assert.AreEqual(expected.DefaultValueSpecified, actual.DefaultValueSpecified); + Assert.AreEqual(expected.MinValue, actual.MinValue); + Assert.AreEqual(expected.MinValueSpecified, actual.MinValueSpecified); + Assert.AreEqual(expected.MaxValue, actual.MaxValue); + Assert.AreEqual(expected.MaxValueSpecified, actual.MaxValueSpecified); + Assert.AreEqual(expected.EntityType, actual.EntityType); + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.Hidden, actual.Hidden); + Assert.AreEqual(expected.Required, actual.Required); + } + + + + internal static void VerifyDateTypeCustomFieldDefinition(DateTypeCustomFieldDefinition expected, DateTypeCustomFieldDefinition actual) + { + Assert.AreEqual(expected.DefaultDate, actual.DefaultDate); + Assert.AreEqual(expected.DefaultDateSpecified, actual.DefaultDateSpecified); + Assert.AreEqual(expected.MinDate, actual.MinDate); + Assert.AreEqual(expected.MinDateSpecified, actual.MinDateSpecified); + Assert.AreEqual(expected.MaxDate, actual.MaxDate); + Assert.AreEqual(expected.MaxDateSpecified, actual.MaxDateSpecified); + Assert.AreEqual(expected.EntityType, actual.EntityType); + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.Hidden, actual.Hidden); + Assert.AreEqual(expected.Required, actual.Required); + } + + + + internal static void VerifyBooleanTypeCustomFieldDefinition(BooleanTypeCustomFieldDefinition expected, BooleanTypeCustomFieldDefinition actual) + { + Assert.AreEqual(expected.DefaultValue, actual.DefaultValue); + Assert.AreEqual(expected.DefaultValueSpecified, actual.DefaultValueSpecified); + Assert.AreEqual(expected.EntityType, actual.EntityType); + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.Hidden, actual.Hidden); + Assert.AreEqual(expected.Required, actual.Required); + } + + + + internal static void VerifyNameBase(NameBase expected, NameBase actual) + { + Assert.AreEqual(expected.Organization, actual.Organization); + Assert.AreEqual(expected.OrganizationSpecified, actual.OrganizationSpecified); + Assert.AreEqual(expected.Title, actual.Title); + Assert.AreEqual(expected.GivenName, actual.GivenName); + Assert.AreEqual(expected.MiddleName, actual.MiddleName); + Assert.AreEqual(expected.FamilyName, actual.FamilyName); + Assert.AreEqual(expected.Suffix, actual.Suffix); + Assert.AreEqual(expected.FullyQualifiedName, actual.FullyQualifiedName); + Assert.AreEqual(expected.CompanyName, actual.CompanyName); + Assert.AreEqual(expected.DisplayName, actual.DisplayName); + Assert.AreEqual(expected.PrintOnCheckName, actual.PrintOnCheckName); + Assert.AreEqual(expected.UserId, actual.UserId); + Assert.AreEqual(expected.Active, actual.Active); + Assert.AreEqual(expected.ActiveSpecified, actual.ActiveSpecified); + Assert.AreEqual(expected.PrimaryPhone.DeviceType, actual.PrimaryPhone.DeviceType); + Assert.AreEqual(expected.PrimaryPhone.CountryCode, actual.PrimaryPhone.CountryCode); + Assert.AreEqual(expected.PrimaryPhone.AreaCode, actual.PrimaryPhone.AreaCode); + Assert.AreEqual(expected.PrimaryPhone.ExchangeCode, actual.PrimaryPhone.ExchangeCode); + Assert.AreEqual(expected.PrimaryPhone.Extension, actual.PrimaryPhone.Extension); + Assert.AreEqual(expected.PrimaryPhone.FreeFormNumber, actual.PrimaryPhone.FreeFormNumber); + Assert.AreEqual(expected.PrimaryPhone.Default, actual.PrimaryPhone.Default); + Assert.AreEqual(expected.PrimaryPhone.DefaultSpecified, actual.PrimaryPhone.DefaultSpecified); + Assert.AreEqual(expected.PrimaryPhone.Tag, actual.PrimaryPhone.Tag); + Assert.AreEqual(expected.AlternatePhone.DeviceType, actual.AlternatePhone.DeviceType); + Assert.AreEqual(expected.AlternatePhone.CountryCode, actual.AlternatePhone.CountryCode); + Assert.AreEqual(expected.AlternatePhone.AreaCode, actual.AlternatePhone.AreaCode); + Assert.AreEqual(expected.AlternatePhone.ExchangeCode, actual.AlternatePhone.ExchangeCode); + Assert.AreEqual(expected.AlternatePhone.Extension, actual.AlternatePhone.Extension); + Assert.AreEqual(expected.AlternatePhone.FreeFormNumber, actual.AlternatePhone.FreeFormNumber); + Assert.AreEqual(expected.AlternatePhone.Default, actual.AlternatePhone.Default); + Assert.AreEqual(expected.AlternatePhone.DefaultSpecified, actual.AlternatePhone.DefaultSpecified); + Assert.AreEqual(expected.AlternatePhone.Tag, actual.AlternatePhone.Tag); + Assert.AreEqual(expected.Mobile.DeviceType, actual.Mobile.DeviceType); + Assert.AreEqual(expected.Mobile.CountryCode, actual.Mobile.CountryCode); + Assert.AreEqual(expected.Mobile.AreaCode, actual.Mobile.AreaCode); + Assert.AreEqual(expected.Mobile.ExchangeCode, actual.Mobile.ExchangeCode); + Assert.AreEqual(expected.Mobile.Extension, actual.Mobile.Extension); + Assert.AreEqual(expected.Mobile.FreeFormNumber, actual.Mobile.FreeFormNumber); + Assert.AreEqual(expected.Mobile.Default, actual.Mobile.Default); + Assert.AreEqual(expected.Mobile.DefaultSpecified, actual.Mobile.DefaultSpecified); + Assert.AreEqual(expected.Mobile.Tag, actual.Mobile.Tag); + Assert.AreEqual(expected.Fax.DeviceType, actual.Fax.DeviceType); + Assert.AreEqual(expected.Fax.CountryCode, actual.Fax.CountryCode); + Assert.AreEqual(expected.Fax.AreaCode, actual.Fax.AreaCode); + Assert.AreEqual(expected.Fax.ExchangeCode, actual.Fax.ExchangeCode); + Assert.AreEqual(expected.Fax.Extension, actual.Fax.Extension); + Assert.AreEqual(expected.Fax.FreeFormNumber, actual.Fax.FreeFormNumber); + Assert.AreEqual(expected.Fax.Default, actual.Fax.Default); + Assert.AreEqual(expected.Fax.DefaultSpecified, actual.Fax.DefaultSpecified); + Assert.AreEqual(expected.Fax.Tag, actual.Fax.Tag); + Assert.AreEqual(expected.PrimaryEmailAddr.Address, actual.PrimaryEmailAddr.Address); + Assert.AreEqual(expected.PrimaryEmailAddr.Default, actual.PrimaryEmailAddr.Default); + Assert.AreEqual(expected.PrimaryEmailAddr.DefaultSpecified, actual.PrimaryEmailAddr.DefaultSpecified); + Assert.AreEqual(expected.PrimaryEmailAddr.Tag, actual.PrimaryEmailAddr.Tag); + Assert.AreEqual(expected.WebAddr.URI, actual.WebAddr.URI); + Assert.AreEqual(expected.WebAddr.Default, actual.WebAddr.Default); + Assert.AreEqual(expected.WebAddr.DefaultSpecified, actual.WebAddr.DefaultSpecified); + Assert.AreEqual(expected.WebAddr.Tag, actual.WebAddr.Tag); + Assert.IsTrue(Helper.CheckEqual(expected.OtherContactInfo, actual.OtherContactInfo)); + Assert.AreEqual(expected.DefaultTaxCodeRef.name, actual.DefaultTaxCodeRef.name); + Assert.AreEqual(expected.DefaultTaxCodeRef.type, actual.DefaultTaxCodeRef.type); + Assert.AreEqual(expected.DefaultTaxCodeRef.Value, actual.DefaultTaxCodeRef.Value); + } + + + + internal static void VerifyCustomer(Customer expected, Customer actual) + { + Assert.AreEqual(expected.Taxable, actual.Taxable); + Assert.AreEqual(expected.TaxableSpecified, actual.TaxableSpecified); + Assert.AreEqual(expected.BillAddr.Line1, actual.BillAddr.Line1); + Assert.AreEqual(expected.BillAddr.Line2, actual.BillAddr.Line2); + Assert.AreEqual(expected.BillAddr.Line3, actual.BillAddr.Line3); + Assert.AreEqual(expected.BillAddr.Line4, actual.BillAddr.Line4); + Assert.AreEqual(expected.BillAddr.Line5, actual.BillAddr.Line5); + Assert.AreEqual(expected.BillAddr.City, actual.BillAddr.City); + Assert.AreEqual(expected.BillAddr.Country, actual.BillAddr.Country); + Assert.AreEqual(expected.BillAddr.CountryCode, actual.BillAddr.CountryCode); + Assert.AreEqual(expected.BillAddr.CountrySubDivisionCode, actual.BillAddr.CountrySubDivisionCode); + Assert.AreEqual(expected.BillAddr.PostalCode, actual.BillAddr.PostalCode); + Assert.AreEqual(expected.BillAddr.PostalCodeSuffix, actual.BillAddr.PostalCodeSuffix); + //Assert.AreEqual(expected.BillAddr.Lat, actual.BillAddr.Lat); + //Assert.AreEqual(expected.BillAddr.Long, actual.BillAddr.Long); + Assert.AreEqual(expected.BillAddr.Tag, actual.BillAddr.Tag); + Assert.AreEqual(expected.BillAddr.Note, actual.BillAddr.Note); + Assert.AreEqual(expected.ShipAddr.Line1, actual.ShipAddr.Line1); + Assert.AreEqual(expected.ShipAddr.Line2, actual.ShipAddr.Line2); + Assert.AreEqual(expected.ShipAddr.Line3, actual.ShipAddr.Line3); + Assert.AreEqual(expected.ShipAddr.Line4, actual.ShipAddr.Line4); + Assert.AreEqual(expected.ShipAddr.Line5, actual.ShipAddr.Line5); + Assert.AreEqual(expected.ShipAddr.City, actual.ShipAddr.City); + Assert.AreEqual(expected.ShipAddr.Country, actual.ShipAddr.Country); + Assert.AreEqual(expected.ShipAddr.CountryCode, actual.ShipAddr.CountryCode); + Assert.AreEqual(expected.ShipAddr.CountrySubDivisionCode, actual.ShipAddr.CountrySubDivisionCode); + Assert.AreEqual(expected.ShipAddr.PostalCode, actual.ShipAddr.PostalCode); + //Assert.AreEqual(expected.ShipAddr.PostalCodeSuffix, actual.ShipAddr.PostalCodeSuffix); + //Assert.AreEqual(expected.ShipAddr.Lat, actual.ShipAddr.Lat); + //Assert.AreEqual(expected.ShipAddr.Long, actual.ShipAddr.Long); + Assert.AreEqual(expected.ShipAddr.Tag, actual.ShipAddr.Tag); + Assert.AreEqual(expected.ShipAddr.Note, actual.ShipAddr.Note); + Assert.IsTrue(Helper.CheckEqual(expected.OtherAddr, actual.OtherAddr)); + Assert.AreEqual(expected.ContactName, actual.ContactName); + Assert.AreEqual(expected.AltContactName, actual.AltContactName); + Assert.AreEqual(expected.Notes, actual.Notes); + Assert.AreEqual(expected.Job, actual.Job); + Assert.AreEqual(expected.JobSpecified, actual.JobSpecified); + Assert.AreEqual(expected.BillWithParent, actual.BillWithParent); + Assert.AreEqual(expected.BillWithParentSpecified, actual.BillWithParentSpecified); + //Assert.AreEqual(expected.RootCustomerRef.name, actual.RootCustomerRef.name); + //Assert.AreEqual(expected.RootCustomerRef.type, actual.RootCustomerRef.type); + //Assert.AreEqual(expected.RootCustomerRef.Value, actual.RootCustomerRef.Value); + //Assert.AreEqual(expected.ParentRef.name, actual.ParentRef.name); + //Assert.AreEqual(expected.ParentRef.type, actual.ParentRef.type); + //Assert.AreEqual(expected.ParentRef.Value, actual.ParentRef.Value); + Assert.AreEqual(expected.Level, actual.Level); + Assert.AreEqual(expected.LevelSpecified, actual.LevelSpecified); + //Assert.AreEqual(expected.CustomerTypeRef.name, actual.CustomerTypeRef.name); + //Assert.AreEqual(expected.CustomerTypeRef.type, actual.CustomerTypeRef.type); + //Assert.AreEqual(expected.CustomerTypeRef.Value, actual.CustomerTypeRef.Value); + //Assert.AreEqual(expected.SalesTermRef.name, actual.SalesTermRef.name); + //Assert.AreEqual(expected.SalesTermRef.type, actual.SalesTermRef.type); + //Assert.AreEqual(expected.SalesTermRef.Value, actual.SalesTermRef.Value); + //Assert.AreEqual(expected.SalesRepRef.name, actual.SalesRepRef.name); + //Assert.AreEqual(expected.SalesRepRef.type, actual.SalesRepRef.type); + //Assert.AreEqual(expected.SalesRepRef.Value, actual.SalesRepRef.Value); + //Assert.AreEqual(expected.AnyIntuitObject.name, actual.AnyIntuitObject.name); + //Assert.AreEqual(expected.AnyIntuitObject.type, actual.AnyIntuitObject.type); + //Assert.AreEqual(expected.AnyIntuitObject.Value, actual.AnyIntuitObject.Value); + //Assert.AreEqual(expected.PaymentMethodRef.name, actual.PaymentMethodRef.name); + //Assert.AreEqual(expected.PaymentMethodRef.type, actual.PaymentMethodRef.type); + //Assert.AreEqual(expected.PaymentMethodRef.Value, actual.PaymentMethodRef.Value); + //Assert.AreEqual(expected.CCDetail.Number, actual.CCDetail.Number); + //Assert.AreEqual(expected.CCDetail.Type, actual.CCDetail.Type); + //Assert.AreEqual(expected.CCDetail.NameOnAcct, actual.CCDetail.NameOnAcct); + //Assert.AreEqual(expected.CCDetail.CcExpiryMonth, actual.CCDetail.CcExpiryMonth); + //Assert.AreEqual(expected.CCDetail.CcExpiryMonthSpecified, actual.CCDetail.CcExpiryMonthSpecified); + //Assert.AreEqual(expected.CCDetail.CcExpiryYear, actual.CCDetail.CcExpiryYear); + //Assert.AreEqual(expected.CCDetail.CcExpiryYearSpecified, actual.CCDetail.CcExpiryYearSpecified); + //Assert.AreEqual(expected.CCDetail.BillAddrStreet, actual.CCDetail.BillAddrStreet); + //Assert.AreEqual(expected.CCDetail.PostalCode, actual.CCDetail.PostalCode); + //Assert.AreEqual(expected.CCDetail.CommercialCardCode, actual.CCDetail.CommercialCardCode); + //Assert.AreEqual(expected.CCDetail.CCTxnModeSpecified, actual.CCDetail.CCTxnModeSpecified); + //Assert.AreEqual(expected.CCDetail.CCTxnTypeSpecified, actual.CCDetail.CCTxnTypeSpecified); + //Assert.AreEqual(expected.CCDetail.PrevCCTransId, actual.CCDetail.PrevCCTransId); + // Assert.AreEqual(expected.CCDetail.CreditCardChargeInfoEx.Any, actual.CCDetail.CreditCardChargeInfoEx.Any); + //Assert.AreEqual(expected.PriceLevelRef.name, actual.PriceLevelRef.name); + //Assert.AreEqual(expected.PriceLevelRef.type, actual.PriceLevelRef.type); + //Assert.AreEqual(expected.PriceLevelRef.Value, actual.PriceLevelRef.Value); + Assert.AreEqual(expected.Balance, actual.Balance); + Assert.AreEqual(expected.BalanceSpecified, actual.BalanceSpecified); + Assert.AreEqual(expected.OpenBalanceDate, actual.OpenBalanceDate); + Assert.AreEqual(expected.OpenBalanceDateSpecified, actual.OpenBalanceDateSpecified); + Assert.AreEqual(expected.BalanceWithJobs, actual.BalanceWithJobs); + Assert.AreEqual(expected.BalanceWithJobsSpecified, actual.BalanceWithJobsSpecified); + Assert.AreEqual(expected.CreditLimit, actual.CreditLimit); + Assert.AreEqual(expected.CreditLimitSpecified, actual.CreditLimitSpecified); + Assert.AreEqual(expected.AcctNum, actual.AcctNum); + //Assert.AreEqual(expected.CurrencyRef.name, actual.CurrencyRef.name); + //Assert.AreEqual(expected.CurrencyRef.type, actual.CurrencyRef.type); + //Assert.AreEqual(expected.CurrencyRef.Value, actual.CurrencyRef.Value); + Assert.AreEqual(expected.OverDueBalance, actual.OverDueBalance); + Assert.AreEqual(expected.OverDueBalanceSpecified, actual.OverDueBalanceSpecified); + Assert.AreEqual(expected.TotalRevenue, actual.TotalRevenue); + Assert.AreEqual(expected.TotalRevenueSpecified, actual.TotalRevenueSpecified); + Assert.AreEqual(expected.TotalExpense, actual.TotalExpense); + Assert.AreEqual(expected.TotalExpenseSpecified, actual.TotalExpenseSpecified); + Assert.AreEqual(expected.PreferredDeliveryMethod, actual.PreferredDeliveryMethod); + Assert.AreEqual(expected.ResaleNum, actual.ResaleNum); + //Assert.AreEqual(expected.JobInfo.StatusSpecified, actual.JobInfo.StatusSpecified); + //Assert.AreEqual(expected.JobInfo.StartDate, actual.JobInfo.StartDate); + //Assert.AreEqual(expected.JobInfo.StartDateSpecified, actual.JobInfo.StartDateSpecified); + //Assert.AreEqual(expected.JobInfo.ProjectedEndDate, actual.JobInfo.ProjectedEndDate); + //Assert.AreEqual(expected.JobInfo.ProjectedEndDateSpecified, actual.JobInfo.ProjectedEndDateSpecified); + //Assert.AreEqual(expected.JobInfo.EndDate, actual.JobInfo.EndDate); + //Assert.AreEqual(expected.JobInfo.EndDateSpecified, actual.JobInfo.EndDateSpecified); + //Assert.AreEqual(expected.JobInfo.Description, actual.JobInfo.Description); + // Assert.AreEqual(expected.JobInfo.JobTypeRef.name, actual.JobInfo.JobTypeRef.name); + // Assert.AreEqual(expected.JobInfo.JobTypeRef.type, actual.JobInfo.JobTypeRef.type); + // Assert.AreEqual(expected.JobInfo.JobTypeRef.Value, actual.JobInfo.JobTypeRef.Value); + //Assert.AreEqual(expected.CustomerEx.Any, actual.CustomerEx.Any); + Assert.AreEqual(expected.Organization, actual.Organization); + Assert.AreEqual(expected.OrganizationSpecified, actual.OrganizationSpecified); + Assert.AreEqual(expected.Title, actual.Title); + Assert.AreEqual(expected.GivenName, actual.GivenName); + Assert.AreEqual(expected.MiddleName, actual.MiddleName); + Assert.AreEqual(expected.FamilyName, actual.FamilyName); + Assert.AreEqual(expected.Suffix, actual.Suffix); + Assert.AreEqual(expected.FullyQualifiedName, actual.FullyQualifiedName); + Assert.AreEqual(expected.CompanyName, actual.CompanyName); + Assert.AreEqual(expected.DisplayName, actual.DisplayName); + Assert.AreEqual(expected.PrintOnCheckName, actual.PrintOnCheckName); + Assert.AreEqual(expected.UserId, actual.UserId); + Assert.AreEqual(expected.Active, actual.Active); + Assert.AreEqual(expected.ActiveSpecified, actual.ActiveSpecified); + Assert.AreEqual(expected.PrimaryPhone.DeviceType, actual.PrimaryPhone.DeviceType); + Assert.AreEqual(expected.PrimaryPhone.CountryCode, actual.PrimaryPhone.CountryCode); + Assert.AreEqual(expected.PrimaryPhone.AreaCode, actual.PrimaryPhone.AreaCode); + Assert.AreEqual(expected.PrimaryPhone.ExchangeCode, actual.PrimaryPhone.ExchangeCode); + Assert.AreEqual(expected.PrimaryPhone.Extension, actual.PrimaryPhone.Extension); + Assert.AreEqual(expected.PrimaryPhone.FreeFormNumber, actual.PrimaryPhone.FreeFormNumber); + Assert.AreEqual(expected.PrimaryPhone.Default, actual.PrimaryPhone.Default); + Assert.AreEqual(expected.PrimaryPhone.DefaultSpecified, actual.PrimaryPhone.DefaultSpecified); + Assert.AreEqual(expected.PrimaryPhone.Tag, actual.PrimaryPhone.Tag); + Assert.AreEqual(expected.AlternatePhone.DeviceType, actual.AlternatePhone.DeviceType); + Assert.AreEqual(expected.AlternatePhone.CountryCode, actual.AlternatePhone.CountryCode); + Assert.AreEqual(expected.AlternatePhone.AreaCode, actual.AlternatePhone.AreaCode); + Assert.AreEqual(expected.AlternatePhone.ExchangeCode, actual.AlternatePhone.ExchangeCode); + Assert.AreEqual(expected.AlternatePhone.Extension, actual.AlternatePhone.Extension); + Assert.AreEqual(expected.AlternatePhone.FreeFormNumber, actual.AlternatePhone.FreeFormNumber); + Assert.AreEqual(expected.AlternatePhone.Default, actual.AlternatePhone.Default); + Assert.AreEqual(expected.AlternatePhone.DefaultSpecified, actual.AlternatePhone.DefaultSpecified); + Assert.AreEqual(expected.AlternatePhone.Tag, actual.AlternatePhone.Tag); + Assert.AreEqual(expected.Mobile.DeviceType, actual.Mobile.DeviceType); + Assert.AreEqual(expected.Mobile.CountryCode, actual.Mobile.CountryCode); + Assert.AreEqual(expected.Mobile.AreaCode, actual.Mobile.AreaCode); + Assert.AreEqual(expected.Mobile.ExchangeCode, actual.Mobile.ExchangeCode); + Assert.AreEqual(expected.Mobile.Extension, actual.Mobile.Extension); + Assert.AreEqual(expected.Mobile.FreeFormNumber, actual.Mobile.FreeFormNumber); + Assert.AreEqual(expected.Mobile.Default, actual.Mobile.Default); + Assert.AreEqual(expected.Mobile.DefaultSpecified, actual.Mobile.DefaultSpecified); + Assert.AreEqual(expected.Mobile.Tag, actual.Mobile.Tag); + Assert.AreEqual(expected.Fax.DeviceType, actual.Fax.DeviceType); + Assert.AreEqual(expected.Fax.CountryCode, actual.Fax.CountryCode); + Assert.AreEqual(expected.Fax.AreaCode, actual.Fax.AreaCode); + Assert.AreEqual(expected.Fax.ExchangeCode, actual.Fax.ExchangeCode); + Assert.AreEqual(expected.Fax.Extension, actual.Fax.Extension); + Assert.AreEqual(expected.Fax.FreeFormNumber, actual.Fax.FreeFormNumber); + Assert.AreEqual(expected.Fax.Default, actual.Fax.Default); + Assert.AreEqual(expected.Fax.DefaultSpecified, actual.Fax.DefaultSpecified); + Assert.AreEqual(expected.Fax.Tag, actual.Fax.Tag); + Assert.AreEqual(expected.PrimaryEmailAddr.Address, actual.PrimaryEmailAddr.Address); + Assert.AreEqual(expected.PrimaryEmailAddr.Default, actual.PrimaryEmailAddr.Default); + Assert.AreEqual(expected.PrimaryEmailAddr.DefaultSpecified, actual.PrimaryEmailAddr.DefaultSpecified); + Assert.AreEqual(expected.PrimaryEmailAddr.Tag, actual.PrimaryEmailAddr.Tag); + Assert.AreEqual(expected.WebAddr.URI, actual.WebAddr.URI); + Assert.AreEqual(expected.WebAddr.Default, actual.WebAddr.Default); + Assert.AreEqual(expected.WebAddr.DefaultSpecified, actual.WebAddr.DefaultSpecified); + Assert.AreEqual(expected.WebAddr.Tag, actual.WebAddr.Tag); + Assert.IsTrue(Helper.CheckEqual(expected.OtherContactInfo, actual.OtherContactInfo)); + //Assert.AreEqual(expected.DefaultTaxCodeRef.name, actual.DefaultTaxCodeRef.name); + //Assert.AreEqual(expected.DefaultTaxCodeRef.type, actual.DefaultTaxCodeRef.type); + //Assert.AreEqual(expected.DefaultTaxCodeRef.Value, actual.DefaultTaxCodeRef.Value); + } + + + internal static void VerifyCustomerFrance(Customer expected, Customer actual) + { + + Assert.AreEqual(expected.GivenName, actual.GivenName); + Assert.AreEqual(expected.MiddleName, actual.MiddleName); + Assert.AreEqual(expected.FamilyName, actual.FamilyName); + Assert.AreEqual(expected.FullyQualifiedName, actual.FullyQualifiedName); + Assert.AreEqual(expected.CompanyName, actual.CompanyName); + Assert.AreEqual(expected.DisplayName, actual.DisplayName); + + } + + + internal static void VerifyCustomerSparseUpdate(Customer expected, Customer actual) + { + Assert.AreEqual(expected.MiddleName, actual.MiddleName); + } + + + internal static void VerifyUser(User expected, User actual) + { + Assert.AreEqual(expected.DisplayName, actual.DisplayName); + Assert.AreEqual(expected.Title, actual.Title); + Assert.AreEqual(expected.GivenName, actual.GivenName); + Assert.AreEqual(expected.MiddleName, actual.MiddleName); + Assert.AreEqual(expected.FamilyName, actual.FamilyName); + Assert.AreEqual(expected.Suffix, actual.Suffix); + Assert.IsTrue(Helper.CheckEqual(expected.EmailAddr, actual.EmailAddr)); + //Assert.IsTrue(Helper.CheckEqual(expected.Addr, actual.Addr)); + //Assert.IsTrue(Helper.CheckEqual(expected.PhoneNumber, actual.PhoneNumber)); + //Assert.AreEqual(expected.LocaleCountry, actual.LocaleCountry); + //Assert.AreEqual(expected.LocaleLanguage, actual.LocaleLanguage); + //Assert.AreEqual(expected.LocalePostalCode, actual.LocalePostalCode); + //Assert.AreEqual(expected.LocaleTimeZone, actual.LocaleTimeZone); + //Assert.IsTrue(Helper.CheckEqual(expected.NameValueAttr, actual.NameValueAttr)); + } + + + internal static void VerifyUserSparse(User expected, User actual) + { + Assert.AreEqual(expected.DisplayName, actual.DisplayName); + Assert.AreEqual(expected.Title, actual.Title); + Assert.AreEqual(expected.GivenName, actual.GivenName); + Assert.AreEqual(expected.MiddleName, actual.MiddleName); + Assert.AreEqual(expected.FamilyName, actual.FamilyName); + Assert.AreEqual(expected.Suffix, actual.Suffix); + } + + + internal static void VerifyVendor(Vendor expected, Vendor actual) + { + Assert.AreEqual(expected.ContactName, actual.ContactName); + Assert.AreEqual(expected.AltContactName, actual.AltContactName); + Assert.AreEqual(expected.Notes, actual.Notes); + Assert.AreEqual(expected.BillAddr.Line1, actual.BillAddr.Line1); + Assert.AreEqual(expected.BillAddr.Line2, actual.BillAddr.Line2); + Assert.AreEqual(expected.BillAddr.Line3, actual.BillAddr.Line3); + Assert.AreEqual(expected.BillAddr.Line4, actual.BillAddr.Line4); + Assert.AreEqual(expected.BillAddr.Line5, actual.BillAddr.Line5); + Assert.AreEqual(expected.BillAddr.City, actual.BillAddr.City); + Assert.AreEqual(expected.BillAddr.Country, actual.BillAddr.Country); + Assert.AreEqual(expected.BillAddr.CountryCode, actual.BillAddr.CountryCode); + Assert.AreEqual(expected.BillAddr.CountrySubDivisionCode, actual.BillAddr.CountrySubDivisionCode); + Assert.AreEqual(expected.BillAddr.PostalCode, actual.BillAddr.PostalCode); + Assert.AreEqual(expected.BillAddr.PostalCodeSuffix, actual.BillAddr.PostalCodeSuffix); + //Assert.AreEqual(expected.BillAddr.Lat, actual.BillAddr.Lat); + //Assert.AreEqual(expected.BillAddr.Long, actual.BillAddr.Long); + Assert.AreEqual(expected.BillAddr.Tag, actual.BillAddr.Tag); + Assert.AreEqual(expected.BillAddr.Note, actual.BillAddr.Note); + //Assert.AreEqual(expected.ShipAddr.Line1, actual.ShipAddr.Line1); + //Assert.AreEqual(expected.ShipAddr.Line2, actual.ShipAddr.Line2); + //Assert.AreEqual(expected.ShipAddr.Line3, actual.ShipAddr.Line3); + //Assert.AreEqual(expected.ShipAddr.Line4, actual.ShipAddr.Line4); + //Assert.AreEqual(expected.ShipAddr.Line5, actual.ShipAddr.Line5); + //Assert.AreEqual(expected.ShipAddr.City, actual.ShipAddr.City); + //Assert.AreEqual(expected.ShipAddr.Country, actual.ShipAddr.Country); + //Assert.AreEqual(expected.ShipAddr.CountryCode, actual.ShipAddr.CountryCode); + //Assert.AreEqual(expected.ShipAddr.CountrySubDivisionCode, actual.ShipAddr.CountrySubDivisionCode); + //Assert.AreEqual(expected.ShipAddr.PostalCode, actual.ShipAddr.PostalCode); + //Assert.AreEqual(expected.ShipAddr.PostalCodeSuffix, actual.ShipAddr.PostalCodeSuffix); + //Assert.AreEqual(expected.ShipAddr.Lat, actual.ShipAddr.Lat); + //Assert.AreEqual(expected.ShipAddr.Long, actual.ShipAddr.Long); + //Assert.AreEqual(expected.ShipAddr.Tag, actual.ShipAddr.Tag); + //Assert.AreEqual(expected.ShipAddr.Note, actual.ShipAddr.Note); + Assert.IsTrue(Helper.CheckEqual(expected.OtherAddr, actual.OtherAddr)); + Assert.AreEqual(expected.TaxCountry, actual.TaxCountry); + //Assert.AreEqual(expected.TaxIdentifier, actual.TaxIdentifier); + Assert.AreEqual(expected.BusinessNumber, actual.BusinessNumber); + //Assert.AreEqual(expected.ParentRef.name, actual.ParentRef.name); + //Assert.AreEqual(expected.ParentRef.type, actual.ParentRef.type); + //Assert.AreEqual(expected.ParentRef.Value, actual.ParentRef.Value); + //Assert.AreEqual(expected.VendorTypeRef.name, actual.VendorTypeRef.name); + //Assert.AreEqual(expected.VendorTypeRef.type, actual.VendorTypeRef.type); + //Assert.AreEqual(expected.VendorTypeRef.Value, actual.VendorTypeRef.Value); + //Assert.AreEqual(expected.TermRef.name, actual.TermRef.name); + //Assert.AreEqual(expected.TermRef.type, actual.TermRef.type); + //Assert.AreEqual(expected.TermRef.Value, actual.TermRef.Value); + //Assert.AreEqual(expected.PrefillAccountRef.name, actual.PrefillAccountRef.name); + //Assert.AreEqual(expected.PrefillAccountRef.type, actual.PrefillAccountRef.type); + //Assert.AreEqual(expected.PrefillAccountRef.Value, actual.PrefillAccountRef.Value); + Assert.AreEqual(expected.Balance, actual.Balance); + Assert.AreEqual(expected.BalanceSpecified, actual.BalanceSpecified); + //Assert.AreEqual(expected.OpenBalanceDate, actual.OpenBalanceDate); + //Assert.AreEqual(expected.OpenBalanceDateSpecified, actual.OpenBalanceDateSpecified); + Assert.AreEqual(expected.CreditLimit, actual.CreditLimit); + Assert.AreEqual(expected.CreditLimitSpecified, actual.CreditLimitSpecified); + Assert.AreEqual(expected.AcctNum, actual.AcctNum); + Assert.AreEqual(expected.Vendor1099, actual.Vendor1099); + Assert.AreEqual(expected.Vendor1099Specified, actual.Vendor1099Specified); + Assert.AreEqual(expected.T4AEligible, actual.T4AEligible); + Assert.AreEqual(expected.T4AEligibleSpecified, actual.T4AEligibleSpecified); + Assert.AreEqual(expected.T5018Eligible, actual.T5018Eligible); + Assert.AreEqual(expected.T5018EligibleSpecified, actual.T5018EligibleSpecified); + //Assert.AreEqual(expected.CurrencyRef.name, actual.CurrencyRef.name); + //Assert.AreEqual(expected.CurrencyRef.type, actual.CurrencyRef.type); + //Assert.AreEqual(expected.CurrencyRef.Value, actual.CurrencyRef.Value); + //Assert.AreEqual(expected.VendorEx.Any, actual.VendorEx.Any); + Assert.AreEqual(expected.Organization, actual.Organization); + Assert.AreEqual(expected.OrganizationSpecified, actual.OrganizationSpecified); + Assert.AreEqual(expected.Title, actual.Title); + Assert.AreEqual(expected.GivenName, actual.GivenName); + Assert.AreEqual(expected.MiddleName, actual.MiddleName); + Assert.AreEqual(expected.FamilyName, actual.FamilyName); + Assert.AreEqual(expected.Suffix, actual.Suffix); + Assert.AreEqual(expected.FullyQualifiedName, actual.FullyQualifiedName); + Assert.AreEqual(expected.CompanyName, actual.CompanyName); + Assert.AreEqual(expected.DisplayName, actual.DisplayName); + Assert.AreEqual(expected.PrintOnCheckName, actual.PrintOnCheckName); + Assert.AreEqual(expected.UserId, actual.UserId); + Assert.AreEqual(expected.Active, actual.Active); + Assert.AreEqual(expected.ActiveSpecified, actual.ActiveSpecified); + Assert.AreEqual(expected.PrimaryPhone.DeviceType, actual.PrimaryPhone.DeviceType); + Assert.AreEqual(expected.PrimaryPhone.CountryCode, actual.PrimaryPhone.CountryCode); + Assert.AreEqual(expected.PrimaryPhone.AreaCode, actual.PrimaryPhone.AreaCode); + Assert.AreEqual(expected.PrimaryPhone.ExchangeCode, actual.PrimaryPhone.ExchangeCode); + Assert.AreEqual(expected.PrimaryPhone.Extension, actual.PrimaryPhone.Extension); + Assert.AreEqual(expected.PrimaryPhone.FreeFormNumber, actual.PrimaryPhone.FreeFormNumber); + Assert.AreEqual(expected.PrimaryPhone.Default, actual.PrimaryPhone.Default); + Assert.AreEqual(expected.PrimaryPhone.DefaultSpecified, actual.PrimaryPhone.DefaultSpecified); + Assert.AreEqual(expected.PrimaryPhone.Tag, actual.PrimaryPhone.Tag); + Assert.AreEqual(expected.AlternatePhone.DeviceType, actual.AlternatePhone.DeviceType); + Assert.AreEqual(expected.AlternatePhone.CountryCode, actual.AlternatePhone.CountryCode); + Assert.AreEqual(expected.AlternatePhone.AreaCode, actual.AlternatePhone.AreaCode); + Assert.AreEqual(expected.AlternatePhone.ExchangeCode, actual.AlternatePhone.ExchangeCode); + Assert.AreEqual(expected.AlternatePhone.Extension, actual.AlternatePhone.Extension); + Assert.AreEqual(expected.AlternatePhone.FreeFormNumber, actual.AlternatePhone.FreeFormNumber); + Assert.AreEqual(expected.AlternatePhone.Default, actual.AlternatePhone.Default); + Assert.AreEqual(expected.AlternatePhone.DefaultSpecified, actual.AlternatePhone.DefaultSpecified); + Assert.AreEqual(expected.AlternatePhone.Tag, actual.AlternatePhone.Tag); + Assert.AreEqual(expected.Mobile.DeviceType, actual.Mobile.DeviceType); + Assert.AreEqual(expected.Mobile.CountryCode, actual.Mobile.CountryCode); + Assert.AreEqual(expected.Mobile.AreaCode, actual.Mobile.AreaCode); + Assert.AreEqual(expected.Mobile.ExchangeCode, actual.Mobile.ExchangeCode); + Assert.AreEqual(expected.Mobile.Extension, actual.Mobile.Extension); + Assert.AreEqual(expected.Mobile.FreeFormNumber, actual.Mobile.FreeFormNumber); + Assert.AreEqual(expected.Mobile.Default, actual.Mobile.Default); + Assert.AreEqual(expected.Mobile.DefaultSpecified, actual.Mobile.DefaultSpecified); + Assert.AreEqual(expected.Mobile.Tag, actual.Mobile.Tag); + Assert.AreEqual(expected.Fax.DeviceType, actual.Fax.DeviceType); + Assert.AreEqual(expected.Fax.CountryCode, actual.Fax.CountryCode); + Assert.AreEqual(expected.Fax.AreaCode, actual.Fax.AreaCode); + Assert.AreEqual(expected.Fax.ExchangeCode, actual.Fax.ExchangeCode); + Assert.AreEqual(expected.Fax.Extension, actual.Fax.Extension); + Assert.AreEqual(expected.Fax.FreeFormNumber, actual.Fax.FreeFormNumber); + Assert.AreEqual(expected.Fax.Default, actual.Fax.Default); + Assert.AreEqual(expected.Fax.DefaultSpecified, actual.Fax.DefaultSpecified); + Assert.AreEqual(expected.Fax.Tag, actual.Fax.Tag); + Assert.AreEqual(expected.PrimaryEmailAddr.Address, actual.PrimaryEmailAddr.Address); + Assert.AreEqual(expected.PrimaryEmailAddr.Default, actual.PrimaryEmailAddr.Default); + Assert.AreEqual(expected.PrimaryEmailAddr.DefaultSpecified, actual.PrimaryEmailAddr.DefaultSpecified); + Assert.AreEqual(expected.PrimaryEmailAddr.Tag, actual.PrimaryEmailAddr.Tag); + Assert.AreEqual(expected.WebAddr.URI, actual.WebAddr.URI); + Assert.AreEqual(expected.WebAddr.Default, actual.WebAddr.Default); + Assert.AreEqual(expected.WebAddr.DefaultSpecified, actual.WebAddr.DefaultSpecified); + Assert.AreEqual(expected.WebAddr.Tag, actual.WebAddr.Tag); + Assert.IsTrue(Helper.CheckEqual(expected.OtherContactInfo, actual.OtherContactInfo)); + //Assert.AreEqual(expected.DefaultTaxCodeRef.name, actual.DefaultTaxCodeRef.name); + //Assert.AreEqual(expected.DefaultTaxCodeRef.type, actual.DefaultTaxCodeRef.type); + //Assert.AreEqual(expected.DefaultTaxCodeRef.Value, actual.DefaultTaxCodeRef.Value); + } + + + internal static void VerifyVendorFrance(Vendor expected, Vendor actual) + { + + Assert.AreEqual(expected.BillAddr.Line1, actual.BillAddr.Line1); + Assert.AreEqual(expected.BillAddr.Line2, actual.BillAddr.Line2); + Assert.AreEqual(expected.BillAddr.Line3, actual.BillAddr.Line3); + Assert.AreEqual(expected.BillAddr.Line4, actual.BillAddr.Line4); + Assert.AreEqual(expected.BillAddr.Line5, actual.BillAddr.Line5); + Assert.AreEqual(expected.BillAddr.City, actual.BillAddr.City); + Assert.AreEqual(expected.BillAddr.Country, actual.BillAddr.Country); + Assert.AreEqual(expected.BillAddr.CountryCode, actual.BillAddr.CountryCode); + Assert.AreEqual(expected.BillAddr.CountrySubDivisionCode, actual.BillAddr.CountrySubDivisionCode); + Assert.AreEqual(expected.BillAddr.PostalCode, actual.BillAddr.PostalCode); + Assert.AreEqual(expected.BillAddr.PostalCodeSuffix, actual.BillAddr.PostalCodeSuffix); + + Assert.AreEqual(expected.Title, actual.Title); + Assert.AreEqual(expected.GivenName, actual.GivenName); + Assert.AreEqual(expected.MiddleName, actual.MiddleName); + Assert.AreEqual(expected.FamilyName, actual.FamilyName); + Assert.AreEqual(expected.Suffix, actual.Suffix); + Assert.AreEqual(expected.FullyQualifiedName, actual.FullyQualifiedName); + Assert.AreEqual(expected.CompanyName, actual.CompanyName); + Assert.AreEqual(expected.DisplayName, actual.DisplayName); + Assert.AreEqual(expected.PrintOnCheckName, actual.PrintOnCheckName); + Assert.AreEqual(expected.UserId, actual.UserId); + + } + + + internal static void VerifyVendorSparseUpdate(Vendor expected, Vendor actual) + { + Assert.AreEqual(expected.GivenName, actual.GivenName); + Assert.AreEqual(expected.MiddleName, actual.MiddleName); + Assert.AreEqual(expected.FamilyName, actual.FamilyName); + } + + + + internal static void VerifyCustomerType(CustomerType expected, CustomerType actual) + { + Assert.AreEqual(expected.Name, actual.Name); + //Assert.AreEqual(expected.ParentRef.name, actual.ParentRef.name); + //Assert.AreEqual(expected.ParentRef.type, actual.ParentRef.type); + //Assert.AreEqual(expected.ParentRef.Value, actual.ParentRef.Value); + Assert.AreEqual(expected.FullyQualifiedName, actual.FullyQualifiedName); + Assert.AreEqual(expected.Active, actual.Active); + Assert.AreEqual(expected.ActiveSpecified, actual.ActiveSpecified); + } + + + internal static void VerifyCustomerTypeSparse(CustomerType expected, CustomerType actual) + { + Assert.AreEqual(expected.Name, actual.Name); + } + + internal static void VerifyEmployee(Employee expected, Employee actual) + { + //Assert.AreEqual(expected.EmployeeType, actual.EmployeeType); + //Assert.AreEqual(expected.EmployeeNumber, actual.EmployeeNumber); + // Assert.AreEqual(expected.SSN, actual.SSN); + // Assert.AreEqual(expected.PrimaryAddr.Line1, actual.PrimaryAddr.Line1); + // Assert.AreEqual(expected.PrimaryAddr.Line2, actual.PrimaryAddr.Line2); + // Assert.AreEqual(expected.PrimaryAddr.Line3, actual.PrimaryAddr.Line3); + // Assert.AreEqual(expected.PrimaryAddr.Line4, actual.PrimaryAddr.Line4); + // Assert.AreEqual(expected.PrimaryAddr.Line5, actual.PrimaryAddr.Line5); + // Assert.AreEqual(expected.PrimaryAddr.City, actual.PrimaryAddr.City); + // Assert.AreEqual(expected.PrimaryAddr.Country, actual.PrimaryAddr.Country); + // Assert.AreEqual(expected.PrimaryAddr.CountryCode, actual.PrimaryAddr.CountryCode); + // Assert.AreEqual(expected.PrimaryAddr.CountrySubDivisionCode, actual.PrimaryAddr.CountrySubDivisionCode); + // Assert.AreEqual(expected.PrimaryAddr.PostalCode, actual.PrimaryAddr.PostalCode); + // Assert.AreEqual(expected.PrimaryAddr.PostalCodeSuffix, actual.PrimaryAddr.PostalCodeSuffix); + // Assert.AreEqual(expected.PrimaryAddr.Lat, actual.PrimaryAddr.Lat); + // Assert.AreEqual(expected.PrimaryAddr.Long, actual.PrimaryAddr.Long); + // Assert.AreEqual(expected.PrimaryAddr.Tag, actual.PrimaryAddr.Tag); + // Assert.AreEqual(expected.PrimaryAddr.Note, actual.PrimaryAddr.Note); + //Assert.IsTrue(Helper.CheckEqual(expected.OtherAddr, actual.OtherAddr)); + //Assert.AreEqual(expected.BillableTime, actual.BillableTime); + //Assert.AreEqual(expected.BillableTimeSpecified, actual.BillableTimeSpecified); + Assert.AreEqual(expected.BirthDate, actual.BirthDate); + Assert.AreEqual(expected.BirthDateSpecified, actual.BirthDateSpecified); + Assert.AreEqual(expected.Gender, actual.Gender); + Assert.AreEqual(expected.GenderSpecified, actual.GenderSpecified); + Assert.AreEqual(expected.HiredDate, actual.HiredDate); + Assert.AreEqual(expected.HiredDateSpecified, actual.HiredDateSpecified); + Assert.AreEqual(expected.ReleasedDate, actual.ReleasedDate); + Assert.AreEqual(expected.ReleasedDateSpecified, actual.ReleasedDateSpecified); + //Assert.AreEqual(expected.UseTimeEntrySpecified, actual.UseTimeEntrySpecified); + // Assert.AreEqual(expected.EmployeeEx.Any, actual.EmployeeEx.Any); + //Assert.AreEqual(expected.Organization, actual.Organization); + //Assert.AreEqual(expected.OrganizationSpecified, actual.OrganizationSpecified); + //Assert.AreEqual(expected.Title, actual.Title); + Assert.AreEqual(expected.GivenName, actual.GivenName); + //Assert.AreEqual(expected.MiddleName, actual.MiddleName); + Assert.AreEqual(expected.FamilyName, actual.FamilyName); + //Assert.AreEqual(expected.Suffix, actual.Suffix); + //Assert.AreEqual(expected.FullyQualifiedName, actual.FullyQualifiedName); + //Assert.AreEqual(expected.CompanyName, actual.CompanyName); + //Assert.AreEqual(expected.DisplayName, actual.DisplayName); + //Assert.AreEqual(expected.PrintOnCheckName, actual.PrintOnCheckName); + //Assert.AreEqual(expected.UserId, actual.UserId); + Assert.AreEqual(expected.Active, actual.Active); + Assert.AreEqual(expected.ActiveSpecified, actual.ActiveSpecified); + // Assert.AreEqual(expected.PrimaryPhone.DeviceType, actual.PrimaryPhone.DeviceType); + // Assert.AreEqual(expected.PrimaryPhone.CountryCode, actual.PrimaryPhone.CountryCode); + // Assert.AreEqual(expected.PrimaryPhone.AreaCode, actual.PrimaryPhone.AreaCode); + // Assert.AreEqual(expected.PrimaryPhone.ExchangeCode, actual.PrimaryPhone.ExchangeCode); + // Assert.AreEqual(expected.PrimaryPhone.Extension, actual.PrimaryPhone.Extension); + // Assert.AreEqual(expected.PrimaryPhone.FreeFormNumber, actual.PrimaryPhone.FreeFormNumber); + // Assert.AreEqual(expected.PrimaryPhone.Default, actual.PrimaryPhone.Default); + // Assert.AreEqual(expected.PrimaryPhone.DefaultSpecified, actual.PrimaryPhone.DefaultSpecified); + // Assert.AreEqual(expected.PrimaryPhone.Tag, actual.PrimaryPhone.Tag); + // Assert.AreEqual(expected.AlternatePhone.DeviceType, actual.AlternatePhone.DeviceType); + // Assert.AreEqual(expected.AlternatePhone.CountryCode, actual.AlternatePhone.CountryCode); + // Assert.AreEqual(expected.AlternatePhone.AreaCode, actual.AlternatePhone.AreaCode); + // Assert.AreEqual(expected.AlternatePhone.ExchangeCode, actual.AlternatePhone.ExchangeCode); + // Assert.AreEqual(expected.AlternatePhone.Extension, actual.AlternatePhone.Extension); + // Assert.AreEqual(expected.AlternatePhone.FreeFormNumber, actual.AlternatePhone.FreeFormNumber); + // Assert.AreEqual(expected.AlternatePhone.Default, actual.AlternatePhone.Default); + // Assert.AreEqual(expected.AlternatePhone.DefaultSpecified, actual.AlternatePhone.DefaultSpecified); + // Assert.AreEqual(expected.AlternatePhone.Tag, actual.AlternatePhone.Tag); + // Assert.AreEqual(expected.Mobile.DeviceType, actual.Mobile.DeviceType); + // Assert.AreEqual(expected.Mobile.CountryCode, actual.Mobile.CountryCode); + // Assert.AreEqual(expected.Mobile.AreaCode, actual.Mobile.AreaCode); + // Assert.AreEqual(expected.Mobile.ExchangeCode, actual.Mobile.ExchangeCode); + // Assert.AreEqual(expected.Mobile.Extension, actual.Mobile.Extension); + // Assert.AreEqual(expected.Mobile.FreeFormNumber, actual.Mobile.FreeFormNumber); + // Assert.AreEqual(expected.Mobile.Default, actual.Mobile.Default); + // Assert.AreEqual(expected.Mobile.DefaultSpecified, actual.Mobile.DefaultSpecified); + // Assert.AreEqual(expected.Mobile.Tag, actual.Mobile.Tag); + // Assert.AreEqual(expected.Fax.DeviceType, actual.Fax.DeviceType); + // Assert.AreEqual(expected.Fax.CountryCode, actual.Fax.CountryCode); + // Assert.AreEqual(expected.Fax.AreaCode, actual.Fax.AreaCode); + // Assert.AreEqual(expected.Fax.ExchangeCode, actual.Fax.ExchangeCode); + // Assert.AreEqual(expected.Fax.Extension, actual.Fax.Extension); + // Assert.AreEqual(expected.Fax.FreeFormNumber, actual.Fax.FreeFormNumber); + // Assert.AreEqual(expected.Fax.Default, actual.Fax.Default); + // Assert.AreEqual(expected.Fax.DefaultSpecified, actual.Fax.DefaultSpecified); + // Assert.AreEqual(expected.Fax.Tag, actual.Fax.Tag); + // Assert.AreEqual(expected.PrimaryEmailAddr.Address, actual.PrimaryEmailAddr.Address); + // Assert.AreEqual(expected.PrimaryEmailAddr.Default, actual.PrimaryEmailAddr.Default); + // Assert.AreEqual(expected.PrimaryEmailAddr.DefaultSpecified, actual.PrimaryEmailAddr.DefaultSpecified); + // Assert.AreEqual(expected.PrimaryEmailAddr.Tag, actual.PrimaryEmailAddr.Tag); + // Assert.AreEqual(expected.WebAddr.URI, actual.WebAddr.URI); + // Assert.AreEqual(expected.WebAddr.Default, actual.WebAddr.Default); + // Assert.AreEqual(expected.WebAddr.DefaultSpecified, actual.WebAddr.DefaultSpecified); + // Assert.AreEqual(expected.WebAddr.Tag, actual.WebAddr.Tag); + //Assert.IsTrue(Helper.CheckEqual(expected.OtherContactInfo, actual.OtherContactInfo)); + // Assert.AreEqual(expected.DefaultTaxCodeRef.name, actual.DefaultTaxCodeRef.name); + // Assert.AreEqual(expected.DefaultTaxCodeRef.type, actual.DefaultTaxCodeRef.type); + // Assert.AreEqual(expected.DefaultTaxCodeRef.Value, actual.DefaultTaxCodeRef.Value); + } + + + internal static void VerifyEmployeeSparseUpdate(Employee expected, Employee actual) + { + Assert.AreEqual(expected.GivenName, actual.GivenName); + } + + + internal static void VerifyJobType(JobType expected, JobType actual) + { + Assert.AreEqual(expected.Name, actual.Name); + //Assert.AreEqual(expected.ParentRef.name, actual.ParentRef.name); + //Assert.AreEqual(expected.ParentRef.type, actual.ParentRef.type); + //Assert.AreEqual(expected.ParentRef.Value, actual.ParentRef.Value); + Assert.AreEqual(expected.FullyQualifiedName, actual.FullyQualifiedName); + Assert.AreEqual(expected.Active, actual.Active); + Assert.AreEqual(expected.ActiveSpecified, actual.ActiveSpecified); + } + + + internal static void VerifyJobTypeSparse(JobType expected, JobType actual) + { + Assert.AreEqual(expected.Name, actual.Name); + } + + internal static void VerifyOtherName(OtherName expected, OtherName actual) + { + + List otherAddrList = new List(); + PhysicalAddress otherAddr = new PhysicalAddress(); + otherAddr.Line1 = "Other address Line1"; + otherAddr.Line2 = "Other address Line2"; + //otherAddr.Line3 = "Line3"; + //otherAddr.Line4 = "Line4"; + //otherAddr.Line5 = "Line5"; + otherAddr.City = "City"; + otherAddr.Country = "Country"; + //otherAddr.CountryCode = "CountryCode"; + //otherAddr.CountrySubDivisionCode = "CountrySubDivisionCode"; + otherAddr.PostalCode = "7438957"; + Assert.AreEqual(expected.AcctNum, actual.AcctNum); + Assert.AreEqual(expected.PrimaryAddr.Line1, actual.PrimaryAddr.Line1); + Assert.AreEqual(expected.PrimaryAddr.Line2, actual.PrimaryAddr.Line2); + Assert.AreEqual(expected.PrimaryAddr.Line3, actual.PrimaryAddr.Line3); + Assert.AreEqual(expected.PrimaryAddr.Line4, actual.PrimaryAddr.Line4); + Assert.AreEqual(expected.PrimaryAddr.Line5, actual.PrimaryAddr.Line5); + Assert.AreEqual(expected.PrimaryAddr.City, actual.PrimaryAddr.City); + Assert.AreEqual(expected.PrimaryAddr.Country, actual.PrimaryAddr.Country); + Assert.AreEqual(expected.PrimaryAddr.CountryCode, actual.PrimaryAddr.CountryCode); + Assert.AreEqual(expected.PrimaryAddr.CountrySubDivisionCode, actual.PrimaryAddr.CountrySubDivisionCode); + Assert.AreEqual(expected.PrimaryAddr.PostalCode, actual.PrimaryAddr.PostalCode); + Assert.AreEqual(expected.PrimaryAddr.PostalCodeSuffix, actual.PrimaryAddr.PostalCodeSuffix); + Assert.AreEqual(expected.PrimaryAddr.Lat, actual.PrimaryAddr.Lat); + Assert.AreEqual(expected.PrimaryAddr.Long, actual.PrimaryAddr.Long); + Assert.AreEqual(expected.PrimaryAddr.Tag, actual.PrimaryAddr.Tag); + Assert.AreEqual(expected.PrimaryAddr.Note, actual.PrimaryAddr.Note); + Assert.IsTrue(Helper.CheckEqual(expected.OtherAddr, actual.OtherAddr)); + //Assert.AreEqual(expected.OtherNameEx.Any, actual.OtherNameEx.Any); + Assert.AreEqual(expected.Organization, actual.Organization); + Assert.AreEqual(expected.OrganizationSpecified, actual.OrganizationSpecified); + Assert.AreEqual(expected.Title, actual.Title); + Assert.AreEqual(expected.GivenName, actual.GivenName); + Assert.AreEqual(expected.MiddleName, actual.MiddleName); + Assert.AreEqual(expected.FamilyName, actual.FamilyName); + //Assert.AreEqual(expected.Suffix, actual.Suffix); + Assert.AreEqual(expected.FullyQualifiedName, actual.FullyQualifiedName); + Assert.AreEqual(expected.CompanyName, actual.CompanyName); + Assert.AreEqual(expected.DisplayName, actual.DisplayName); + Assert.AreEqual(expected.PrintOnCheckName, actual.PrintOnCheckName); + //Assert.AreEqual(expected.UserId, actual.UserId); + //Assert.AreEqual(expected.Active, actual.Active); + //Assert.AreEqual(expected.ActiveSpecified, actual.ActiveSpecified); + Assert.AreEqual(expected.PrimaryPhone.DeviceType, actual.PrimaryPhone.DeviceType); + Assert.AreEqual(expected.PrimaryPhone.CountryCode, actual.PrimaryPhone.CountryCode); + Assert.AreEqual(expected.PrimaryPhone.AreaCode, actual.PrimaryPhone.AreaCode); + Assert.AreEqual(expected.PrimaryPhone.ExchangeCode, actual.PrimaryPhone.ExchangeCode); + Assert.AreEqual(expected.PrimaryPhone.Extension, actual.PrimaryPhone.Extension); + Assert.AreEqual(expected.PrimaryPhone.FreeFormNumber, actual.PrimaryPhone.FreeFormNumber); + Assert.AreEqual(expected.PrimaryPhone.Default, actual.PrimaryPhone.Default); + Assert.AreEqual(expected.PrimaryPhone.DefaultSpecified, actual.PrimaryPhone.DefaultSpecified); + Assert.AreEqual(expected.PrimaryPhone.Tag, actual.PrimaryPhone.Tag); + //Assert.AreEqual(expected.AlternatePhone.DeviceType, actual.AlternatePhone.DeviceType); + //Assert.AreEqual(expected.AlternatePhone.CountryCode, actual.AlternatePhone.CountryCode); + //Assert.AreEqual(expected.AlternatePhone.AreaCode, actual.AlternatePhone.AreaCode); + //Assert.AreEqual(expected.AlternatePhone.ExchangeCode, actual.AlternatePhone.ExchangeCode); + //Assert.AreEqual(expected.AlternatePhone.Extension, actual.AlternatePhone.Extension); + //Assert.AreEqual(expected.AlternatePhone.FreeFormNumber, actual.AlternatePhone.FreeFormNumber); + //Assert.AreEqual(expected.AlternatePhone.Default, actual.AlternatePhone.Default); + //Assert.AreEqual(expected.AlternatePhone.DefaultSpecified, actual.AlternatePhone.DefaultSpecified); + //Assert.AreEqual(expected.AlternatePhone.Tag, actual.AlternatePhone.Tag); + Assert.AreEqual(expected.Mobile.DeviceType, actual.Mobile.DeviceType); + Assert.AreEqual(expected.Mobile.CountryCode, actual.Mobile.CountryCode); + Assert.AreEqual(expected.Mobile.AreaCode, actual.Mobile.AreaCode); + Assert.AreEqual(expected.Mobile.ExchangeCode, actual.Mobile.ExchangeCode); + Assert.AreEqual(expected.Mobile.Extension, actual.Mobile.Extension); + Assert.AreEqual(expected.Mobile.FreeFormNumber, actual.Mobile.FreeFormNumber); + Assert.AreEqual(expected.Mobile.Default, actual.Mobile.Default); + Assert.AreEqual(expected.Mobile.DefaultSpecified, actual.Mobile.DefaultSpecified); + Assert.AreEqual(expected.Mobile.Tag, actual.Mobile.Tag); + //Assert.AreEqual(expected.Fax.DeviceType, actual.Fax.DeviceType); + //Assert.AreEqual(expected.Fax.CountryCode, actual.Fax.CountryCode); + //Assert.AreEqual(expected.Fax.AreaCode, actual.Fax.AreaCode); + //Assert.AreEqual(expected.Fax.ExchangeCode, actual.Fax.ExchangeCode); + //Assert.AreEqual(expected.Fax.Extension, actual.Fax.Extension); + //Assert.AreEqual(expected.Fax.FreeFormNumber, actual.Fax.FreeFormNumber); + //Assert.AreEqual(expected.Fax.Default, actual.Fax.Default); + //Assert.AreEqual(expected.Fax.DefaultSpecified, actual.Fax.DefaultSpecified); + //Assert.AreEqual(expected.Fax.Tag, actual.Fax.Tag); + Assert.AreEqual(expected.PrimaryEmailAddr.Address, actual.PrimaryEmailAddr.Address); + Assert.AreEqual(expected.PrimaryEmailAddr.Default, actual.PrimaryEmailAddr.Default); + Assert.AreEqual(expected.PrimaryEmailAddr.DefaultSpecified, actual.PrimaryEmailAddr.DefaultSpecified); + Assert.AreEqual(expected.PrimaryEmailAddr.Tag, actual.PrimaryEmailAddr.Tag); + Assert.AreEqual(expected.WebAddr.URI, actual.WebAddr.URI); + Assert.AreEqual(expected.WebAddr.Default, actual.WebAddr.Default); + Assert.AreEqual(expected.WebAddr.DefaultSpecified, actual.WebAddr.DefaultSpecified); + Assert.AreEqual(expected.WebAddr.Tag, actual.WebAddr.Tag); + //Assert.IsTrue(Helper.CheckEqual(expected.OtherContactInfo, actual.OtherContactInfo)); + // Assert.AreEqual(expected.DefaultTaxCodeRef.name, actual.DefaultTaxCodeRef.name); + // Assert.AreEqual(expected.DefaultTaxCodeRef.type, actual.DefaultTaxCodeRef.type); + // Assert.AreEqual(expected.DefaultTaxCodeRef.Value, actual.DefaultTaxCodeRef.Value); + } + + + internal static void VerifyOtherNameSparse(OtherName expected, OtherName actual) + { + Assert.AreEqual(expected.AcctNum, actual.AcctNum); + Assert.AreEqual(expected.FamilyName, actual.FamilyName); + Assert.AreEqual(expected.GivenName, actual.GivenName); + } + + internal static void VerifyVendorType(VendorType expected, VendorType actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.ParentRef.name, actual.ParentRef.name); + Assert.AreEqual(expected.ParentRef.type, actual.ParentRef.type); + Assert.AreEqual(expected.ParentRef.Value, actual.ParentRef.Value); + Assert.AreEqual(expected.FullyQualifiedName, actual.FullyQualifiedName); + Assert.AreEqual(expected.Active, actual.Active); + Assert.AreEqual(expected.ActiveSpecified, actual.ActiveSpecified); + } + + internal static void VerifyVendorTypeSparse(VendorType expected, VendorType actual) + { + Assert.AreEqual(expected.Name, actual.Name); + Assert.AreEqual(expected.FullyQualifiedName, actual.FullyQualifiedName); + } + + internal static void VerifyTaxAgency(TaxAgency expected, TaxAgency actual) + { + Assert.AreEqual(expected.DisplayName, actual.DisplayName); + //Assert.AreEqual(expected.SalesTaxCodeRef.name, actual.SalesTaxCodeRef.name); + //Assert.AreEqual(expected.SalesTaxCodeRef.type, actual.SalesTaxCodeRef.type); + //Assert.AreEqual(expected.SalesTaxCodeRef.Value, actual.SalesTaxCodeRef.Value); + //Assert.AreEqual(expected.SalesTaxCountry, actual.SalesTaxCountry); + //Assert.AreEqual(expected.SalesTaxReturnRef.name, actual.SalesTaxReturnRef.name); + //Assert.AreEqual(expected.SalesTaxReturnRef.type, actual.SalesTaxReturnRef.type); + //Assert.AreEqual(expected.SalesTaxReturnRef.Value, actual.SalesTaxReturnRef.Value); + //Assert.AreEqual(expected.TaxRegistrationNumber, actual.TaxRegistrationNumber); + //Assert.AreEqual(expected.ReportingPeriod, actual.ReportingPeriod); + //Assert.AreEqual(expected.TaxTrackedOnPurchases, actual.TaxTrackedOnPurchases); + //Assert.AreEqual(expected.TaxTrackedOnPurchasesSpecified, actual.TaxTrackedOnPurchasesSpecified); + //Assert.AreEqual(expected.TaxOnPurchasesAccountRef.name, actual.TaxOnPurchasesAccountRef.name); + //Assert.AreEqual(expected.TaxOnPurchasesAccountRef.type, actual.TaxOnPurchasesAccountRef.type); + //Assert.AreEqual(expected.TaxOnPurchasesAccountRef.Value, actual.TaxOnPurchasesAccountRef.Value); + //Assert.AreEqual(expected.TaxTrackedOnSales, actual.TaxTrackedOnSales); + //Assert.AreEqual(expected.TaxTrackedOnSalesSpecified, actual.TaxTrackedOnSalesSpecified); + //Assert.AreEqual(expected.TaxTrackedOnSalesAccountRef.name, actual.TaxTrackedOnSalesAccountRef.name); + //Assert.AreEqual(expected.TaxTrackedOnSalesAccountRef.type, actual.TaxTrackedOnSalesAccountRef.type); + //Assert.AreEqual(expected.TaxTrackedOnSalesAccountRef.Value, actual.TaxTrackedOnSalesAccountRef.Value); + //Assert.AreEqual(expected.TaxOnTax, actual.TaxOnTax); + //Assert.AreEqual(expected.TaxOnTaxSpecified, actual.TaxOnTaxSpecified); + //Assert.AreEqual(expected.TaxAgencyExt.Any, actual.TaxAgencyExt.Any); + //Assert.AreEqual(expected.ContactName, actual.ContactName); + //Assert.AreEqual(expected.AltContactName, actual.AltContactName); + //Assert.AreEqual(expected.Notes, actual.Notes); + //Assert.AreEqual(expected.BillAddr.Line1, actual.BillAddr.Line1); + //Assert.AreEqual(expected.BillAddr.Line2, actual.BillAddr.Line2); + //Assert.AreEqual(expected.BillAddr.Line3, actual.BillAddr.Line3); + //Assert.AreEqual(expected.BillAddr.Line4, actual.BillAddr.Line4); + //Assert.AreEqual(expected.BillAddr.Line5, actual.BillAddr.Line5); + //Assert.AreEqual(expected.BillAddr.City, actual.BillAddr.City); + //Assert.AreEqual(expected.BillAddr.Country, actual.BillAddr.Country); + //Assert.AreEqual(expected.BillAddr.CountryCode, actual.BillAddr.CountryCode); + //Assert.AreEqual(expected.BillAddr.CountrySubDivisionCode, actual.BillAddr.CountrySubDivisionCode); + //Assert.AreEqual(expected.BillAddr.PostalCode, actual.BillAddr.PostalCode); + //Assert.AreEqual(expected.BillAddr.PostalCodeSuffix, actual.BillAddr.PostalCodeSuffix); + //Assert.AreEqual(expected.BillAddr.Lat, actual.BillAddr.Lat); + //Assert.AreEqual(expected.BillAddr.Long, actual.BillAddr.Long); + //Assert.AreEqual(expected.BillAddr.Tag, actual.BillAddr.Tag); + //Assert.AreEqual(expected.BillAddr.Note, actual.BillAddr.Note); + //Assert.AreEqual(expected.ShipAddr.Line1, actual.ShipAddr.Line1); + //Assert.AreEqual(expected.ShipAddr.Line2, actual.ShipAddr.Line2); + //Assert.AreEqual(expected.ShipAddr.Line3, actual.ShipAddr.Line3); + //Assert.AreEqual(expected.ShipAddr.Line4, actual.ShipAddr.Line4); + //Assert.AreEqual(expected.ShipAddr.Line5, actual.ShipAddr.Line5); + //Assert.AreEqual(expected.ShipAddr.City, actual.ShipAddr.City); + //Assert.AreEqual(expected.ShipAddr.Country, actual.ShipAddr.Country); + //Assert.AreEqual(expected.ShipAddr.CountryCode, actual.ShipAddr.CountryCode); + //Assert.AreEqual(expected.ShipAddr.CountrySubDivisionCode, actual.ShipAddr.CountrySubDivisionCode); + //Assert.AreEqual(expected.ShipAddr.PostalCode, actual.ShipAddr.PostalCode); + //Assert.AreEqual(expected.ShipAddr.PostalCodeSuffix, actual.ShipAddr.PostalCodeSuffix); + //Assert.AreEqual(expected.ShipAddr.Lat, actual.ShipAddr.Lat); + //Assert.AreEqual(expected.ShipAddr.Long, actual.ShipAddr.Long); + //Assert.AreEqual(expected.ShipAddr.Tag, actual.ShipAddr.Tag); + //Assert.AreEqual(expected.ShipAddr.Note, actual.ShipAddr.Note); + //Assert.IsTrue(Helper.CheckEqual(expected.OtherAddr, actual.OtherAddr)); + //Assert.AreEqual(expected.TaxCountry, actual.TaxCountry); + //Assert.AreEqual(expected.TaxIdentifier, actual.TaxIdentifier); + //Assert.AreEqual(expected.BusinessNumber, actual.BusinessNumber); + //Assert.AreEqual(expected.ParentRef.name, actual.ParentRef.name); + //Assert.AreEqual(expected.ParentRef.type, actual.ParentRef.type); + //Assert.AreEqual(expected.ParentRef.Value, actual.ParentRef.Value); + //Assert.AreEqual(expected.VendorTypeRef.name, actual.VendorTypeRef.name); + //Assert.AreEqual(expected.VendorTypeRef.type, actual.VendorTypeRef.type); + //Assert.AreEqual(expected.VendorTypeRef.Value, actual.VendorTypeRef.Value); + //Assert.AreEqual(expected.TermRef.name, actual.TermRef.name); + //Assert.AreEqual(expected.TermRef.type, actual.TermRef.type); + //Assert.AreEqual(expected.TermRef.Value, actual.TermRef.Value); + //Assert.AreEqual(expected.PrefillAccountRef.name, actual.PrefillAccountRef.name); + //Assert.AreEqual(expected.PrefillAccountRef.type, actual.PrefillAccountRef.type); + //Assert.AreEqual(expected.PrefillAccountRef.Value, actual.PrefillAccountRef.Value); + //Assert.AreEqual(expected.Balance, actual.Balance); + //Assert.AreEqual(expected.BalanceSpecified, actual.BalanceSpecified); + //Assert.AreEqual(expected.OpenBalanceDate, actual.OpenBalanceDate); + //Assert.AreEqual(expected.OpenBalanceDateSpecified, actual.OpenBalanceDateSpecified); + //Assert.AreEqual(expected.CreditLimit, actual.CreditLimit); + //Assert.AreEqual(expected.CreditLimitSpecified, actual.CreditLimitSpecified); + //Assert.AreEqual(expected.AcctNum, actual.AcctNum); + //Assert.AreEqual(expected.Vendor1099, actual.Vendor1099); + //Assert.AreEqual(expected.Vendor1099Specified, actual.Vendor1099Specified); + //Assert.AreEqual(expected.T4AEligible, actual.T4AEligible); + //Assert.AreEqual(expected.T4AEligibleSpecified, actual.T4AEligibleSpecified); + //Assert.AreEqual(expected.T5018Eligible, actual.T5018Eligible); + //Assert.AreEqual(expected.T5018EligibleSpecified, actual.T5018EligibleSpecified); + //Assert.AreEqual(expected.CurrencyRef.name, actual.CurrencyRef.name); + //Assert.AreEqual(expected.CurrencyRef.type, actual.CurrencyRef.type); + //Assert.AreEqual(expected.CurrencyRef.Value, actual.CurrencyRef.Value); + //Assert.AreEqual(expected.VendorEx.Any, actual.VendorEx.Any); + //Assert.AreEqual(expected.Organization, actual.Organization); + //Assert.AreEqual(expected.OrganizationSpecified, actual.OrganizationSpecified); + //Assert.AreEqual(expected.Title, actual.Title); + //Assert.AreEqual(expected.GivenName, actual.GivenName); + //Assert.AreEqual(expected.MiddleName, actual.MiddleName); + //Assert.AreEqual(expected.FamilyName, actual.FamilyName); + //Assert.AreEqual(expected.Suffix, actual.Suffix); + //Assert.AreEqual(expected.FullyQualifiedName, actual.FullyQualifiedName); + //Assert.AreEqual(expected.CompanyName, actual.CompanyName); + //Assert.AreEqual(expected.DisplayName, actual.DisplayName); + //Assert.AreEqual(expected.PrintOnCheckName, actual.PrintOnCheckName); + //Assert.AreEqual(expected.UserId, actual.UserId); + //Assert.AreEqual(expected.Active, actual.Active); + //Assert.AreEqual(expected.ActiveSpecified, actual.ActiveSpecified); + //Assert.AreEqual(expected.PrimaryPhone.DeviceType, actual.PrimaryPhone.DeviceType); + //Assert.AreEqual(expected.PrimaryPhone.CountryCode, actual.PrimaryPhone.CountryCode); + //Assert.AreEqual(expected.PrimaryPhone.AreaCode, actual.PrimaryPhone.AreaCode); + //Assert.AreEqual(expected.PrimaryPhone.ExchangeCode, actual.PrimaryPhone.ExchangeCode); + //Assert.AreEqual(expected.PrimaryPhone.Extension, actual.PrimaryPhone.Extension); + //Assert.AreEqual(expected.PrimaryPhone.FreeFormNumber, actual.PrimaryPhone.FreeFormNumber); + //Assert.AreEqual(expected.PrimaryPhone.Default, actual.PrimaryPhone.Default); + //Assert.AreEqual(expected.PrimaryPhone.DefaultSpecified, actual.PrimaryPhone.DefaultSpecified); + //Assert.AreEqual(expected.PrimaryPhone.Tag, actual.PrimaryPhone.Tag); + //Assert.AreEqual(expected.AlternatePhone.DeviceType, actual.AlternatePhone.DeviceType); + //Assert.AreEqual(expected.AlternatePhone.CountryCode, actual.AlternatePhone.CountryCode); + //Assert.AreEqual(expected.AlternatePhone.AreaCode, actual.AlternatePhone.AreaCode); + //Assert.AreEqual(expected.AlternatePhone.ExchangeCode, actual.AlternatePhone.ExchangeCode); + //Assert.AreEqual(expected.AlternatePhone.Extension, actual.AlternatePhone.Extension); + //Assert.AreEqual(expected.AlternatePhone.FreeFormNumber, actual.AlternatePhone.FreeFormNumber); + //Assert.AreEqual(expected.AlternatePhone.Default, actual.AlternatePhone.Default); + //Assert.AreEqual(expected.AlternatePhone.DefaultSpecified, actual.AlternatePhone.DefaultSpecified); + //Assert.AreEqual(expected.AlternatePhone.Tag, actual.AlternatePhone.Tag); + //Assert.AreEqual(expected.Mobile.DeviceType, actual.Mobile.DeviceType); + //Assert.AreEqual(expected.Mobile.CountryCode, actual.Mobile.CountryCode); + //Assert.AreEqual(expected.Mobile.AreaCode, actual.Mobile.AreaCode); + //Assert.AreEqual(expected.Mobile.ExchangeCode, actual.Mobile.ExchangeCode); + //Assert.AreEqual(expected.Mobile.Extension, actual.Mobile.Extension); + //Assert.AreEqual(expected.Mobile.FreeFormNumber, actual.Mobile.FreeFormNumber); + //Assert.AreEqual(expected.Mobile.Default, actual.Mobile.Default); + //Assert.AreEqual(expected.Mobile.DefaultSpecified, actual.Mobile.DefaultSpecified); + //Assert.AreEqual(expected.Mobile.Tag, actual.Mobile.Tag); + //Assert.AreEqual(expected.Fax.DeviceType, actual.Fax.DeviceType); + //Assert.AreEqual(expected.Fax.CountryCode, actual.Fax.CountryCode); + //Assert.AreEqual(expected.Fax.AreaCode, actual.Fax.AreaCode); + //Assert.AreEqual(expected.Fax.ExchangeCode, actual.Fax.ExchangeCode); + //Assert.AreEqual(expected.Fax.Extension, actual.Fax.Extension); + //Assert.AreEqual(expected.Fax.FreeFormNumber, actual.Fax.FreeFormNumber); + //Assert.AreEqual(expected.Fax.Default, actual.Fax.Default); + //Assert.AreEqual(expected.Fax.DefaultSpecified, actual.Fax.DefaultSpecified); + //Assert.AreEqual(expected.Fax.Tag, actual.Fax.Tag); + //Assert.AreEqual(expected.PrimaryEmailAddr.Address, actual.PrimaryEmailAddr.Address); + //Assert.AreEqual(expected.PrimaryEmailAddr.Default, actual.PrimaryEmailAddr.Default); + //Assert.AreEqual(expected.PrimaryEmailAddr.DefaultSpecified, actual.PrimaryEmailAddr.DefaultSpecified); + //Assert.AreEqual(expected.PrimaryEmailAddr.Tag, actual.PrimaryEmailAddr.Tag); + //Assert.AreEqual(expected.WebAddr.URI, actual.WebAddr.URI); + //Assert.AreEqual(expected.WebAddr.Default, actual.WebAddr.Default); + //Assert.AreEqual(expected.WebAddr.DefaultSpecified, actual.WebAddr.DefaultSpecified); + //Assert.AreEqual(expected.WebAddr.Tag, actual.WebAddr.Tag); + //Assert.IsTrue(Helper.CheckEqual(expected.OtherContactInfo, actual.OtherContactInfo)); + //Assert.AreEqual(expected.DefaultTaxCodeRef.name, actual.DefaultTaxCodeRef.name); + //Assert.AreEqual(expected.DefaultTaxCodeRef.type, actual.DefaultTaxCodeRef.type); + //Assert.AreEqual(expected.DefaultTaxCodeRef.Value, actual.DefaultTaxCodeRef.Value); + } + + + internal static void VerifyTaxAgencySparse(TaxAgency expected, TaxAgency actual) + { + Assert.AreEqual(expected.Notes, actual.Notes); + } + + internal static void VerifyStatus(Status expected, Status actual) + { + Assert.AreEqual(expected.RequestId, actual.RequestId); + Assert.AreEqual(expected.BatchId, actual.BatchId); + Assert.AreEqual(expected.ObjectType, actual.ObjectType); + Assert.AreEqual(expected.StateCode, actual.StateCode); + Assert.AreEqual(expected.StateDesc, actual.StateDesc); + Assert.AreEqual(expected.MessageCode, actual.MessageCode); + Assert.AreEqual(expected.MessageDesc, actual.MessageDesc); + } + + + internal static void VerifyStatusSparse(Status expected, Status actual) + { + Assert.AreEqual(expected.StateCode, actual.StateCode); + Assert.AreEqual(expected.StateDesc, actual.StateDesc); + } + + internal static void VerifySyncActivity(SyncActivity expected, SyncActivity actual) + { + //Assert.AreEqual(expected.LatestUploadDateTime, actual.LatestUploadDateTime); + //Assert.AreEqual(expected.LatestUploadDateTimeSpecified, actual.LatestUploadDateTimeSpecified); + //Assert.AreEqual(expected.LatestWriteBackDateTime, actual.LatestWriteBackDateTime); + //Assert.AreEqual(expected.LatestWriteBackDateTimeSpecified, actual.LatestWriteBackDateTimeSpecified); + //Assert.AreEqual(expected.SyncTypeSpecified, actual.SyncTypeSpecified); + Assert.AreEqual(expected.StartSyncTMS, actual.StartSyncTMS); + Assert.AreEqual(expected.StartSyncTMSSpecified, actual.StartSyncTMSSpecified); + Assert.AreEqual(expected.EndSyncTMS, actual.EndSyncTMS); + Assert.AreEqual(expected.EndSyncTMSSpecified, actual.EndSyncTMSSpecified); + Assert.AreEqual(expected.EntityName, actual.EntityName); + //Assert.AreEqual(expected.EntityRowCount, actual.EntityRowCount); + //Assert.AreEqual(expected.EntityRowCountSpecified, actual.EntityRowCountSpecified); + } + + + internal static void VerifySyncActivitySparse(SyncActivity expected, SyncActivity actual) + { + Assert.AreEqual(expected.EntityName, actual.EntityName); + } + + #endregion + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/UserInformation.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/UserInformation.cs new file mode 100644 index 0000000..7a82f97 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/UserInformation.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Intuit.Ipp.Test +{ + /// + /// User Information + /// + internal class UserInformation + { + /// + /// Gets or sets the email. + /// + /// + /// The email. + /// + internal string Email { get; set; } + + /// + /// Gets or sets the user id. + /// + /// + /// The user id. + /// + internal string UserId { get; set; } + + /// + /// Gets or sets the role id. + /// + /// + /// The role id. + /// + internal string RoleId { get; set; } + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj new file mode 100644 index 0000000..e60a1ff --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj @@ -0,0 +1,58 @@ + + + + netcoreapp2.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + PreserveNewest + + + PreserveNewest + + + + + + \ No newline at end of file diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.xml b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.xml new file mode 100644 index 0000000..98221f0 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.xml @@ -0,0 +1,37 @@ + + + + Intuit.Ipp.Test + + + + + User Information + + + + + Gets or sets the email. + + + The email. + + + + + Gets or sets the user id. + + + The user id. + + + + + Gets or sets the role id. + + + The role id. + + + + diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/Platform/PlatformApi.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/Platform/PlatformApi.cs new file mode 100644 index 0000000..bd1d8ad --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/Platform/PlatformApi.cs @@ -0,0 +1,238 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.Platform +{ + [TestClass][Ignore] + public class PlatformApi + { + ServiceContext qboContextOAuth = null; + string ValidAccessToken = "qyprdjjV5yb5YlzBGBo3fOesZ8WG3POL83PFg77UFkrVRat6"; + string ValidAccessTokenSecret = "BhL29aQD7k1HyJyFXWP8HrDzBNnVa8YtuZsxtX4l"; + string ValidConsumerKey = "qyprd68jMGebyWgiNFT411r4KnhmB9"; + string ValidConsumerSecret = "j2QGgFRv5yYMXB5lVXUI0NBPlHAmz0drjANG1KeX"; + + string InvalidAccessToken = "lvprdS0vcMp3lHlNirwpsWrsHnmjh0pLbDpK6WCXGtySTx61"; + string InvalidAccessTokenSecret = "wAhzfEhOCjtWBoza2xAPG2Ey1BV599lLd1y92ytl"; + + string realmIAQBO = "123145693359857"; + + + [TestInitialize] + public void MyTestInitializer() + { + // OAuthRequestValidator oAuthRequestValidatorQbo = new OAuthRequestValidator(ValidAccessToken, ValidAccessTokenSecret,ValidConsumerKey, ValidConsumerSecret); + OAuth2RequestValidator oAuthRequestValidatorQbo = new OAuth2RequestValidator(ValidAccessToken); + qboContextOAuth = new ServiceContext(realmIAQBO, IntuitServicesType.QBO, oAuthRequestValidatorQbo); + } + + + + + #region PlatformDisconnect + + public void PlatformDisconnectValidOauth(String oauthtoken,String oauthtokensecret) + { + //try + //{ + // PlatformService.PlatformService.Disconnect(ValidConsumerKey, ValidConsumerSecret, + // oauthtoken, oauthtokensecret); + //} + //catch (PlatformException pex) + //{ + // Console.WriteLine("PlatformDisconnect throw PlatformException errCode:" + pex.ErrorCode + " errMsg:" + pex.ErrorMessage + " serverTime:" + pex.ServerTime); + // Assert.Fail(); + //} + + //OAuthRequestValidator ioAuthRequestValidatorQbo = new OAuthRequestValidator(oauthtoken, oauthtokensecret, ValidConsumerKey, ValidConsumerSecret); + OAuth2RequestValidator ioAuthRequestValidatorQbo = new OAuth2RequestValidator(ValidAccessToken); + ServiceContext iqboContextOAuth = new ServiceContext(realmIAQBO, IntuitServicesType.QBO, ioAuthRequestValidatorQbo); + Customer customer = QBOHelper.CreateCustomer(iqboContextOAuth); + try + { + Customer added = Helper.Add(iqboContextOAuth, customer); + } + catch (InvalidTokenException e) + { + Assert.AreEqual("Unauthorized-401", e.Message); + return; + } + Assert.Fail(); + } + + + [TestMethod] + public void PlatformDisconnectInvalidOauth() + { + //try + //{ + // PlatformService.PlatformService.Disconnect(ValidConsumerKey, ValidConsumerSecret, + // InvalidAccessToken, InvalidAccessTokenSecret); + //} + //catch (PlatformException pex) + //{ + // Assert.AreEqual("270", pex.ErrorCode); + // Assert.AreEqual("OAuth Token rejected", pex.ErrorMessage); + // Assert.IsNotNull(pex.ServerTime); + // return; + //} + Assert.Fail(); + } + + #endregion + + #region Reconnect + + //Steps to enable this test + // 1. Go to https://appcenter.intuit.com/Playground/OAuth/IA/ generate Access token which expiration date without 30 dats from current date + // 2. Remove Ignore + [TestMethod] + [Ignore] + public void PlatformReconnectValidOauth() + { + //try + //{ + // String oauthtoken = null; ; + // String oauthtokensecret = null; + + // Dictionary oauthTokens = PlatformService.PlatformService.Reconnect(ValidConsumerKey, ValidConsumerSecret, + // "lvprdkyvvpOSwdI8ufHlYb1IpWp8RpjAv8lZ7KK0H9jiVsFo", "gQBx9lR3F4Iwm42ir3n3zxIM75KxI7wuiC5o7oKr"); + // if (oauthTokens.ContainsKey("OAuthToken")) + // { + // oauthtoken = oauthTokens["OAuthToken"]; + // Assert.IsNotNull(oauthtoken); + // } + + // // See whether Dictionary contains this string. + // if (oauthTokens.ContainsKey("OAuthTokenSecret")) + // { + // oauthtokensecret = oauthTokens["OAuthTokenSecret"]; + // Assert.IsNotNull(oauthtokensecret); + // } + // PlatformDisconnectValidOauth(oauthtoken,oauthtokensecret); + //} + //catch (PlatformException pex) + //{ + // Console.WriteLine("PlatformReconnect throw exception. Error Code" +pex.ErrorCode + ", Error Message:"+pex.ErrorMessage); + // Assert.Fail(); + //} + + } + + //Steps To enable this test + // 1. Generate a New Access Token which expiration date more than 30 days from current date + // 2. Remove Ignore + [TestMethod] + [Ignore] + public void PlatformReconnectValidOauth212() + { + //try + //{ + + // Dictionary oauthTokens = PlatformService.PlatformService.Reconnect(ValidConsumerKey, ValidConsumerSecret, + // "lvprdYXHs7Xc95g70D5UFX9mWSShDhepkCWvr95tb19SUIPD", "zdy5xPim4viFTNuBTu0c2IqJCRhJUSXTuNr3fXoR"); + //} + //catch (PlatformException pex) + //{ + // Assert.AreEqual("212", pex.ErrorCode); + // Assert.AreEqual("Token Refresh Window Out of Bounds", pex.ErrorMessage); + // Assert.IsNotNull(pex.ServerTime); + // return; + //} + Assert.Fail(); + + } + + [TestMethod] + public void PlatformReconnectInvalidOauth270() + { + //try + //{ + // PlatformService.PlatformService.Reconnect(ValidConsumerKey, ValidConsumerSecret, + // InvalidAccessToken, InvalidAccessTokenSecret); + //} + //catch (PlatformException pex) + //{ + // Assert.AreEqual("270", pex.ErrorCode); + // Assert.AreEqual("OAuth Token rejected", pex.ErrorMessage); + // Assert.IsNotNull(pex.ServerTime); + // return; + //} + Assert.Fail(); + } + + + #endregion + + #region getCurrentUser + + [TestMethod] + [Ignore] + public void PlatformGetCurrentUserWithValidOauth() + { + //Intuit.Ipp.PlatformService.User myuser=PlatformService.PlatformService.GetCurrentUser(ValidConsumerKey, ValidConsumerSecret, + // ValidAccessToken,ValidAccessTokenSecret); + //Assert.AreEqual("yelena", myuser.FirstName); + //Assert.AreEqual("gartsman", myuser.LastName); + //Assert.AreEqual("yelenastage@intuit.com", myuser.EmailAddress); + //Assert.IsTrue(myuser.IsVerified); + } + + [TestMethod] + public void PlatformGetCurrentUserWithInvalidOauth() + { + //try + //{ + // Intuit.Ipp.PlatformService.User myuser = PlatformService.PlatformService.GetCurrentUser(ValidConsumerKey, ValidConsumerSecret, + // InvalidAccessToken, InvalidAccessTokenSecret); + //} + //catch (PlatformException pex) + //{ + // Assert.AreEqual("22", pex.ErrorCode); + // Assert.AreEqual("This API requires Authorization.", pex.ErrorMessage); + // Assert.IsNotNull(pex.ServerTime); + // return; + //} + Assert.Fail(); + } + + //Change Intuit.Ipp.PlatformService.PlatformConfig.currentUserUrl URL and run this test + [Ignore] + [TestMethod] + public void PlatformGetCurrentUserWithConenctionError() + { + //try + //{ + // Intuit.Ipp.PlatformService.User myuser = PlatformService.PlatformService.GetCurrentUser(ValidConsumerKey, ValidConsumerSecret, + // ValidAccessToken, ValidAccessTokenSecret); + //} + //catch (PlatformException pex) + //{ + // Console.Write(pex.ErrorCode + pex.ErrorMessage); + // Assert.AreEqual("ConnectFailure", pex.ErrorCode); + // Assert.AreEqual("Unable to connect to the remote server", pex.ErrorMessage); + // return; + //} + Assert.Fail(); + } + + + + #endregion + + + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Account.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Account.cs new file mode 100644 index 0000000..00198bd --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Account.cs @@ -0,0 +1,375 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; +using Intuit.Ipp.QueryFilter; + + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class AccountTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void AddBankAccountTestUsingoAuth() + { + //Creating the Account for Add + Account account = QBOHelper.CreateAccount(qboContextoAuth, AccountTypeEnum.Bank, AccountClassificationEnum.Asset); + //Adding the Account + Account added = Helper.Add(qboContextoAuth, account); + //Verify the added Account + QBOHelper.VerifyAccount(account, added); + } + + + [TestMethod] + public void AddCreditCardAccountTestUsingoAuth() + { + //Creating the Account for Add + Account account = QBOHelper.CreateAccount(qboContextoAuth, AccountTypeEnum.CreditCard, AccountClassificationEnum.Liability); + //Adding the Account + Account added = Helper.Add(qboContextoAuth, account); + //Verify the added Account + QBOHelper.VerifyAccount(account, added); + } + + [TestMethod] [Ignore] //TestComment: Test if entity type is not supported + public void AddEquityBankAccountTestUsingoAuth() + { + //Creating the Account for Add + Account account = QBOHelper.CreateAccount(qboContextoAuth, AccountTypeEnum.Equity, AccountClassificationEnum.Equity); + //Adding the Account + Account added = Helper.Add(qboContextoAuth, account); + //Verify the added Account + QBOHelper.VerifyAccount(account, added); + } + + [TestMethod] + public void AddExpenseAccountTestUsingoAuth() + { + //Creating the Account for Add + Account account = QBOHelper.CreateAccount(qboContextoAuth, AccountTypeEnum.Expense, AccountClassificationEnum.Expense); + //Adding the Account + Account added = Helper.Add(qboContextoAuth, account); + //Verify the added Account + QBOHelper.VerifyAccount(account, added); + } + + + [TestMethod][Ignore] + public void AddAccountWithAccAliasTestUsingoAuthFrance() + { + //Creating the Account for Add + // Account account = QBOHelper.CreateAccount(qboContextoAuth, AccountTypeEnum.Expense, AccountClassificationEnum.Expense); + Account account = QBOHelper.CreateAccountFrance(qboContextoAuth, AccountTypeEnum.Expense, AccountClassificationEnum.Expense); + //Adding the Account + Account added = Helper.Add(qboContextoAuth, account); + //Verify the added Account + // QBOHelper.VerifyAccount(account, added); + QBOHelper.VerifyAccountFrance(account, added); + } + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void AccountFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + AddBankAccountTestUsingoAuth(); + + //Retrieving the Account using FindAll + List accounts = Helper.FindAll(qboContextoAuth, new Account(), 1, 500); + Assert.IsNotNull(accounts); + Assert.IsTrue(accounts.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void AccountFindbyIdTestUsingoAuth() + { + //Creating the Account for Adding + Account account = QBOHelper.CreateAccount(qboContextoAuth, AccountTypeEnum.Bank, AccountClassificationEnum.Asset); + //Adding the Account + Account added = Helper.Add(qboContextoAuth, account); + Account found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyAccount(found, added); + } + + [TestMethod] + [ExpectedException(typeof(IdsException))] + public void AccountFindbyInvalidIdTestUsingoAuth() + { + Account added = new Account() { Id = "100000" }; + Account found = Helper.FindById(qboContextoAuth, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void AccountUpdateTestUsingoAuth() + { + //Creating the Account for Adding + Account account = QBOHelper.CreateAccount(qboContextoAuth, AccountTypeEnum.Bank, AccountClassificationEnum.Asset); + //Adding the Account + Account added = Helper.Add(qboContextoAuth, account); + //Change the data of added entity + Account changed = QBOHelper.UpdateAccount(qboContextoAuth, added); + //Update the returned entity data + Account updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Account + QBOHelper.VerifyAccount(changed, updated); + } + + [TestMethod] + public void AccountSparseUpdateTestUsingoAuth() + { + //Creating the Account for Adding + Account account = QBOHelper.CreateAccount(qboContextoAuth, AccountTypeEnum.Bank, AccountClassificationEnum.Asset); + //Adding the Account + Account added = Helper.Add(qboContextoAuth, account); + //Change the data of added entity + Account changed = QBOHelper.SparseUpdateAccount(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + Account updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Account + QBOHelper.VerifyAccountSparseUpdate(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] [Ignore] //TestComment: Returns Operation Not Supported: DevKit tracker Item #150 + public void AccountDeleteTestUsingoAuth() + { + //Creating the Account for Adding + Account account = QBOHelper.CreateAccount(qboContextoAuth, AccountTypeEnum.Bank, AccountClassificationEnum.Asset); + //Adding the Account + Account added = Helper.Add(qboContextoAuth, account); + //Delete the returned entity + try + { + Account deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] [Ignore] + public void AccountVoidTestUsingoAuth() + { + //Creating the Account for Adding + Account account = QBOHelper.CreateAccount(qboContextoAuth, AccountTypeEnum.Bank, AccountClassificationEnum.Asset); + //Adding the Account + Account added = Helper.Add(qboContextoAuth, account); + //Void the returned entity + try + { + Account voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void AccountCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + AddBankAccountTestUsingoAuth(); + + //Retrieving the Entity using FindAll + List entities = Helper.CDC(qboContextoAuth, new Account(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void AccountBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + Account existing = Helper.FindOrAdd(qboContextoAuth, new Account()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateAccount(qboContextoAuth, AccountTypeEnum.Bank, AccountClassificationEnum.Asset)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateAccount(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from Account"); + + //IgnoreReason: Not Supported in v67 + //batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as Account).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void AccountQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + Account existing = Helper.FindOrAddAccount(qboContextoAuth, AccountTypeEnum.Bank, AccountClassificationEnum.Expense); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM Account where Id='" + existing.Id + "'").ToList(); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void AccountAddAsyncTestsUsingoAuth() + { + //Creating the Account for Add + Account entity = QBOHelper.CreateAccount(qboContextoAuth, AccountTypeEnum.Bank, AccountClassificationEnum.Expense); + + Account added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyAccount(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void AccountRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + //AddBankAccountTestUsingoAuth(); + + //Retrieving the Account using FindAll + Helper.FindAllAsync(qboContextoAuth, new Account()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void AccountFindByIdAsyncTestsUsingoAuth() + { + //Creating the Account for Adding + Account entity = QBOHelper.CreateAccount(qboContextoAuth, AccountTypeEnum.Bank, AccountClassificationEnum.Expense); + //Adding the Account + Account added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void AccountUpdatedAsyncTestsUsingoAuth() + { + //Creating the Account for Adding + Account entity = QBOHelper.CreateAccount(qboContextoAuth, AccountTypeEnum.Bank, AccountClassificationEnum.Expense); + //Adding the Account + Account added = Helper.Add(qboContextoAuth, entity); + + //Update the Account + Account updated = QBOHelper.UpdateAccount(qboContextoAuth, added); + //Call the service + Account updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated Account + QBOHelper.VerifyAccount(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] [Ignore] //TestComment: Returns Operation Not Supported: DevKit tracker Item #150 + public void AccountDeleteAsyncTestsUsingoAuth() + { + //Creating the Account for Adding + Account entity = QBOHelper.CreateAccount(qboContextoAuth, AccountTypeEnum.Bank, AccountClassificationEnum.Expense); + //Adding the Account + Account added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Attachable.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Attachable.cs new file mode 100644 index 0000000..ee816ce --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Attachable.cs @@ -0,0 +1,370 @@ +using System; +using System.IO; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; +using Intuit.Ipp.QueryFilter; + + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class AttachableTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void AttachableAddTestUsingoAuth() + { + //Creating the Attachable for Add + Attachable attachable = QBOHelper.CreateAttachable(qboContextoAuth); + //Adding the Attachable + Attachable added = Helper.Add(qboContextoAuth, attachable); + //Verify the added Attachable + QBOHelper.VerifyAttachable(attachable, added); + } + + [DeploymentItem("Services\\Resource\\image.jpg", "Services\\Resource")] + [TestMethod] + public void AttachableUploadDownloadAddTestUsingoAuth() + { + //Creating the Bill for Add + + string imagePath = string.Concat(AppDomain.CurrentDomain.BaseDirectory, "\\", "Services\\Resource\\image.jpg"); + System.IO.FileInfo file = new System.IO.FileInfo(imagePath); + Attachable attachable = QBOHelper.CreateAttachableUpload(qboContextoAuth); + using (System.IO.FileStream fs = file.OpenRead()) + { + attachable.ContentType = "image/jpeg"; + attachable.FileName = file.Name; + attachable = Helper.Upload(qboContextoAuth, attachable, fs); + } + + byte[] uploadedByte = null; + using (System.IO.FileStream fs = file.OpenRead()) + { + using (BinaryReader binaryReader = new BinaryReader(fs)) + { + uploadedByte = binaryReader.ReadBytes((int) fs.Length); + } + } + + //Verify the added Attachable + Assert.IsNotNull(attachable.Id); + + byte[] responseByte = Helper.Download(qboContextoAuth, attachable); + + for(int i=0; i attachables = Helper.FindAll(qboContextoAuth, new Attachable(), 1, 500); + Assert.IsNotNull(attachables); + Assert.IsTrue(attachables.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void AttachableFindbyIdTestUsingoAuth() + { + //Creating the Attachable for Adding + Attachable attachable = QBOHelper.CreateAttachable(qboContextoAuth); + //Adding the Attachable + Attachable added = Helper.Add(qboContextoAuth, attachable); + Attachable found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyAttachable(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void AttachableUpdateTestUsingoAuth() + { + //Creating the Attachable for Adding + Attachable attachable = QBOHelper.CreateAttachable(qboContextoAuth); + //Adding the Attachable + Attachable added = Helper.Add(qboContextoAuth, attachable); + //Change the data of added entity + Attachable changed = QBOHelper.UpdateAttachable(qboContextoAuth, added); + //Update the returned entity data + Attachable updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Attachable + QBOHelper.VerifyAttachable(changed, updated); + } + + [TestMethod] + public void AttachableSparseUpdateTestUsingoAuth() + { + //Creating the Attachable for Adding + Attachable attachable = QBOHelper.CreateAttachable(qboContextoAuth); + //Adding the Attachable + Attachable added = Helper.Add(qboContextoAuth, attachable); + //Change the data of added entity + Attachable changed = QBOHelper.SparseUpdateAttachable(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + Attachable updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Attachable + QBOHelper.VerifyAttachableSparseUpdate(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void AttachableDeleteTestUsingoAuth() + { + //Creating the Attachable for Adding + Attachable attachable = QBOHelper.CreateAttachable(qboContextoAuth); + //Adding the Attachable + Attachable added = Helper.Add(qboContextoAuth, attachable); + //Delete the returned entity + try + { + Attachable deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] [Ignore] + public void AttachableVoidTestUsingoAuth() + { + //Creating the Attachable for Adding + Attachable attachable = QBOHelper.CreateAttachable(qboContextoAuth); + //Adding the Attachable + Attachable added = Helper.Add(qboContextoAuth, attachable); + //Delete the returned entity + try + { + Attachable voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void AttachableCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + AttachableAddTestUsingoAuth(); + + //Retrieving the Attachable using CDC + List entities = Helper.CDC(qboContextoAuth, new Attachable(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void AttachableBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + Attachable existing = Helper.FindOrAdd(qboContextoAuth, new Attachable()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateAttachable(qboContextoAuth)); + + //batchEntries.Add(OperationEnum.update, QBOHelper.UpdateAttachable(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from Attachable"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as Attachable).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void AttachableQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + Attachable existing = Helper.FindOrAdd(qboContextoAuth, new Attachable()); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM Attachable where Id='" + existing.Id + "'").ToList(); + + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void AttachableAddAsyncTestsUsingoAuth() + { + //Creating the Attachable for Add + Attachable entity = QBOHelper.CreateAttachable(qboContextoAuth); + + Attachable added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyAttachable(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void AttachableRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + AttachableAddTestUsingoAuth(); + + //Retrieving the Attachable using FindAll + Helper.FindAllAsync(qboContextoAuth, new Attachable()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void AttachableFindByIdAsyncTestsUsingoAuth() + { + //Creating the Attachable for Adding + Attachable entity = QBOHelper.CreateAttachable(qboContextoAuth); + //Adding the Attachable + Attachable added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void AttachableUpdatedAsyncTestsUsingoAuth() + { + //Creating the Attachable for Adding + Attachable entity = QBOHelper.CreateAttachable(qboContextoAuth); + //Adding the Attachable + Attachable added = Helper.Add(qboContextoAuth, entity); + + //Update the Attachable + Attachable updated = QBOHelper.UpdateAttachable(qboContextoAuth, added); + //Call the service + Attachable updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated Attachable + QBOHelper.VerifyAttachable(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void AttachableDeleteAsyncTestsUsingoAuth() + { + //Creating the Attachable for Adding + Attachable entity = QBOHelper.CreateAttachable(qboContextoAuth); + //Adding the Attachable + Attachable added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] [Ignore] + public void AttachableVoidAsyncTestsUsingoAuth() + { + //Creating the Attachable for Adding + Attachable entity = QBOHelper.CreateAttachable(qboContextoAuth); + //Adding the Attachable + Attachable added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/BatchProcessingTests.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/BatchProcessingTests.cs new file mode 100644 index 0000000..4e542c3 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/BatchProcessingTests.cs @@ -0,0 +1,207 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.DataService; +using Intuit.Ipp.QueryFilter; + +using System.Configuration; + +namespace Intuit.Ipp.Test.QBO +{ + [TestClass][Ignore]// Incorrect format + public class BatchProcessingTests + { + + [TestMethod] + public void BatchIncludeTest() + { + + ServiceContext context = Initializer.InitializeQBOServiceContextUsingoAuth(); + DataService.DataService service = new DataService.DataService(context); + + DataService.Batch batch = service.CreateNewBatch(); + List optionsData = new List(); + optionsData.Add("firsttxndate"); + + batch.Add("Select * From CompanyInfo", "QueryCo", optionsData); + batch.Execute(); + + bool receivedIncludeParameter = false; + IntuitBatchResponse queryCompanyResponse = batch["QueryCo"]; + if (queryCompanyResponse.ResponseType == ResponseType.Query) + { + CompanyInfo companyInfo = queryCompanyResponse.Entities[0] as CompanyInfo; + foreach (NameValue nameValue in companyInfo.NameValue) + { + receivedIncludeParameter = nameValue.Name == "firsttxndate"; + if (receivedIncludeParameter) { break; } + } + + } + if (!receivedIncludeParameter) { Assert.Fail("CompanyInfo not returned"); } + } + + [TestMethod] + public void BatchInvoiceTest() + { + ServiceContext context = Initializer.InitializeQBOServiceContextUsingoAuth(); + DataService.DataService service = new DataService.DataService(context); + List addedInvoiceList = new List(); + List newInvoiceList = new List(); + for (int i = 0; i < 5; i++) + { + Invoice invoice = QBOHelper.CreateInvoice(context); + addedInvoiceList.Add(service.Add(invoice)); + } + + for (int i = 0; i < 5; i++) + { + newInvoiceList.Add(QBOHelper.CreateInvoice(context)); + } + + QueryService invoiceContext = new QueryService(context); + + DataService.Batch batch = service.CreateNewBatch(); + + int count = 1; + foreach (Invoice invoice in newInvoiceList) + { + batch.Add(invoice, "AddInvoice" + count, OperationEnum.create); + count++; + } + + count = 0; + + List docNumbers = new List(); + foreach (Invoice invoice in addedInvoiceList) + { + invoice.DocNumber = "SUDoc" + Guid.NewGuid().ToString().Substring(0, 6); + docNumbers.Add(invoice.DocNumber); + invoice.sparse = true; + invoice.sparseSpecified = true; + invoice.TxnTaxDetail = null; + batch.Add(invoice, "UpdateInvoice" + count, OperationEnum.update); + count++; + } + + string[] values = docNumbers.ToArray(); + + batch.Add(invoiceContext.ExecuteIdsQuery("Select * from invoice where DocNumber.In('"+values+"')").ToString(), "QueryInvoice1"); + batch.Execute(); + + int position = 0; + foreach (IntuitBatchResponse resp in batch.IntuitBatchItemResponses) + { + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (position <= 4) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as Invoice).Id)); + } + + if (position > 4 && position < 10) + { + Assert.IsTrue(((Invoice)resp.Entity).DocNumber.Contains("SUDoc")); + } + + if (position == 10) + { + Assert.IsTrue(resp.Entities.Count == 5); + } + + position++; + } + } + + [TestMethod] + public void BatchEntityTest() + { + ServiceContext context = Initializer.InitializeQBOServiceContextUsingoAuth(); + DataService.DataService service = new DataService.DataService(context); + + Customer customer = CreateCustomer(); + Customer addedCustomer = service.Add(customer); + + Invoice invoice = QBOHelper.CreateInvoice(context); + + QueryService termContext = new QueryService(context); + + QueryService taxRateContext = new QueryService(context); + QueryService taxCodeContext = new QueryService(context); + QueryService itemContext = new QueryService(context); + + DataService.Batch batch = service.CreateNewBatch(); + batch.Add(addedCustomer, "UpdateCustomer", OperationEnum.update); + batch.Add(invoice, "AddInvoice", OperationEnum.create); + batch.Add(termContext.ExecuteIdsQuery("Select * from term").ToString(), "QueryTerm"); + batch.Add(taxRateContext.ExecuteIdsQuery("Select * from taxrate").ToString(), "QueryTaxRate"); + batch.Add(taxCodeContext.ExecuteIdsQuery("Select * from taxcode").ToString(), "QueryTaxCode"); + batch.Add(itemContext.ExecuteIdsQuery("Select * from item").ToString(), "QueryItem"); + + batch.Execute(); + foreach (IntuitBatchResponse resp in batch.IntuitBatchItemResponses) + { + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + } + } + + + #region Helper methods + + private Customer CreateCustomer() + { + Customer newCustomer = new Customer(); + string guid = Guid.NewGuid().ToString("N"); + + //Mandatory Fields + + newCustomer.DisplayName = "Disp" + guid.Substring(0, 25); + newCustomer.Title = "Title" + guid.Substring(0, 7); + newCustomer.DisplayName = "DN" + guid.Substring(0, 20); + + newCustomer.MiddleName = "M" + guid.Substring(0, 4); + newCustomer.FamilyName = "FN" + guid.Substring(0, 20); + newCustomer.Taxable = true; + newCustomer.TaxableSpecified = true; + + return newCustomer; + } + + + //internal static Invoice CreateInvoice(ServiceContext context) + //{ + // List customers = FindAllHelper(context, new Customer(), 1, 10); + // Assert.IsTrue(customers.Count > 0); + // List taxCodes = FindAllHelper(context, new TaxCode(), 1, 10); + + + // Assert.IsTrue(taxCodes.Count > 0); + // Invoice newInvoice = new Invoice(); + // newInvoice.DocNumber = Guid.NewGuid().ToString("N").Substring(0, 10); + // newInvoice.TxnDate = DateTime.Today.Date; + // newInvoice.TxnDateSpecified = true; + // newInvoice.CustomerRef = new ReferenceType() { type = Enum.GetName(typeof(objectNameEnumType), objectNameEnumType.Customer), name = customers[0].GivenName, Value = customers[0].Id/*, typeSpecified=true */ }; + // newInvoice.ARAccountRef = new ReferenceType() { type = Enum.GetName(typeof(objectNameEnumType), objectNameEnumType.Account), name = "Account Receivable", Value = "QB:37"/*, typeSpecified=true */ }; + // newInvoice.TxnTaxDetail = new TxnTaxDetail() { TotalTax = 0, DefaultTaxCodeRef = new ReferenceType() { Value = taxCodes[0].Id, type = Enum.GetName(typeof(objectNameEnumType), objectNameEnumType.Customer),/* typeSpecified=true,*/ name = taxCodes[0].Name } }; + // Line invLine = new Line(); + + // invLine.Amount = 10000; + // invLine.DetailType = LineDetailTypeEnum.DescriptionOnly; + // invLine.AmountSpecified = true; + // invLine.Description = "Desc Invoice"; + // newInvoice.Line = new Line[] { invLine }; + // return newInvoice; + //} + #endregion + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Bill.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Bill.cs new file mode 100644 index 0000000..73cdcf6 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Bill.cs @@ -0,0 +1,350 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class BillTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void BillAddTestUsingoAuth() + { + //Creating the Bill for Add + Bill bill = QBOHelper.CreateBill(qboContextoAuth); + //Adding the Bill + Bill added = Helper.Add(qboContextoAuth, bill); + //Verify the added Bill + QBOHelper.VerifyBill(bill, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void BillFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + BillAddTestUsingoAuth(); + + //Retrieving the Bill using FindAll + List bills = Helper.FindAll(qboContextoAuth, new Bill(), 1, 500); + Assert.IsNotNull(bills); + Assert.IsTrue(bills.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void BillFindbyIdTestUsingoAuth() + { + //Creating the Bill for Adding + Bill bill = QBOHelper.CreateBill(qboContextoAuth); + //Adding the Bill + Bill added = Helper.Add(qboContextoAuth, bill); + Bill found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyBill(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void BillUpdateTestUsingoAuth() + { + //Creating the Bill for Adding + Bill bill = QBOHelper.CreateBill(qboContextoAuth); + //Adding the Bill + Bill added = Helper.Add(qboContextoAuth, bill); + //Change the data of added entity + Bill changed = QBOHelper.UpdateBill(qboContextoAuth, added); + //Update the returned entity data + Bill updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Bill + QBOHelper.VerifyBill(changed, updated); + } + + [TestMethod] + public void BillSparseUpdateTestUsingoAuth() + { + //Creating the Bill for Adding + Bill bill = QBOHelper.CreateBill(qboContextoAuth); + //Adding the Bill + Bill added = Helper.Add(qboContextoAuth, bill); + //Change the data of added entity + Bill changed = QBOHelper.UpdateBillSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + Bill updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Bill + QBOHelper.VerifyBillSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void BillDeleteTestUsingoAuth() + { + //Creating the Bill for Adding + Bill bill = QBOHelper.CreateBill(qboContextoAuth); + //Adding the Bill + Bill added = Helper.Add(qboContextoAuth, bill); + //Delete the returned entity + try + { + Bill deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] [Ignore] + public void BillVoidTestUsingoAuth() + { + //Creating the entity for Adding + Bill entity = QBOHelper.CreateBill(qboContextoAuth); + //Adding the entity + Bill added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + Bill voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void BillCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + BillAddTestUsingoAuth(); + + //Retrieving the Bill using CDC + List entities = Helper.CDC(qboContextoAuth, new Bill(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void BillBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + Bill existing = Helper.FindOrAdd(qboContextoAuth, new Bill()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateBill(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateBill(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from Bill"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as Bill).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void BillQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + Bill existing = Helper.FindOrAdd(qboContextoAuth, new Bill()); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM Bill where Id='" + existing.Id + "'").ToList(); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void BillAddAsyncTestsUsingoAuth() + { + //Creating the Bill for Add + Bill entity = QBOHelper.CreateBill(qboContextoAuth); + + Bill added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyBill(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void BillRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + BillAddTestUsingoAuth(); + + //Retrieving the Bill using FindAll + Helper.FindAllAsync(qboContextoAuth, new Bill()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void BillFindByIdAsyncTestsUsingoAuth() + { + //Creating the Bill for Adding + Bill entity = QBOHelper.CreateBill(qboContextoAuth); + //Adding the Bill + Bill added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void BillUpdatedAsyncTestsUsingoAuth() + { + //Creating the Bill for Adding + Bill entity = QBOHelper.CreateBill(qboContextoAuth); + //Adding the Bill + Bill added = Helper.Add(qboContextoAuth, entity); + + //Update the Bill + Bill updated = QBOHelper.UpdateBill(qboContextoAuth, added); + //Call the service + Bill updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated Bill + QBOHelper.VerifyBill(updated, updatedReturned); + } + + [TestMethod] + public void BillSparseUpdatedAsyncTestsUsingoAuth() + { + //Creating the Bill for Adding + Bill entity = QBOHelper.CreateBill(qboContextoAuth); + //Adding the Bill + Bill added = Helper.Add(qboContextoAuth, entity); + + //Update the Bill + Bill updated = QBOHelper.UpdateBillSparse(qboContextoAuth, added.Id, added.SyncToken); + //Call the service + Bill updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated Bill + QBOHelper.VerifyBillSparse(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void BillDeleteAsyncTestsUsingoAuth() + { + //Creating the Bill for Adding + Bill entity = QBOHelper.CreateBill(qboContextoAuth); + //Adding the Bill + Bill added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] [Ignore] + public void BillVoidAsyncTestsUsingoAuth() + { + //Creating the Bill for Adding + Bill entity = QBOHelper.CreateBill(qboContextoAuth); + //Adding the Bill + Bill added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/BillPayment.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/BillPayment.cs new file mode 100644 index 0000000..c64b488 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/BillPayment.cs @@ -0,0 +1,347 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class BillPaymentTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void BillPaymentCheckAddTestUsingoAuth() + { + //Creating the BillPayment for Add + BillPayment billPayment = QBOHelper.CreateBillPaymentCheck(qboContextoAuth); + //Adding the BillPayment + BillPayment added = Helper.Add(qboContextoAuth, billPayment); + //Verify the added BillPayment + QBOHelper.VerifyBillPayment(billPayment, added); + } + + [TestMethod] + public void BillPaymentCreditCardkAddTestUsingoAuth() + { + //Creating the BillPayment for Add + BillPayment billPayment = QBOHelper.CreateBillPaymentCreditCard(qboContextoAuth); + //Adding the BillPayment + BillPayment added = Helper.Add(qboContextoAuth, billPayment); + //Verify the added BillPayment + QBOHelper.VerifyBillPayment(billPayment, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] //[Ignore] //IgnoreReason: Not Supported + public void BillPaymentFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + BillPaymentCheckAddTestUsingoAuth(); + + //Retrieving the BillPayment using FindAll + List billPayments = Helper.FindAll(qboContextoAuth, new BillPayment(), 1, 500); + Assert.IsNotNull(billPayments); + Assert.IsTrue(billPayments.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void BillPaymentFindbyIdTestUsingoAuth() + { + //Creating the BillPayment for Adding + BillPayment billPayment = QBOHelper.CreateBillPaymentCheck(qboContextoAuth); + //Adding the BillPayment + BillPayment added = Helper.Add(qboContextoAuth, billPayment); + BillPayment found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyBillPayment(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void BillPaymentUpdateTestUsingoAuth() + { + //Creating the BillPayment for Adding + BillPayment billPayment = QBOHelper.CreateBillPaymentCheck(qboContextoAuth); + //Adding the BillPayment + BillPayment added = Helper.Add(qboContextoAuth, billPayment); + //Change the data of added entity + BillPayment changed = QBOHelper.UpdateBillPayment(qboContextoAuth, added); + //Update the returned entity data + BillPayment updated = Helper.Update(qboContextoAuth, changed);//Verify the updated BillPayment + QBOHelper.VerifyBillPayment(changed, updated); + } + + [TestMethod] [Ignore] //IgnoreReason: Not Supported + public void BillPaymentSparseUpdateTestUsingoAuth() + { + //Creating the BillPayment for Adding + BillPayment BillPayment = QBOHelper.CreateBillPaymentCheck(qboContextoAuth); + //Adding the BillPayment + BillPayment added = Helper.Add(qboContextoAuth, BillPayment); + //Change the data of added entity + BillPayment changed = QBOHelper.UpdateBillPaymentSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + BillPayment updated = Helper.Update(qboContextoAuth, changed);//Verify the updated BillPayment + QBOHelper.VerifyBillPaymentSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod]// [Ignore] //IgnoreReason: https://jira.intuit.com/browse/IPP-3289 + public void BillPaymentDeleteTestUsingoAuth() + { + //Creating the BillPayment for Adding + BillPayment billPayment = QBOHelper.CreateBillPaymentCheck(qboContextoAuth); + //Adding the BillPayment + BillPayment added = Helper.Add(qboContextoAuth, billPayment); + //Delete the returned entity + try + { + BillPayment deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] [Ignore] //IgnoreReason: Not supported + public void BillPaymentVoidTestUsingoAuth() + { + //Creating the BillPayment for Adding + BillPayment BillPayment = QBOHelper.CreateBillPaymentCheck(qboContextoAuth); + //Adding the BillPayment + BillPayment added = Helper.Add(qboContextoAuth, BillPayment); + //Void the returned entity + try + { + BillPayment voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] //[Ignore] //IgnoreReason: Not Supported + public void BillPaymentCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + BillPaymentCheckAddTestUsingoAuth(); + + //Retrieving the BillPayment using CDC + List entities = Helper.CDC(qboContextoAuth, new BillPayment(), DateTime.Today.AddDays(-100)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void BillPaymentBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + BillPayment entity = QBOHelper.CreateBillPaymentCheck(qboContextoAuth); + BillPayment existing = Helper.Add(qboContextoAuth, entity); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateBillPaymentCheck(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateBillPayment(qboContextoAuth, existing)); + + //batchEntries.Add(OperationEnum.query, "select * from BillPayment"); + + //batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as BillPayment).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + + [TestMethod] //[Ignore] //IgnoreReason: Not Supported + public void BillPaymentQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + BillPayment existing = Helper.FindOrAdd(qboContextoAuth, new BillPayment()); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM BillPayment where Id='" + existing.Id + "'").ToList(); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void BillPaymentAddAsyncTestsUsingoAuth() + { + //Creating the BillPayment for Add + BillPayment entity = QBOHelper.CreateBillPaymentCheck(qboContextoAuth); + + BillPayment added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyBillPayment(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] //[Ignore] //IgnoreReason: Not supported + public void BillPaymentRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + BillPaymentCheckAddTestUsingoAuth(); + + //Retrieving the BillPayment using FindAll + Helper.FindAllAsync(qboContextoAuth, new BillPayment()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void BillPaymentFindByIdAsyncTestsUsingoAuth() + { + //Creating the BillPayment for Adding + BillPayment entity = QBOHelper.CreateBillPaymentCheck(qboContextoAuth); + //Adding the BillPayment + BillPayment added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void BillPaymentUpdatedAsyncTestsUsingoAuth() + { + //Creating the BillPayment for Adding + BillPayment entity = QBOHelper.CreateBillPaymentCheck(qboContextoAuth); + //Adding the BillPayment + BillPayment added = Helper.Add(qboContextoAuth, entity); + + //Update the BillPayment + BillPayment updated = QBOHelper.UpdateBillPayment(qboContextoAuth, added); + //Call the service + BillPayment updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated BillPayment + QBOHelper.VerifyBillPayment(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] //[Ignore] //IgnoreReason: https://jira.intuit.com/browse/IPP-3289 + public void BillPaymentDeleteAsyncTestsUsingoAuth() + { + //Creating the BillPayment for Adding + BillPayment entity = QBOHelper.CreateBillPaymentCheck(qboContextoAuth); + //Adding the BillPayment + BillPayment added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] [Ignore] //IgnoreReason: Not Supported + public void BillPaymentVoidAsyncTestsUsingoAuth() + { + //Creating the BillPayment for Adding + BillPayment entity = QBOHelper.CreateBillPaymentCheck(qboContextoAuth); + //Adding the BillPayment + BillPayment added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/BooleanTypeCustomFieldDefinition.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/BooleanTypeCustomFieldDefinition.cs new file mode 100644 index 0000000..012cb53 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/BooleanTypeCustomFieldDefinition.cs @@ -0,0 +1,115 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class BooleanTypeCustomFieldDefinitionTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void BooleanTypeCustomFieldDefinitionAddTestUsingoAuth() + { + //Creating the Bill for Add + BooleanTypeCustomFieldDefinition booleanTypeCustomFieldDefinition = QBOHelper.CreateBooleanTypeCustomFieldDefinition(qboContextoAuth); + //Adding the BooleanTypeCustomFieldDefinition + BooleanTypeCustomFieldDefinition added = Helper.Add(qboContextoAuth, booleanTypeCustomFieldDefinition); + //Verify the added BooleanTypeCustomFieldDefinition + QBOHelper.VerifyBooleanTypeCustomFieldDefinition(booleanTypeCustomFieldDefinition, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void BooleanTypeCustomFieldDefinitionFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + BooleanTypeCustomFieldDefinitionAddTestUsingoAuth(); + + //Retrieving the Bill using FindAll + List booleanTypeCustomFieldDefinitions = Helper.FindAll(qboContextoAuth, new BooleanTypeCustomFieldDefinition(), 1, 500); + Assert.IsNotNull(booleanTypeCustomFieldDefinitions); + Assert.IsTrue(booleanTypeCustomFieldDefinitions.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void BooleanTypeCustomFieldDefinitionFindbyIdTestUsingoAuth() + { + //Creating the BooleanTypeCustomFieldDefinition for Adding + BooleanTypeCustomFieldDefinition booleanTypeCustomFieldDefinition = QBOHelper.CreateBooleanTypeCustomFieldDefinition(qboContextoAuth); + //Adding the BooleanTypeCustomFieldDefinition + BooleanTypeCustomFieldDefinition added = Helper.Add(qboContextoAuth, booleanTypeCustomFieldDefinition); + BooleanTypeCustomFieldDefinition found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyBooleanTypeCustomFieldDefinition(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void BooleanTypeCustomFieldDefinitionUpdateTestUsingoAuth() + { + //Creating the BooleanTypeCustomFieldDefinition for Adding + BooleanTypeCustomFieldDefinition booleanTypeCustomFieldDefinition = QBOHelper.CreateBooleanTypeCustomFieldDefinition(qboContextoAuth); + //Adding the BooleanTypeCustomFieldDefinition + BooleanTypeCustomFieldDefinition added = Helper.Add(qboContextoAuth, booleanTypeCustomFieldDefinition); + //Change the data of added entity + QBOHelper.UpdateBooleanTypeCustomFieldDefinition(qboContextoAuth, added); + //Update the returned entity data + BooleanTypeCustomFieldDefinition updated = Helper.Update(qboContextoAuth, added);//Verify the updated BooleanTypeCustomFieldDefinition + QBOHelper.VerifyBooleanTypeCustomFieldDefinition(added, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void BooleanTypeCustomFieldDefinitionDeleteTestUsingoAuth() + { + //Creating the BooleanTypeCustomFieldDefinition for Adding + BooleanTypeCustomFieldDefinition booleanTypeCustomFieldDefinition = QBOHelper.CreateBooleanTypeCustomFieldDefinition(qboContextoAuth); + //Adding the BooleanTypeCustomFieldDefinition + BooleanTypeCustomFieldDefinition added = Helper.Add(qboContextoAuth, booleanTypeCustomFieldDefinition); + //Delete the returned entity + Helper.Delete(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Budget.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Budget.cs new file mode 100644 index 0000000..da1dae2 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Budget.cs @@ -0,0 +1,364 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class BudgetTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + [Ignore] + public void BudgetAddTestUsingoAuth() + { + //Creating the Budget for Add + Budget Budget = QBOHelper.CreateBudget(qboContextoAuth); + //Adding the Budget + Budget added = Helper.Add(qboContextoAuth, Budget); + //Verify the added Budget + QBOHelper.VerifyBudget(Budget, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + [Ignore] + public void BudgetFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + BudgetAddTestUsingoAuth(); + + //Retrieving the Budget using FindAll + List Budgets = Helper.FindAll(qboContextoAuth, new Budget(), 1, 500); + Assert.IsNotNull(Budgets); + Assert.IsTrue(Budgets.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + [Ignore] + public void BudgetFindbyIdTestUsingoAuth() + { + //Creating the Budget for Adding + Budget Budget = QBOHelper.CreateBudget(qboContextoAuth); + //Adding the Budget + Budget added = Helper.Add(qboContextoAuth, Budget); + Budget found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyBudget(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + [Ignore] + public void BudgetUpdateTestUsingoAuth() + { + //Creating the Budget for Adding + Budget Budget = QBOHelper.CreateBudget(qboContextoAuth); + //Adding the Budget + Budget added = Helper.Add(qboContextoAuth, Budget); + //Change the data of added entity + Budget changed = QBOHelper.UpdateBudget(qboContextoAuth, added); + //Update the returned entity data + Budget updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Budget + QBOHelper.VerifyBudget(changed, updated); + } + + [TestMethod] + [Ignore] + public void BudgetSparseUpdateTestUsingoAuth() + { + //Creating the Budget for Adding + Budget Budget = QBOHelper.CreateBudget(qboContextoAuth); + //Adding the Budget + Budget added = Helper.Add(qboContextoAuth, Budget); + //Change the data of added entity + Budget changed = QBOHelper.UpdateBudgetSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + Budget updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Budget + QBOHelper.VerifyBudgetSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + [Ignore] + public void BudgetDeleteTestUsingoAuth() + { + //Creating the Budget for Adding + Budget Budget = QBOHelper.CreateBudget(qboContextoAuth); + //Adding the Budget + Budget added = Helper.Add(qboContextoAuth, Budget); + //Delete the returned entity + try + { + Budget deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + [Ignore] + public void BudgetVoidTestUsingoAuth() + { + //Creating the entity for Adding + Budget entity = QBOHelper.CreateBudget(qboContextoAuth); + //Adding the entity + Budget added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + Budget voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + [Ignore] + public void BudgetCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + BudgetAddTestUsingoAuth(); + + //Retrieving the Budget using CDC + List entities = Helper.CDC(qboContextoAuth, new Budget(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + [Ignore] + public void BudgetBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + Budget existing = Helper.FindOrAdd(qboContextoAuth, new Budget()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateBudget(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateBudget(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from Budget"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as Budget).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void BudgetQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + //Budget existing = Helper.FindOrAdd(qboContextoAuth, new Budget()); + List entities = entityQuery.ExecuteIdsQuery("select * from Budget").ToList(); + Assert.IsTrue(entities.Count() >= 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod][Ignore] + public void BudgetAddAsyncTestsUsingoAuth() + { + //Creating the Budget for Add + Budget entity = QBOHelper.CreateBudget(qboContextoAuth); + + Budget added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyBudget(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + [Ignore] + public void BudgetRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + BudgetAddTestUsingoAuth(); + + //Retrieving the Budget using FindAll + Helper.FindAllAsync(qboContextoAuth, new Budget()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + [Ignore] + public void BudgetFindByIdAsyncTestsUsingoAuth() + { + //Creating the Budget for Adding + Budget entity = QBOHelper.CreateBudget(qboContextoAuth); + //Adding the Budget + Budget added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + [Ignore] + public void BudgetUpdatedAsyncTestsUsingoAuth() + { + //Creating the Budget for Adding + Budget entity = QBOHelper.CreateBudget(qboContextoAuth); + //Adding the Budget + Budget added = Helper.Add(qboContextoAuth, entity); + + //Update the Budget + Budget updated = QBOHelper.UpdateBudget(qboContextoAuth, added); + //Call the service + Budget updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated Budget + QBOHelper.VerifyBudget(updated, updatedReturned); + } + + [TestMethod] + [Ignore] + public void BudgetSparseUpdatedAsyncTestsUsingoAuth() + { + //Creating the Budget for Adding + Budget entity = QBOHelper.CreateBudget(qboContextoAuth); + //Adding the Budget + Budget added = Helper.Add(qboContextoAuth, entity); + + //Update the Budget + Budget updated = QBOHelper.UpdateBudgetSparse(qboContextoAuth, added.Id, added.SyncToken); + //Call the service + Budget updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated Budget + QBOHelper.VerifyBudgetSparse(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + [Ignore] + public void BudgetDeleteAsyncTestsUsingoAuth() + { + //Creating the Budget for Adding + Budget entity = QBOHelper.CreateBudget(qboContextoAuth); + //Adding the Budget + Budget added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] + [Ignore] + public void BudgetVoidAsyncTestsUsingoAuth() + { + //Creating the Budget for Adding + Budget entity = QBOHelper.CreateBudget(qboContextoAuth); + //Adding the Budget + Budget added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Class.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Class.cs new file mode 100644 index 0000000..60b73a7 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Class.cs @@ -0,0 +1,335 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; +using Intuit.Ipp.QueryFilter; + + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class ClassTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void ClassAddTestUsingoAuth() + { + //Creating the Class for Add + Class class1 = QBOHelper.CreateClass(qboContextoAuth); + //Adding the Class + Class added = Helper.Add(qboContextoAuth, class1); + //Verify the added Class + QBOHelper.VerifyClass(class1, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void ClassFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + ClassAddTestUsingoAuth(); + + //Retrieving the Class using FindAll + List classes = Helper.FindAll(qboContextoAuth, new Class(), 1, 500); + Assert.IsNotNull(classes); + Assert.IsTrue(classes.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void ClassFindbyIdTestUsingoAuth() + { + //Creating the Class for Adding + Class class1 = QBOHelper.CreateClass(qboContextoAuth); + //Adding the Class + Class added = Helper.Add(qboContextoAuth, class1); + Class found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyClass(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void ClassUpdateTestUsingoAuth() + { + //Creating the Class for Adding + Class class1 = QBOHelper.CreateClass(qboContextoAuth); + //Adding the Class + Class added = Helper.Add(qboContextoAuth, class1); + //Change the data of added entity + Class changed = QBOHelper.UpdateClass(qboContextoAuth, added); + //Update the returned entity data + Class updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Class + QBOHelper.VerifyClass(changed, updated); + } + + [TestMethod] + public void ClassSparseUpdateTestUsingoAuth() + { + //Creating the Class for Adding + Class class1 = QBOHelper.CreateClass(qboContextoAuth); + //Adding the Class + Class added = Helper.Add(qboContextoAuth, class1); + //Change the data of added entity + Class changed = QBOHelper.SparseUpdateClass(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + Class updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Class + QBOHelper.VerifyClassSparseUpdate(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] [Ignore] //IgnoreReason: http://jira.intuit.com/browse/QBO-11387 + public void ClassDeleteTestUsingoAuth() + { + //Creating the Class for Adding + Class class1 = QBOHelper.CreateClass(qboContextoAuth); + //Adding the Class + Class added = Helper.Add(qboContextoAuth, class1); + //Delete the returned entity + try + { + Class deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] [Ignore] + public void ClassVoidTestUsingoAuth() + { + //Creating the Class for Adding + Class class1 = QBOHelper.CreateClass(qboContextoAuth); + //Adding the Class + Class added = Helper.Add(qboContextoAuth, class1); + //Void the returned entity + try + { + Class voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void ClassCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + ClassAddTestUsingoAuth(); + + //Retrieving the Class using FindAll + List classes = Helper.CDC(qboContextoAuth, new Class(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(classes); + Assert.IsTrue(classes.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void ClassBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + Class existing = Helper.FindOrAdd(qboContextoAuth, new Class()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateClass(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateClass(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from Class"); + + // batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as Class).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void ClassQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + Class existing = Helper.FindOrAdd(qboContextoAuth, new Class()); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM Class where Id='" + existing.Id + "'").ToList(); + + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void ClassAddAsyncTestsUsingoAuth() + { + //Creating the Class for Add + Class entity = QBOHelper.CreateClass(qboContextoAuth); + + Class added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyClass(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void ClassRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + ClassAddTestUsingoAuth(); + + //Retrieving the Class using FindAll + Helper.FindAllAsync(qboContextoAuth, new Class()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void ClassFindByIdAsyncTestsUsingoAuth() + { + //Creating the Class for Adding + Class entity = QBOHelper.CreateClass(qboContextoAuth); + //Adding the Class + Class added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void ClassUpdatedAsyncTestsUsingoAuth() + { + //Creating the Class for Adding + Class entity = QBOHelper.CreateClass(qboContextoAuth); + //Adding the Class + Class added = Helper.Add(qboContextoAuth, entity); + + //Update the Class + Class updated = QBOHelper.UpdateClass(qboContextoAuth, added); + //Call the service + Class updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated Class + QBOHelper.VerifyClass(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] [Ignore] //IgnoreReason: http://jira.intuit.com/browse/QBO-11387 + public void ClassDeleteAsyncTestsUsingoAuth() + { + //Creating the Class for Adding + Class entity = QBOHelper.CreateClass(qboContextoAuth); + //Adding the Class + Class added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] [Ignore] + public void ClassVoidAsyncTestsUsingoAuth() + { + //Creating the Class for Adding + Class entity = QBOHelper.CreateClass(qboContextoAuth); + //Adding the Class + Class added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Company.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Company.cs new file mode 100644 index 0000000..34e103f --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Company.cs @@ -0,0 +1,333 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class CompanyTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void CompanyAddTestUsingoAuth() + { + //Creating the Company for Add + Company company = QBOHelper.CreateCompany(qboContextoAuth); + //Adding the Company + Company added = Helper.Add(qboContextoAuth, company); + //Verify the added Company + QBOHelper.VerifyCompany(company, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void CompanyFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + CompanyAddTestUsingoAuth(); + + //Retrieving the Company using FindAll + List companys = Helper.FindAll(qboContextoAuth, new Company(), 1, 500); + Assert.IsNotNull(companys); + Assert.IsTrue(companys.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void CompanyFindbyIdTestUsingoAuth() + { + //Creating the Company for Adding + Company company = QBOHelper.CreateCompany(qboContextoAuth); + //Adding the Company + Company added = Helper.Add(qboContextoAuth, company); + Company found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyCompany(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void CompanyUpdateTestUsingoAuth() + { + //Creating the Company for Adding + Company company = QBOHelper.CreateCompany(qboContextoAuth); + //Adding the Company + Company added = Helper.Add(qboContextoAuth, company); + //Change the data of added entity + Company changed = QBOHelper.UpdateCompany(qboContextoAuth, added); + //Update the returned entity data + Company updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Company + QBOHelper.VerifyCompany(changed, updated); + } + + [TestMethod] + public void CompanySparseUpdateTestUsingoAuth() + { + //Creating the Company for Adding + Company company = QBOHelper.CreateCompany(qboContextoAuth); + //Adding the Company + Company added = Helper.Add(qboContextoAuth, company); + //Change the data of added entity + Company changed = QBOHelper.UpdateCompanySparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + Company updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Company + QBOHelper.VerifyCompanySparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void CompanyDeleteTestUsingoAuth() + { + //Creating the Company for Adding + Company company = QBOHelper.CreateCompany(qboContextoAuth); + //Adding the Company + Company added = Helper.Add(qboContextoAuth, company); + //Delete the returned entity + try + { + Company deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + public void CompanyVoidTestUsingoAuth() + { + //Creating the entity for Adding + Company entity = QBOHelper.CreateCompany(qboContextoAuth); + //Adding the entity + Company added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + Company voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void CompanyCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + CompanyAddTestUsingoAuth(); + + //Retrieving the Company using CDC + List entities = Helper.CDC(qboContextoAuth, new Company(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void CompanyBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + Company existing = Helper.FindOrAdd(qboContextoAuth, new Company()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateCompany(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateCompany(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from Company"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as Company).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void CompanyQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + Company existing = Helper.FindOrAdd(qboContextoAuth, new Company()); + // List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + int count = entityQuery.ExecuteIdsQuery("Select * from Company where Id='" + existing.Id + "'").Count; + Assert.IsTrue(count > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void CompanyAddAsyncTestsUsingoAuth() + { + //Creating the Company for Add + Company entity = QBOHelper.CreateCompany(qboContextoAuth); + + Company added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyCompany(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void CompanyRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + CompanyAddTestUsingoAuth(); + + //Retrieving the Company using FindAll + Helper.FindAllAsync(qboContextoAuth, new Company()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void CompanyFindByIdAsyncTestsUsingoAuth() + { + //Creating the Company for Adding + Company entity = QBOHelper.CreateCompany(qboContextoAuth); + //Adding the Company + Company added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void CompanyUpdatedAsyncTestsUsingoAuth() + { + //Creating the Company for Adding + Company entity = QBOHelper.CreateCompany(qboContextoAuth); + //Adding the Company + Company added = Helper.Add(qboContextoAuth, entity); + + //Update the Company + Company updated = QBOHelper.UpdateCompany(qboContextoAuth, added); + //Call the service + Company updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated Company + QBOHelper.VerifyCompany(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void CompanyDeleteAsyncTestsUsingoAuth() + { + //Creating the Company for Adding + Company entity = QBOHelper.CreateCompany(qboContextoAuth); + //Adding the Company + Company added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] + public void CompanyVoidAsyncTestsUsingoAuth() + { + //Creating the Company for Adding + Company entity = QBOHelper.CreateCompany(qboContextoAuth); + //Adding the Company + Company added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CompanyCurrency.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CompanyCurrency.cs new file mode 100644 index 0000000..51d1c73 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CompanyCurrency.cs @@ -0,0 +1,350 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + [Ignore] + public class CompanyCurrencyTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + [Ignore] + public void CompanyCurrencyAddTestUsingoAuth() + { + //Creating the CompanyCurrency for Add + CompanyCurrency companyCurrency = QBOHelper.CreateCompanyCurrency(qboContextoAuth); + //Adding the CompanyCurrency + CompanyCurrency added = Helper.Add(qboContextoAuth, companyCurrency); + //Verify the added CompanyCurrency + QBOHelper.VerifyCompanyCurrency(companyCurrency, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + [Ignore] + public void CompanyCurrencyFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + CompanyCurrencyAddTestUsingoAuth(); + + //Retrieving the CompanyCurrency using FindAll + List currencys = Helper.FindAll(qboContextoAuth, new CompanyCurrency(), 1, 500); + Assert.IsNotNull(currencys); + Assert.IsTrue(currencys.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + [Ignore] + public void CompanyCurrencyFindbyIdTestUsingoAuth() + { + //Creating the CompanyCurrency for Adding + CompanyCurrency CompanyCurrency = QBOHelper.CreateCompanyCurrency(qboContextoAuth); + //Adding the CompanyCurrency + CompanyCurrency added = Helper.Add(qboContextoAuth, CompanyCurrency); + CompanyCurrency found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyCompanyCurrency(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + [Ignore] + public void CompanyCurrencyUpdateTestUsingoAuth() + { + //Creating the CompanyCurrency for Adding + CompanyCurrency companyCurrency = QBOHelper.CreateCompanyCurrency(qboContextoAuth); + //Adding the CompanyCurrency + CompanyCurrency added = Helper.Add(qboContextoAuth, companyCurrency); + //Change the data of added entity + CompanyCurrency changed = QBOHelper.UpdateCompanyCurrency(qboContextoAuth, added); + //Update the returned entity data + CompanyCurrency updated = Helper.Update(qboContextoAuth, changed);//Verify the updated CompanyCurrency + QBOHelper.VerifyCompanyCurrency(changed, updated); + } + + [TestMethod] + [Ignore] + public void CompanyCurrencySparseUpdateTestUsingoAuth() + { + //Creating the CompanyCurrency for Adding + CompanyCurrency companyCurrency = QBOHelper.CreateCompanyCurrency(qboContextoAuth); + //Adding the CompanyCurrency + CompanyCurrency added = Helper.Add(qboContextoAuth, companyCurrency); + //Change the data of added entity + CompanyCurrency changed = QBOHelper.UpdateCompanyCurrencySparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + CompanyCurrency updated = Helper.Update(qboContextoAuth, changed);//Verify the updated CompanyCurrency + QBOHelper.VerifyCompanyCurrencySparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + [Ignore] //Soft delete + public void CompanyCurrencyDeleteTestUsingoAuth() + { + //Creating the CompanyCurrency for Adding + CompanyCurrency companyCurrency = QBOHelper.CreateCompanyCurrency(qboContextoAuth); + //Adding the CompanyCurrency + CompanyCurrency added = Helper.Add(qboContextoAuth, companyCurrency); + //Delete the returned entity + try + { + CompanyCurrency deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + [Ignore] + public void CompanyCurrencyVoidTestUsingoAuth() + { + //Creating the entity for Adding + CompanyCurrency entity = QBOHelper.CreateCompanyCurrency(qboContextoAuth); + //Adding the entity + CompanyCurrency added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + CompanyCurrency voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + [Ignore] + public void CompanyCurrencyCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + CompanyCurrencyAddTestUsingoAuth(); + + //Retrieving the CompanyCurrency using CDC + List entities = Helper.CDC(qboContextoAuth, new CompanyCurrency(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + [Ignore] + public void CompanyCurrencyBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + CompanyCurrency existing = Helper.FindOrAdd(qboContextoAuth, new CompanyCurrency()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateCompanyCurrency(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateCompanyCurrency(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from CompanyCurrency"); + + //batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as CompanyCurrency).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void CompanyCurrencyQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + CompanyCurrency existing = Helper.FindOrAdd(qboContextoAuth, new CompanyCurrency()); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + int count = entityQuery.ExecuteIdsQuery("Select * from CompanyCurrency where Id='" + existing.Id + "'").Count; + Assert.IsTrue(count> 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + [Ignore] + public void CompanyCurrencyAddAsyncTestsUsingoAuth() + { + //Creating the CompanyCurrency for Add + CompanyCurrency entity = QBOHelper.CreateCompanyCurrency(qboContextoAuth); + + CompanyCurrency added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyCompanyCurrency(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + [Ignore] + public void CompanyCurrencyRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + CompanyCurrencyAddTestUsingoAuth(); + + //Retrieving the CompanyCurrency using FindAll + Helper.FindAllAsync(qboContextoAuth, new CompanyCurrency()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + [Ignore] + public void CompanyCurrencyFindByIdAsyncTestsUsingoAuth() + { + //Creating the CompanyCurrency for Adding + CompanyCurrency entity = QBOHelper.CreateCompanyCurrency(qboContextoAuth); + //Adding the CompanyCurrency + CompanyCurrency added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + [Ignore] + public void CompanyCurrencyUpdatedAsyncTestsUsingoAuth() + { + //Creating the CompanyCurrency for Adding + CompanyCurrency entity = QBOHelper.CreateCompanyCurrency(qboContextoAuth); + //Adding the CompanyCurrency + CompanyCurrency added = Helper.Add(qboContextoAuth, entity); + + //Update the CompanyCurrency + CompanyCurrency updated = QBOHelper.UpdateCompanyCurrency(qboContextoAuth, added); + //Call the service + CompanyCurrency updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated CompanyCurrency + QBOHelper.VerifyCompanyCurrency(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + [Ignore] + public void CompanyCurrencyDeleteAsyncTestsUsingoAuth() + { + //Creating the CompanyCurrency for Adding + CompanyCurrency entity = QBOHelper.CreateCompanyCurrency(qboContextoAuth); + //Adding the CompanyCurrency + CompanyCurrency added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] + [Ignore] + public void CompanyCurrencyVoidAsyncTestsUsingoAuth() + { + //Creating the CompanyCurrency for Adding + CompanyCurrency entity = QBOHelper.CreateCompanyCurrency(qboContextoAuth); + //Adding the CompanyCurrency + CompanyCurrency added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CompanyInfo.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CompanyInfo.cs new file mode 100644 index 0000000..edf69ce --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CompanyInfo.cs @@ -0,0 +1,350 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class CompanyInfoTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] [Ignore] + public void CompanyInfoAddTestUsingoAuth() + { + //Creating the Bill for Add + CompanyInfo companyInfo = QBOHelper.CreateCompanyInfo(qboContextoAuth); + //Adding the CompanyInfo + CompanyInfo added = Helper.Add(qboContextoAuth, companyInfo); + //Verify the added CompanyInfo + QBOHelper.VerifyCompanyInfo(companyInfo, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void CompanyInfoFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + // CompanyInfoAddTestUsingoAuth(); + + //Retrieving the Bill using FindAll + List companyInfos = Helper.FindAll(qboContextoAuth, new CompanyInfo(), 1, 500); + Assert.IsNotNull(companyInfos); + Assert.IsTrue(companyInfos.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void CompanyInfoFindbyIdTestUsingoAuth() + { + //Creating the CompanyInfo for Adding + // CompanyInfo companyInfo = QBOHelper.CreateCompanyInfo(qboContextoAuth); + //Adding the CompanyInfo + // CompanyInfo added = Helper.Add(qboContextoAuth, companyInfo); + CompanyInfo added = new CompanyInfo(); + added.Id = "1"; + CompanyInfo found = Helper.FindById(qboContextoAuth, added); + Assert.AreEqual(added.Id, found.Id); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod][Ignore] + public void CompanyInfoUpdateTestUsingoAuth() + { + ////Creating the CompanyInfo for Adding + //CompanyInfo companyInfo = QBOHelper.CreateCompanyInfo(qboContextoAuth); + ////Adding the CompanyInfo + //CompanyInfo added = Helper.Add(qboContextoAuth, companyInfo); + + List found = Helper.FindAll(qboContextoAuth, new CompanyInfo()); + + //Change the data of added entity + CompanyInfo changed = QBOHelper.UpdateCompanyInfo(qboContextoAuth, found[0]); + + //Update the returned entity data + CompanyInfo updated = Helper.Update(qboContextoAuth, changed);//Verify the updated CompanyInfo + QBOHelper.VerifyCompanyInfo(changed, updated); + } + + [TestMethod] [Ignore] + public void CompanyInfoSparseUpdateTestUsingoAuth() + { + ////Creating the CompanyInfo for Adding + //CompanyInfo companyInfo = QBOHelper.CreateCompanyInfo(qboContextoAuth); + ////Adding the CompanyInfo + //CompanyInfo added = Helper.Add(qboContextoAuth, companyInfo); + + List found = Helper.FindAll(qboContextoAuth, new CompanyInfo()); + + //Change the data of added entity + CompanyInfo changed = QBOHelper.SparseUpdateCompanyInfo(qboContextoAuth, found[0].Id, found[0].SyncToken, found[0].CompanyName); + //Update the returned entity data + CompanyInfo updated = Helper.Update(qboContextoAuth, changed);//Verify the updated CompanyInfo + QBOHelper.VerifyCompanyInfoSparseUpdate(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] [Ignore] + public void CompanyInfoDeleteTestUsingoAuth() + { + //Creating the CompanyInfo for Adding + CompanyInfo companyInfo = QBOHelper.CreateCompanyInfo(qboContextoAuth); + //Adding the CompanyInfo + CompanyInfo added = Helper.Add(qboContextoAuth, companyInfo); + //Delete the returned entity + try + { + CompanyInfo deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] [Ignore] //IgnoreReason: Not Supported + public void CompanyInfoVoidTestUsingoAuth() + { + //Creating the entity for Adding + CompanyInfo entity = QBOHelper.CreateCompanyInfo(qboContextoAuth); + //Adding the entity + CompanyInfo added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + CompanyInfo voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void CompanyInfoCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + //CompanyInfoAddTestUsingoAuth(); + + //Retrieving the Bill using FindAll + List companyInfos = Helper.CDC(qboContextoAuth, new CompanyInfo(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(companyInfos); + Assert.IsTrue(companyInfos.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void CompanyInfoBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + List existing = Helper.FindAll(qboContextoAuth, new CompanyInfo()); + + + + Assert.IsNotNull(existing); + + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateCompanyInfo(qboContextoAuth, existing[0])); + + batchEntries.Add(OperationEnum.query, "select * from CompanyInfo"); + + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as CompanyInfo).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void CompanyInfoQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + CompanyInfo existing = Helper.FindOrAdd(qboContextoAuth, new CompanyInfo()); + //List entities = entityQuery.Where(c => c.MetaData.CreateTime == existing.MetaData.CreateTime).ToList(); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM CompanyInfo").ToList(); + + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] [Ignore] + public void CompanyInfoAddAsyncTestsUsingoAuth() + { + //Creating the CompanyInfo for Add + CompanyInfo entity = QBOHelper.CreateCompanyInfo(qboContextoAuth); + + CompanyInfo added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyCompanyInfo(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void CompanyInfoRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + //CompanyInfoAddTestUsingoAuth(); + + //Retrieving the CompanyInfo using FindAll + Helper.FindAllAsync(qboContextoAuth, new CompanyInfo()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void CompanyInfoFindByIdAsyncTestsUsingoAuth() + { + ////Creating the CompanyInfo for Adding + //CompanyInfo entity = QBOHelper.CreateCompanyInfo(qboContextoAuth); + ////Adding the CompanyInfo + //CompanyInfo added = Helper.Add(qboContextoAuth, entity); + + CompanyInfo added = new CompanyInfo(); + added.Id = "1"; + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void CompanyInfoUpdatedAsyncTestsUsingoAuth() + { + ////Creating the CompanyInfo for Adding + //CompanyInfo companyInfo = QBOHelper.CreateCompanyInfo(qboContextoAuth); + ////Adding the CompanyInfo + //CompanyInfo added = Helper.Add(qboContextoAuth, companyInfo); + + List found = Helper.FindAll(qboContextoAuth, new CompanyInfo()); + + //Change the data of added entity + CompanyInfo changed = QBOHelper.UpdateCompanyInfo(qboContextoAuth, found[0]); + + //Update the returned entity data + CompanyInfo updated = Helper.UpdateAsync(qboContextoAuth, changed);//Verify the updated CompanyInfo + QBOHelper.VerifyCompanyInfo(changed, updated); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] [Ignore] + public void CompanyInfoDeleteAsyncTestsUsingoAuth() + { + //Creating the CompanyInfo for Adding + CompanyInfo entity = QBOHelper.CreateCompanyInfo(qboContextoAuth); + //Adding the CompanyInfo + CompanyInfo added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] [Ignore] + public void CompanyInfoVoidAsyncTestsUsingoAuth() + { + //Creating the CompanyInfo for Adding + CompanyInfo entity = QBOHelper.CreateCompanyInfo(qboContextoAuth); + //Adding the CompanyInfo + CompanyInfo added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CreditMemo.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CreditMemo.cs new file mode 100644 index 0000000..c3b8777 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CreditMemo.cs @@ -0,0 +1,351 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class CreditMemoTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void CreditMemoAddTestUsingoAuth() + { + //Creating the CreditMemo for Add + CreditMemo creditMemo = QBOHelper.CreateCreditMemo(qboContextoAuth); + //Adding the CreditMemo + CreditMemo added = Helper.Add(qboContextoAuth, creditMemo); + //Verify the added CreditMemo + QBOHelper.VerifyCreditMemo(creditMemo, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void CreditMemoFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + CreditMemoAddTestUsingoAuth(); + + //Retrieving the CreditMemo using FindAll + List creditMemos = Helper.FindAll(qboContextoAuth, new CreditMemo(), 1, 500); + Assert.IsNotNull(creditMemos); + Assert.IsTrue(creditMemos.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void CreditMemoFindbyIdTestUsingoAuth() + { + //Creating the CreditMemo for Adding + CreditMemo creditMemo = QBOHelper.CreateCreditMemo(qboContextoAuth); + //Adding the CreditMemo + CreditMemo added = Helper.Add(qboContextoAuth, creditMemo); + CreditMemo found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyCreditMemo(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void CreditMemoUpdateTestUsingoAuth() + { + //Creating the CreditMemo for Adding + CreditMemo creditMemo = QBOHelper.CreateCreditMemo(qboContextoAuth); + //Adding the CreditMemo + CreditMemo added = Helper.Add(qboContextoAuth, creditMemo); + //Change the data of added entity + CreditMemo changed = QBOHelper.UpdateCreditMemo(qboContextoAuth, added); + //Update the returned entity data + CreditMemo updated = Helper.Update(qboContextoAuth, changed); + //Verify the updated CreditMemo + QBOHelper.VerifyCreditMemo(changed, updated); + } + + [TestMethod] + public void CreditMemoSparseUpdateTestUsingoAuth() + { + //Creating the CreditMemo for Adding + CreditMemo creditMemo = QBOHelper.CreateCreditMemo(qboContextoAuth); + //Adding the CreditMemo + CreditMemo added = Helper.Add(qboContextoAuth, creditMemo); + //Change the data of added entity + CreditMemo changed = QBOHelper.UpdateCreditMemoSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + CreditMemo updated = Helper.Update(qboContextoAuth, changed); + //Verify the updated CreditMemo + QBOHelper.VerifyCreditMemoSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void CreditMemoDeleteTestUsingoAuth() + { + //Creating the CreditMemo for Adding + CreditMemo creditMemo = QBOHelper.CreateCreditMemo(qboContextoAuth); + //Adding the CreditMemo + CreditMemo added = Helper.Add(qboContextoAuth, creditMemo); + //Delete the returned entity + try + { + CreditMemo deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod][Ignore] + public void CreditMemoVoidTestUsingoAuth() + { + //Creating the CreditMemo for Adding + CreditMemo creditMemo = QBOHelper.CreateCreditMemo(qboContextoAuth); + //Adding the CreditMemo + CreditMemo added = Helper.Add(qboContextoAuth, creditMemo); + //Delete the returned entity + try + { + CreditMemo voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided , voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void CreditMemoCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + CreditMemoAddTestUsingoAuth(); + + //Retrieving the CreditMemo using CDC + List entities = Helper.CDC(qboContextoAuth, new CreditMemo(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void CreditMemoBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + CreditMemo existing = Helper.FindOrAdd(qboContextoAuth, new CreditMemo()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateCreditMemo(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateCreditMemo(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from CreditMemo"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as CreditMemo).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void CreditMemoQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + CreditMemo existing = Helper.FindOrAdd(qboContextoAuth, new CreditMemo()); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM CreditMemo where Id='" + existing.Id + "'").ToList(); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void CreditMemoAddAsyncTestsUsingoAuth() + { + //Creating the CreditMemo for Add + CreditMemo entity = QBOHelper.CreateCreditMemo(qboContextoAuth); + + CreditMemo added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyCreditMemo(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void CreditMemoRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + CreditMemoAddTestUsingoAuth(); + + //Retrieving the CreditMemo using FindAll + Helper.FindAllAsync(qboContextoAuth, new CreditMemo()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void CreditMemoFindByIdAsyncTestsUsingoAuth() + { + //Creating the CreditMemo for Adding + CreditMemo entity = QBOHelper.CreateCreditMemo(qboContextoAuth); + //Adding the CreditMemo + CreditMemo added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void CreditMemoUpdatedAsyncTestsUsingoAuth() + { + //Creating the CreditMemo for Adding + CreditMemo entity = QBOHelper.CreateCreditMemo(qboContextoAuth); + //Adding the CreditMemo + CreditMemo added = Helper.Add(qboContextoAuth, entity); + + //Update the CreditMemo + CreditMemo updated = QBOHelper.UpdateCreditMemo(qboContextoAuth, added); + //Call the service + CreditMemo updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated CreditMemo + QBOHelper.VerifyCreditMemo(updated, updatedReturned); + } + + [TestMethod] + public void CreditMemoSparseUpdatedAsyncTestsUsingoAuth() + { + //Creating the CreditMemo for Adding + CreditMemo entity = QBOHelper.CreateCreditMemo(qboContextoAuth); + //Adding the CreditMemo + CreditMemo added = Helper.Add(qboContextoAuth, entity); + + //Update the CreditMemo + CreditMemo updated = QBOHelper.UpdateCreditMemoSparse(qboContextoAuth, added.Id, added.SyncToken); + //Call the service + CreditMemo updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated CreditMemo + QBOHelper.VerifyCreditMemoSparse(updated, updatedReturned); + } + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void CreditMemoDeleteAsyncTestsUsingoAuth() + { + //Creating the CreditMemo for Adding + CreditMemo entity = QBOHelper.CreateCreditMemo(qboContextoAuth); + //Adding the CreditMemo + CreditMemo added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] [Ignore] + public void CreditMemoVoidAsyncTestsUsingoAuth() + { + //Creating the CreditMemo for Adding + CreditMemo entity = QBOHelper.CreateCreditMemo(qboContextoAuth); + //Adding the CreditMemo + CreditMemo added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CustomFieldDefinition.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CustomFieldDefinition.cs new file mode 100644 index 0000000..f783fda --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CustomFieldDefinition.cs @@ -0,0 +1,115 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class CustomFieldDefinitionTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void CustomFieldDefinitionAddTestUsingoAuth() + { + ////Creating the Bill for Add + //CustomFieldDefinition customFieldDefinition = QBOHelper.CreateCustomFieldDefinition(qboContextoAuth); + ////Adding the CustomFieldDefinition + //CustomFieldDefinition added = Helper.Add(qboContextoAuth, customFieldDefinition); + ////Verify the added CustomFieldDefinition + //QBOHelper.VerifyCustomFieldDefinition(customFieldDefinition, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void CustomFieldDefinitionFindAllTestUsingoAuth() + { + ////Making sure that at least one entity is already present + //CustomFieldDefinitionAddTestUsingoAuth(); + + ////Retrieving the Bill using FindAll + //List customFieldDefinitions = Helper.FindAll(qboContextoAuth, new CustomFieldDefinition(), 1, 500); + //Assert.IsNotNull(customFieldDefinitions); + //Assert.IsTrue(customFieldDefinitions.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void CustomFieldDefinitionFindbyIdTestUsingoAuth() + { + ////Creating the CustomFieldDefinition for Adding + //CustomFieldDefinition customFieldDefinition = QBOHelper.CreateCustomFieldDefinition(qboContextoAuth); + ////Adding the CustomFieldDefinition + //CustomFieldDefinition added = Helper.Add(qboContextoAuth, customFieldDefinition); + //CustomFieldDefinition found = Helper.FindById(qboContextoAuth, added); + //QBOHelper.VerifyCustomFieldDefinition(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void CustomFieldDefinitionUpdateTestUsingoAuth() + { + ////Creating the CustomFieldDefinition for Adding + //CustomFieldDefinition customFieldDefinition = QBOHelper.CreateCustomFieldDefinition(qboContextoAuth); + ////Adding the CustomFieldDefinition + //CustomFieldDefinition added = Helper.Add(qboContextoAuth, customFieldDefinition); + ////Change the data of added entity + //QBOHelper.UpdateCustomFieldDefinition(qboContextoAuth, added); + ////Update the returned entity data + //CustomFieldDefinition updated = Helper.Update(qboContextoAuth, added);//Verify the updated CustomFieldDefinition + //QBOHelper.VerifyCustomFieldDefinition(added, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void CustomFieldDefinitionDeleteTestUsingoAuth() + { + ////Creating the CustomFieldDefinition for Adding + //CustomFieldDefinition customFieldDefinition = QBOHelper.CreateCustomFieldDefinition(qboContextoAuth); + ////Adding the CustomFieldDefinition + //CustomFieldDefinition added = Helper.Add(qboContextoAuth, customFieldDefinition); + ////Delete the returned entity + //Helper.Delete(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Customer.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Customer.cs new file mode 100644 index 0000000..9ad61ba --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Customer.cs @@ -0,0 +1,528 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using Intuit.Ipp.DataService; +using System.Collections.ObjectModel; +using Intuit.Ipp.QueryFilter; + + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class CustomerTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void CustomerAddTestUsingoAuth() + { + //Creating the Customer for Add + Customer customer = QBOHelper.CreateCustomer(qboContextoAuth); + + //Adding the Customer + Customer added = Helper.Add(qboContextoAuth, customer); + //Verify the added Customer + QBOHelper.VerifyCustomer(customer, added); + } + + [TestMethod][Ignore] + public void CustomerAddTestsUsingoAuthInvalid() + { + try + { + + // IRequestValidator req = new OAuthRequestValidator("gjggdj", "hhh", "gjsgj", "mnv""access_token"); + OAuth2RequestValidator req = new OAuth2RequestValidator("xxxx"); + + ServiceContext context = new ServiceContext("123146090856284", IntuitServicesType.QBO, req); + + //Creating the Customer for Add + Customer customer = QBOHelper.CreateCustomer(context); + + Customer added = Helper.Add(context, customer); + + Assert.Fail(); + } + catch (InvalidTokenException ex) + { + + } + + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void CustomerFindAllTestUsingoAuth() + { + //IRequestValidator req = new OAuth2RequestValidator("eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..OOFfh15AzfpEG48UctVT0Q.dQk--qs0FhjsIEtqGjIHvVUKAk8G-YkkqVMMsuK9Y8W4nbe1oy9cwByriTiC8bQJ4JdhR4ufc7bh2x7qmcIwsTmeDWIcLAwkqKe-d7uL4bV3DOjBB4UUXjftZbs-lf-vHMoRVa1pJrhBDRKDu58LYWbaTMXZnQ6JxVqIKFUNER-2sm-6roKFO52sY9p1_bQSdW08giLAt-z0pfUx4XT7tCWbPAKaKSaKQBBzqNCiZuyCmjzetAUDhq-CYMkG-znJujDk5JaUBUVmfuP-aCH21u3iXA81nSHCimbUfqjXmjBWkE9s0rLkOzWk3KtPUt6FeSjpZiqaTYOpuYPNNbmO1r9zDvobFjhZgTNIAKqFDhbkV0DeUgZaGiXHmRLUmLZbg956EyMfqMMP06E6hDvSlwJRyY28iE89qrZt5e8MBXy8mBrRAOiOI-L1fHIgzwu27fEu4QcbostguN6oySI2hssPdXI2hvXCTNKy74iZjyzzfQtycFjdQxmFBkoaqdU7qjJ6fjmURweGeKNiFqGUZT9_yEAibF-98ZZ8qiwQlFFY8rYZFWUva1qDCmtxiGdRxe7vn28FAWw906Bu3mwn9lxPjMyZdo-iD6RtY4tabVoYZR-24LjsoRqmMvBZreTp3uQ6xMALHBeE6qyK8-pjEldSI7Dkjbg-Q88GEa74sRM.PKBNr_m_A7swUlrepSOp2g"); + //ServiceContext context = new ServiceContext("123146090856284", IntuitServicesType.QBO, req); + + //Making sure that at least one entity is already present + CustomerAddTestUsingoAuth(); + + //Retrieving the Customer using FindAll + List customers = Helper.FindAll(qboContextoAuth, new Customer(), 1, 500); + Assert.IsNotNull(customers); + Assert.IsTrue(customers.Count() > 0); + } + + //[TestMethod] + //public void CustomerRetrieveTestsNoEntityAvailableUsingoAuth() + //{ + // bool moreAvailable = true; + // //Find and delete all Customer + // while (moreAvailable) + // { + // List customerList = Helper.FindAll(qboContextoAuth, new Customer(), 1, 500); + // if (customerList.Count > 0) + // { + // foreach (Customer customer in customerList) + // { + // Helper.Delete(qboContextoAuth, customer); + // } + // } + // else + // { + // moreAvailable = false; + // } + // } + // try + // { + // Helper.FindAll(qboContextoAuth, new Customer(), 1, 500); + // Assert.Fail(); + // } + // catch (IdsException) + // { + // } + //} + + [TestMethod] + public void CustomerRetrieveAsyncTestsNullEntityUsingoAuth() + { + try + { + Helper.FindAll(qboContextoAuth, null); + Assert.Fail(); + } + catch (IdsException) + { + + } + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void CustomerFindbyIdTestUsingoAuth() + { + //Creating the Customer for Adding + Customer customer = QBOHelper.CreateCustomer(qboContextoAuth); + //Adding the Customer + Customer added = Helper.Add(qboContextoAuth, customer); + Customer found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyCustomer(found, added); + } + + //[TestMethod] + //public void CustomerFindbyIdTestDeletedEntityUsingoAuth() + //{ + // //Creating the Customer for Adding + // Customer customer = QBOHelper.CreateCustomer(qboContextoAuth); + // //Adding the Customer + // Customer added = Helper.Add(qboContextoAuth, customer); + + // Helper.Delete(qboContextoAuth, added); + + // try + // { + // Customer found = Helper.FindById(qboContextoAuth, added); + // Assert.Fail(); + // } + // catch (IdsException) + // { + + // } + + //} + + [TestMethod] + public void CustomerFindByIdTestsNullEntityUsingoAuth() + { + try + { + Helper.FindById(qboContextoAuth, null); + Assert.Fail(); + } + catch (IdsException) + { + + } + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] [Ignore] //IgnoreReason: CDC operations where Create is not supported removed for build + public void CustomerUpdateTestUsingoAuth() + { + //Creating the Customer for Adding + Customer customer = QBOHelper.CreateCustomer(qboContextoAuth); + //Adding the Customer + Customer added = Helper.Add(qboContextoAuth, customer); + //Change the data of added entity + Customer updated = QBOHelper.UpdateCustomer(qboContextoAuth, added); + //Update the returned entity data + Customer updatedreturned = Helper.Update(qboContextoAuth, updated); + //Verify the updated Customer + QBOHelper.VerifyCustomer(updated, updatedreturned); + } + + + [TestMethod] + public void CustomerSparseUpdateTestUsingoAuth() + { + //Creating the Customer for Adding + Customer customer = QBOHelper.CreateCustomer(qboContextoAuth); + //Adding the Customer + Customer added = Helper.Add(qboContextoAuth, customer); + //Change the data of added entity + Customer updated = QBOHelper.SparseUpdateCustomer(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + Customer updatedreturned = Helper.Update(qboContextoAuth, updated); + //Verify the updated Customer + QBOHelper.VerifyCustomerSparseUpdate(updated, updatedreturned); + } + + [TestMethod] + public void CustomerUpdateTestsNullEntityUsingoAuth() + { + try + { + Customer updatedReturned = Helper.Update(qboContextoAuth, null); + Assert.Fail(); + } + catch (IdsException) + { + } + + } + + #endregion + + #region Test cases for Updateaccountontxns Operations + + [TestMethod] + public void CustomerUpdateAccountOnTxnsTestUsingoAuthFrance() + { + //Creating the Customer for Adding + Customer customer = QBOHelper.CreateCustomerFrance(qboContextoAuth); + //Adding the Customer + Customer added = Helper.Add(qboContextoAuth, customer); + //Change the data of added entity + // Customer updated = QBOHelper.UpdateCustomer(qboContextoAuth, added); + Customer updated = QBOHelper.UpdateCustomerFrance(qboContextoAuth, added); + //Update the returned entity data + Customer updatedreturned = Helper.UpdateAccountOnTxnsFrance(qboContextoAuth, updated); + //Verify the updated Customer + QBOHelper.VerifyCustomerFrance(updated, updatedreturned); + } + + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] [Ignore] //TestComment: Returns Operation Not Supported: DevKit tracker Item #150 + public void CustomerDeleteTestUsingoAuth() + { + //Creating the Customer for Adding + Customer customer = QBOHelper.CreateCustomer(qboContextoAuth); + //Adding the Customer + Customer added = Helper.Add(qboContextoAuth, customer); + //Delete the returned entity + try + { + Customer deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] [Ignore] + public void CustomerVoidTestUsingoAuth() + { + //Creating the Customer for Adding + Customer customer = QBOHelper.CreateCustomer(qboContextoAuth); + //Adding the Customer + Customer added = Helper.Add(qboContextoAuth, customer); + //Void the returned entity + try + { + Customer voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + public void CustomerDeleteTestsNullEntityUsingoAuth() + { + try + { + Helper.Delete(qboContextoAuth, null); + } + catch (IdsException) + { + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void CustomerCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + CustomerAddTestUsingoAuth(); + + //Retrieving the Customer using FindAll + List customers = Helper.CDC(qboContextoAuth, new Customer(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(customers); + Assert.IsTrue(customers.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void CustomerBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + Customer existing = Helper.FindOrAdd(qboContextoAuth, new Customer()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateCustomer(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateCustomer(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from Customer"); + + //batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as Customer).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void CustomerQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + Customer existing = Helper.FindOrAdd(qboContextoAuth, new Customer()); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM Customer where Id='" + existing.Id + "'").ToList(); + + Assert.IsTrue(entities.Count() > 0); + } + + [TestMethod] + public void CustomerQueryWithSpecialCharacterUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + //List entities = entityQuery.Where(c => c.DisplayName == "Customer\\'s Business").ToList(); + int count=entityQuery.ExecuteIdsQuery("Select * from Customer where DisplayName='Customer\\'s Business'").Count; + Assert.IsTrue(count >= 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void CustomerAddAsyncTestsUsingoAuth() + { + //Creating the Customer for Add + Customer entity = QBOHelper.CreateCustomer(qboContextoAuth); + + Customer added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyCustomer(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void CustomerRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + CustomerAddTestUsingoAuth(); + + //Retrieving the Customer using FindAll + Helper.FindAllAsync(qboContextoAuth, new Customer()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void CustomerFindByIdAsyncTestsUsingoAuth() + { + //Creating the Customer for Adding + Customer entity = QBOHelper.CreateCustomer(qboContextoAuth); + //Adding the Customer + Customer added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void CustomerUpdatedAsyncTestsUsingoAuth() + { + //Creating the Customer for Adding + Customer entity = QBOHelper.CreateCustomer(qboContextoAuth); + //Adding the Customer + Customer added = Helper.Add(qboContextoAuth, entity); + + //Update the Customer + Customer updated = QBOHelper.UpdateCustomer(qboContextoAuth, added); + //Call the service + Customer updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated Customer + QBOHelper.VerifyCustomer(updated, updatedReturned); + } + + #endregion + + #region Test cases for UpdateAccountOnTxns Operations + + [TestMethod] + public void CustomerUpdateAccountOnTxnsAsyncTestUsingoAuthFrance() + { + //Creating the Customer for Adding + Customer customer = QBOHelper.CreateCustomerFrance(qboContextoAuth); + //Adding the Customer + Customer added = Helper.Add(qboContextoAuth, customer); + //Change the data of added entity + // Customer updated = QBOHelper.UpdateCustomer(qboContextoAuth, added); + Customer updated = QBOHelper.UpdateCustomerFrance(qboContextoAuth, added); + //Update the returned entity data + + // Customer updatedreturned = Helper.updateaccountontxnsAsync(qboContextoAuth, updated); + Customer updatedreturned = Helper.UpdateAccountOnTxnsAsyncFrance(qboContextoAuth, updated); + //Verify the updated Customer + QBOHelper.VerifyCustomerFrance(updated, updatedreturned); + } + + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] [Ignore] //TestComment: Returns Operation Not Supported: DevKit tracker Item #150 + public void CustomerDeleteAsyncTestsUsingoAuth() + { + //Creating the Customer for Adding + Customer entity = QBOHelper.CreateCustomer(qboContextoAuth); + //Adding the Customer + Customer added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] [Ignore] + public void CustomerVoidAsyncTestsUsingoAuth() + { + //Creating the Customer for Adding + Customer entity = QBOHelper.CreateCustomer(qboContextoAuth); + //Adding the Customer + Customer added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CustomerMsg.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CustomerMsg.cs new file mode 100644 index 0000000..51244e5 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CustomerMsg.cs @@ -0,0 +1,333 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class CustomerMsgTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void CustomerMsgAddTestUsingoAuth() + { + //Creating the CustomerMsg for Add + CustomerMsg customerMsg = QBOHelper.CreateCustomerMsg(qboContextoAuth); + //Adding the CustomerMsg + CustomerMsg added = Helper.Add(qboContextoAuth, customerMsg); + //Verify the added CustomerMsg + QBOHelper.VerifyCustomerMsg(customerMsg, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void CustomerMsgFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + CustomerMsgAddTestUsingoAuth(); + + //Retrieving the CustomerMsg using FindAll + List customerMsgs = Helper.FindAll(qboContextoAuth, new CustomerMsg(), 1, 500); + Assert.IsNotNull(customerMsgs); + Assert.IsTrue(customerMsgs.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void CustomerMsgFindbyIdTestUsingoAuth() + { + //Creating the CustomerMsg for Adding + CustomerMsg customerMsg = QBOHelper.CreateCustomerMsg(qboContextoAuth); + //Adding the CustomerMsg + CustomerMsg added = Helper.Add(qboContextoAuth, customerMsg); + CustomerMsg found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyCustomerMsg(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void CustomerMsgUpdateTestUsingoAuth() + { + //Creating the CustomerMsg for Adding + CustomerMsg customerMsg = QBOHelper.CreateCustomerMsg(qboContextoAuth); + //Adding the CustomerMsg + CustomerMsg added = Helper.Add(qboContextoAuth, customerMsg); + //Change the data of added entity + CustomerMsg changed = QBOHelper.UpdateCustomerMsg(qboContextoAuth, added); + //Update the returned entity data + CustomerMsg updated = Helper.Update(qboContextoAuth, changed);//Verify the updated CustomerMsg + QBOHelper.VerifyCustomerMsg(changed, updated); + } + + [TestMethod] + public void CustomerMsgSparseUpdateTestUsingoAuth() + { + //Creating the CustomerMsg for Adding + CustomerMsg customerMsg = QBOHelper.CreateCustomerMsg(qboContextoAuth); + //Adding the CustomerMsg + CustomerMsg added = Helper.Add(qboContextoAuth, customerMsg); + //Change the data of added entity + CustomerMsg changed = QBOHelper.UpdateCustomerMsgSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + CustomerMsg updated = Helper.Update(qboContextoAuth, changed);//Verify the updated CustomerMsg + QBOHelper.VerifyCustomerMsgSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void CustomerMsgDeleteTestUsingoAuth() + { + //Creating the CustomerMsg for Adding + CustomerMsg customerMsg = QBOHelper.CreateCustomerMsg(qboContextoAuth); + //Adding the CustomerMsg + CustomerMsg added = Helper.Add(qboContextoAuth, customerMsg); + //Delete the returned entity + try + { + CustomerMsg deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + public void CustomerMsgVoidTestUsingoAuth() + { + //Creating the entity for Adding + CustomerMsg entity = QBOHelper.CreateCustomerMsg(qboContextoAuth); + //Adding the entity + CustomerMsg added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + CustomerMsg voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void CustomerMsgCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + CustomerMsgAddTestUsingoAuth(); + + //Retrieving the CustomerMsg using CDC + List entities = Helper.CDC(qboContextoAuth, new CustomerMsg(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void CustomerMsgBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + CustomerMsg existing = Helper.FindOrAdd(qboContextoAuth, new CustomerMsg()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateCustomerMsg(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateCustomerMsg(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from CustomerMsg"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as CustomerMsg).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void CustomerMsgQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + CustomerMsg existing = Helper.FindOrAdd(qboContextoAuth, new CustomerMsg()); + // entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + int count = entityQuery.ExecuteIdsQuery("Select * from CustomerMsg where Id='" + existing.Id + "'").Count; + Assert.IsTrue(count > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void CustomerMsgAddAsyncTestsUsingoAuth() + { + //Creating the CustomerMsg for Add + CustomerMsg entity = QBOHelper.CreateCustomerMsg(qboContextoAuth); + + CustomerMsg added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyCustomerMsg(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void CustomerMsgRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + CustomerMsgAddTestUsingoAuth(); + + //Retrieving the CustomerMsg using FindAll + Helper.FindAllAsync(qboContextoAuth, new CustomerMsg()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void CustomerMsgFindByIdAsyncTestsUsingoAuth() + { + //Creating the CustomerMsg for Adding + CustomerMsg entity = QBOHelper.CreateCustomerMsg(qboContextoAuth); + //Adding the CustomerMsg + CustomerMsg added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void CustomerMsgUpdatedAsyncTestsUsingoAuth() + { + //Creating the CustomerMsg for Adding + CustomerMsg entity = QBOHelper.CreateCustomerMsg(qboContextoAuth); + //Adding the CustomerMsg + CustomerMsg added = Helper.Add(qboContextoAuth, entity); + + //Update the CustomerMsg + CustomerMsg updated = QBOHelper.UpdateCustomerMsg(qboContextoAuth, added); + //Call the service + CustomerMsg updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated CustomerMsg + QBOHelper.VerifyCustomerMsg(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void CustomerMsgDeleteAsyncTestsUsingoAuth() + { + //Creating the CustomerMsg for Adding + CustomerMsg entity = QBOHelper.CreateCustomerMsg(qboContextoAuth); + //Adding the CustomerMsg + CustomerMsg added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] + public void CustomerMsgVoidAsyncTestsUsingoAuth() + { + //Creating the CustomerMsg for Adding + CustomerMsg entity = QBOHelper.CreateCustomerMsg(qboContextoAuth); + //Adding the CustomerMsg + CustomerMsg added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CustomerType.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CustomerType.cs new file mode 100644 index 0000000..baf08c1 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CustomerType.cs @@ -0,0 +1,333 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class CustomerTypeTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void CustomerTypeAddTestUsingoAuth() + { + //Creating the CustomerType for Add + CustomerType customerType = QBOHelper.CreateCustomerType(qboContextoAuth); + //Adding the CustomerType + CustomerType added = Helper.Add(qboContextoAuth, customerType); + //Verify the added CustomerType + QBOHelper.VerifyCustomerType(customerType, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void CustomerTypeFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + CustomerTypeAddTestUsingoAuth(); + + //Retrieving the CustomerType using FindAll + List customerTypes = Helper.FindAll(qboContextoAuth, new CustomerType(), 1, 500); + Assert.IsNotNull(customerTypes); + Assert.IsTrue(customerTypes.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void CustomerTypeFindbyIdTestUsingoAuth() + { + //Creating the CustomerType for Adding + CustomerType customerType = QBOHelper.CreateCustomerType(qboContextoAuth); + //Adding the CustomerType + CustomerType added = Helper.Add(qboContextoAuth, customerType); + CustomerType found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyCustomerType(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void CustomerTypeUpdateTestUsingoAuth() + { + //Creating the CustomerType for Adding + CustomerType customerType = QBOHelper.CreateCustomerType(qboContextoAuth); + //Adding the CustomerType + CustomerType added = Helper.Add(qboContextoAuth, customerType); + //Change the data of added entity + CustomerType changed = QBOHelper.UpdateCustomerType(qboContextoAuth, added); + //Update the returned entity data + CustomerType updated = Helper.Update(qboContextoAuth, changed);//Verify the updated CustomerType + QBOHelper.VerifyCustomerType(changed, updated); + } + + [TestMethod] + public void CustomerTypeSparseUpdateTestUsingoAuth() + { + //Creating the CustomerType for Adding + CustomerType customerType = QBOHelper.CreateCustomerType(qboContextoAuth); + //Adding the CustomerType + CustomerType added = Helper.Add(qboContextoAuth, customerType); + //Change the data of added entity + CustomerType changed = QBOHelper.UpdateCustomerTypeSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + CustomerType updated = Helper.Update(qboContextoAuth, changed);//Verify the updated CustomerType + QBOHelper.VerifyCustomerTypeSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void CustomerTypeDeleteTestUsingoAuth() + { + //Creating the CustomerType for Adding + CustomerType customerType = QBOHelper.CreateCustomerType(qboContextoAuth); + //Adding the CustomerType + CustomerType added = Helper.Add(qboContextoAuth, customerType); + //Delete the returned entity + try + { + CustomerType deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + public void CustomerTypeVoidTestUsingoAuth() + { + //Creating the entity for Adding + CustomerType entity = QBOHelper.CreateCustomerType(qboContextoAuth); + //Adding the entity + CustomerType added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + CustomerType voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void CustomerTypeCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + CustomerTypeAddTestUsingoAuth(); + + //Retrieving the CustomerType using CDC + List entities = Helper.CDC(qboContextoAuth, new CustomerType(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void CustomerTypeBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + CustomerType existing = Helper.FindOrAdd(qboContextoAuth, new CustomerType()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateCustomerType(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateCustomerType(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from CustomerType"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as CustomerType).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void CustomerTypeQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + CustomerType existing = Helper.FindOrAdd(qboContextoAuth, new CustomerType()); + int count = entityQuery.ExecuteIdsQuery("Select * from CustomerType where Id='" + existing.Id + "'").Count; + Assert.IsTrue(count > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void CustomerTypeAddAsyncTestsUsingoAuth() + { + //Creating the CustomerType for Add + CustomerType entity = QBOHelper.CreateCustomerType(qboContextoAuth); + + CustomerType added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyCustomerType(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void CustomerTypeRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + CustomerTypeAddTestUsingoAuth(); + + //Retrieving the CustomerType using FindAll + Helper.FindAllAsync(qboContextoAuth, new CustomerType()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void CustomerTypeFindByIdAsyncTestsUsingoAuth() + { + //Creating the CustomerType for Adding + CustomerType entity = QBOHelper.CreateCustomerType(qboContextoAuth); + //Adding the CustomerType + CustomerType added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void CustomerTypeUpdatedAsyncTestsUsingoAuth() + { + //Creating the CustomerType for Adding + CustomerType entity = QBOHelper.CreateCustomerType(qboContextoAuth); + //Adding the CustomerType + CustomerType added = Helper.Add(qboContextoAuth, entity); + + //Update the CustomerType + CustomerType updated = QBOHelper.UpdateCustomerType(qboContextoAuth, added); + //Call the service + CustomerType updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated CustomerType + QBOHelper.VerifyCustomerType(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void CustomerTypeDeleteAsyncTestsUsingoAuth() + { + //Creating the CustomerType for Adding + CustomerType entity = QBOHelper.CreateCustomerType(qboContextoAuth); + //Adding the CustomerType + CustomerType added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] + public void CustomerTypeVoidAsyncTestsUsingoAuth() + { + //Creating the CustomerType for Adding + CustomerType entity = QBOHelper.CreateCustomerType(qboContextoAuth); + //Adding the CustomerType + CustomerType added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/DateTypeCustomFieldDefinition.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/DateTypeCustomFieldDefinition.cs new file mode 100644 index 0000000..512a154 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/DateTypeCustomFieldDefinition.cs @@ -0,0 +1,115 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class DateTypeCustomFieldDefinitionTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void DateTypeCustomFieldDefinitionAddTestUsingoAuth() + { + //Creating the Bill for Add + DateTypeCustomFieldDefinition dateTypeCustomFieldDefinition = QBOHelper.CreateDateTypeCustomFieldDefinition(qboContextoAuth); + //Adding the DateTypeCustomFieldDefinition + DateTypeCustomFieldDefinition added = Helper.Add(qboContextoAuth, dateTypeCustomFieldDefinition); + //Verify the added DateTypeCustomFieldDefinition + QBOHelper.VerifyDateTypeCustomFieldDefinition(dateTypeCustomFieldDefinition, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void DateTypeCustomFieldDefinitionFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + DateTypeCustomFieldDefinitionAddTestUsingoAuth(); + + //Retrieving the Bill using FindAll + List dateTypeCustomFieldDefinitions = Helper.FindAll(qboContextoAuth, new DateTypeCustomFieldDefinition(), 1, 500); + Assert.IsNotNull(dateTypeCustomFieldDefinitions); + Assert.IsTrue(dateTypeCustomFieldDefinitions.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void DateTypeCustomFieldDefinitionFindbyIdTestUsingoAuth() + { + //Creating the DateTypeCustomFieldDefinition for Adding + DateTypeCustomFieldDefinition dateTypeCustomFieldDefinition = QBOHelper.CreateDateTypeCustomFieldDefinition(qboContextoAuth); + //Adding the DateTypeCustomFieldDefinition + DateTypeCustomFieldDefinition added = Helper.Add(qboContextoAuth, dateTypeCustomFieldDefinition); + DateTypeCustomFieldDefinition found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyDateTypeCustomFieldDefinition(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void DateTypeCustomFieldDefinitionUpdateTestUsingoAuth() + { + //Creating the DateTypeCustomFieldDefinition for Adding + DateTypeCustomFieldDefinition dateTypeCustomFieldDefinition = QBOHelper.CreateDateTypeCustomFieldDefinition(qboContextoAuth); + //Adding the DateTypeCustomFieldDefinition + DateTypeCustomFieldDefinition added = Helper.Add(qboContextoAuth, dateTypeCustomFieldDefinition); + //Change the data of added entity + QBOHelper.UpdateDateTypeCustomFieldDefinition(qboContextoAuth, added); + //Update the returned entity data + DateTypeCustomFieldDefinition updated = Helper.Update(qboContextoAuth, added);//Verify the updated DateTypeCustomFieldDefinition + QBOHelper.VerifyDateTypeCustomFieldDefinition(added, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void DateTypeCustomFieldDefinitionDeleteTestUsingoAuth() + { + //Creating the DateTypeCustomFieldDefinition for Adding + DateTypeCustomFieldDefinition dateTypeCustomFieldDefinition = QBOHelper.CreateDateTypeCustomFieldDefinition(qboContextoAuth); + //Adding the DateTypeCustomFieldDefinition + DateTypeCustomFieldDefinition added = Helper.Add(qboContextoAuth, dateTypeCustomFieldDefinition); + //Delete the returned entity + Helper.Delete(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Department.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Department.cs new file mode 100644 index 0000000..4b0bdae --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Department.cs @@ -0,0 +1,352 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class DepartmentTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void DepartmentAddTestUsingoAuth() + { + //Creating the Department for Add + Department department = QBOHelper.CreateDepartment(qboContextoAuth); + //Adding the Department + Department added = Helper.Add(qboContextoAuth, department); + //Verify the added Department + QBOHelper.VerifyDepartment(department, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void DepartmentFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + DepartmentAddTestUsingoAuth(); + + //Retrieving the Department using FindAll + List departments = Helper.FindAll(qboContextoAuth, new Department(), 1, 500); + Assert.IsNotNull(departments); + Assert.IsTrue(departments.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void DepartmentFindbyIdTestUsingoAuth() + { + //Creating the Department for Adding + Department department = QBOHelper.CreateDepartment(qboContextoAuth); + //Adding the Department + Department added = Helper.Add(qboContextoAuth, department); + Department found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyDepartment(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void DepartmentUpdateTestUsingoAuth() + { + //Creating the Department for Adding + Department department = QBOHelper.CreateDepartment(qboContextoAuth); + //Adding the Department + Department added = Helper.Add(qboContextoAuth, department); + //Change the data of added entity + Department changed = QBOHelper.UpdateDepartment(qboContextoAuth, added); + //Update the returned entity data + Department updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Department + QBOHelper.VerifyDepartment(changed, updated); + } + + [TestMethod] + public void DepartmentSparseUpdateTestUsingoAuth() + { + //Creating the Department for Adding + Department department = QBOHelper.CreateDepartment(qboContextoAuth); + //Adding the Department + Department added = Helper.Add(qboContextoAuth, department); + //Change the data of added entity + Department changed = QBOHelper.UpdateDepartmentSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + Department updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Department + QBOHelper.VerifyDepartmentSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] [Ignore] //IgnoreReason: Reported by Srini as not supported, with QBO team + public void DepartmentDeleteTestUsingoAuth() + { + //Creating the Department for Adding + Department department = QBOHelper.CreateDepartment(qboContextoAuth); + //Adding the Department + Department added = Helper.Add(qboContextoAuth, department); + //Delete the returned entity + try + { + Department deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod][Ignore] + public void DepartmentVoidTestUsingoAuth() + { + //Creating the Department for Adding + Department department = QBOHelper.CreateDepartment(qboContextoAuth); + //Adding the Department + Department added = Helper.Add(qboContextoAuth, department); + //Delete the returned entity + try + { + Department voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided , voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void DepartmentCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + DepartmentAddTestUsingoAuth(); + + //Retrieving the Department using CDC + List entities = Helper.CDC(qboContextoAuth, new Department(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void DepartmentBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + Department existing = Helper.FindOrAdd(qboContextoAuth, new Department()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateDepartment(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateDepartment(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from Department"); + + //batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as Department).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void DepartmentQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + Department existing = Helper.FindOrAdd(qboContextoAuth, new Department()); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM Department where Id='" + existing.Id + "'").ToList(); + + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void DepartmentAddAsyncTestsUsingoAuth() + { + //Creating the Department for Add + Department entity = QBOHelper.CreateDepartment(qboContextoAuth); + + Department added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyDepartment(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void DepartmentRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + DepartmentAddTestUsingoAuth(); + + //Retrieving the Department using FindAll + Helper.FindAllAsync(qboContextoAuth, new Department()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] [Ignore] //IgnoreReason: http://jira.intuit.com/browse/QBO-11382 (Tracker #184) + public void DepartmentFindByIdAsyncTestsUsingoAuth() + { + //Creating the Department for Adding + Department entity = QBOHelper.CreateDepartment(qboContextoAuth); + //Adding the Department + Department added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void DepartmentUpdatedAsyncTestsUsingoAuth() + { + //Creating the Department for Adding + Department entity = QBOHelper.CreateDepartment(qboContextoAuth); + //Adding the Department + Department added = Helper.Add(qboContextoAuth, entity); + + //Update the Department + Department updated = QBOHelper.UpdateDepartment(qboContextoAuth, added); + //Call the service + Department updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated Department + QBOHelper.VerifyDepartment(updated, updatedReturned); + } + + [TestMethod] + public void DepartmentSparseUpdatedAsyncTestsUsingoAuth() + { + //Creating the Department for Adding + Department entity = QBOHelper.CreateDepartment(qboContextoAuth); + //Adding the Department + Department added = Helper.Add(qboContextoAuth, entity); + + //Update the Department + Department updated = QBOHelper.UpdateDepartmentSparse(qboContextoAuth, added.Id, added.SyncToken); + //Call the service + Department updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated Department + QBOHelper.VerifyDepartmentSparse(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] [Ignore] //IgnoreReason: Reported by Srini as not supported, with QBO team + public void DepartmentDeleteAsyncTestsUsingoAuth() + { + //Creating the Department for Adding + Department entity = QBOHelper.CreateDepartment(qboContextoAuth); + //Adding the Department + Department added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] [Ignore] + public void DepartmentVoidAsyncTestsUsingoAuth() + { + //Creating the Department for Adding + Department entity = QBOHelper.CreateDepartment(qboContextoAuth); + //Adding the Department + Department added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Deposit.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Deposit.cs new file mode 100644 index 0000000..f873913 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Deposit.cs @@ -0,0 +1,331 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class DepositTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + + public void DepositAddTestUsingoAuth() + { + //Creating the Deposit for Add + Deposit deposit = QBOHelper.CreateDeposit(qboContextoAuth); + //Adding the Deposit + Deposit added = Helper.Add(qboContextoAuth, deposit); + //Verify the added Deposit + QBOHelper.VerifyDeposit(deposit, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void DepositFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + //DepositAddTestUsingoAuth(); + + //Retrieving the Deposit using FindAll + List deposits = Helper.FindAll(qboContextoAuth, new Deposit(), 1, 500); + Assert.IsNotNull(deposits); + Assert.IsTrue(deposits.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void DepositFindbyIdTestUsingoAuth() + { + //Creating the Deposit for Adding + Deposit deposit = QBOHelper.CreateDeposit(qboContextoAuth); + //Adding the Deposit + Deposit added = Helper.Add(qboContextoAuth, deposit); + Deposit found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyDeposit(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + + public void DepositUpdateTestUsingoAuth() + { + //Creating the Deposit for Adding + Deposit deposit = QBOHelper.CreateDeposit(qboContextoAuth); + //Adding the Deposit + Deposit added = Helper.Add(qboContextoAuth, deposit); + //Change the data of added entity + Deposit changed = QBOHelper.UpdateDeposit(qboContextoAuth, added); + //Update the returned entity data + Deposit updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Deposit + QBOHelper.VerifyDeposit(changed, updated); + } + + + [TestMethod] + + public void DepositSparseUpdateTestUsingoAuth() + { + //Creating the Deposit for Adding + Deposit deposit = QBOHelper.CreateDeposit(qboContextoAuth); + //Adding the Deposit + Deposit added = Helper.Add(qboContextoAuth, deposit); + //Change the data of added entity + Deposit changed = QBOHelper.UpdateDepositSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + Deposit updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Deposit + QBOHelper.VerifyDepositSparse(changed, updated); + } + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + + public void DepositDeleteTestUsingoAuth() + { + //Creating the Deposit for Adding + Deposit deposit = QBOHelper.CreateDeposit(qboContextoAuth); + //Adding the Deposit + Deposit added = Helper.Add(qboContextoAuth, deposit); + //Delete the returned entity + try + { + Deposit deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + [Ignore] + public void DepositVoidTestUsingoAuth() + { + //Creating the entity for Adding + Deposit entity = QBOHelper.CreateDeposit(qboContextoAuth); + //Adding the entity + Deposit added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + Deposit voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + + public void DepositCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + DepositAddTestUsingoAuth(); + + //Retrieving the Deposit using CDC + List entities = Helper.CDC(qboContextoAuth, new Deposit(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + + public void DepositBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + Deposit existing = Helper.FindOrAdd(qboContextoAuth, new Deposit()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateDeposit(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateDeposit(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from Deposit"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as Deposit).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void DepositQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + Deposit existing = Helper.FindOrAdd(qboContextoAuth, new Deposit()); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM Deposit where Id='" + existing.Id + "'").ToList(); + + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + + public void DepositAddAsyncTestsUsingoAuth() + { + //Creating the Deposit for Add + Deposit entity = QBOHelper.CreateDeposit(qboContextoAuth); + + Deposit added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyDeposit(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void DepositRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + DepositAddTestUsingoAuth(); + + //Retrieving the Deposit using FindAll + Helper.FindAllAsync(qboContextoAuth, new Deposit()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void DepositFindByIdAsyncTestsUsingoAuth() + { + //Creating the Deposit for Adding + Deposit entity = QBOHelper.CreateDeposit(qboContextoAuth); + //Adding the Deposit + Deposit added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + + public void DepositUpdatedAsyncTestsUsingoAuth() + { + //Creating the Deposit for Adding + Deposit entity = QBOHelper.CreateDeposit(qboContextoAuth); + //Adding the Deposit + Deposit added = Helper.Add(qboContextoAuth, entity); + + //Update the Deposit + Deposit updated = QBOHelper.UpdateDeposit(qboContextoAuth, added); + //Call the service + Deposit updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated Deposit + QBOHelper.VerifyDeposit(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + + public void DepositDeleteAsyncTestsUsingoAuth() + { + //Creating the Deposit for Adding + Deposit entity = QBOHelper.CreateDeposit(qboContextoAuth); + //Adding the Deposit + Deposit added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Employee.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Employee.cs new file mode 100644 index 0000000..0c6521d --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Employee.cs @@ -0,0 +1,319 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class EmployeeTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void EmployeeAddTestUsingoAuth() + { + //Creating the Employee for Add + Employee employee = QBOHelper.CreateEmployee(qboContextoAuth); + //Adding the Employee + Employee added = Helper.Add(qboContextoAuth, employee); + //Verify the added Employee + QBOHelper.VerifyEmployee(employee, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void EmployeeFindAllTestUsingoAuth() + { + Employee employee = Helper.FindOrAdd(qboContextoAuth, new Employee()); + + //Retrieving the Employee using FindAll + List employees = Helper.FindAll(qboContextoAuth, new Employee(), 1, 500); + Assert.IsNotNull(employees); + Assert.IsTrue(employees.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void EmployeeFindbyIdTestUsingoAuth() + { + //Creating the Employee for Adding + Employee employee = Helper.FindOrAdd(qboContextoAuth, new Employee()); + Employee found = Helper.FindById(qboContextoAuth, employee); + QBOHelper.VerifyEmployee(found, employee); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void EmployeeUpdateTestUsingoAuth() + { + Employee employee = Helper.FindOrAdd(qboContextoAuth, new Employee()); + //Change the data of added entity + Employee changed = QBOHelper.UpdateEmployee(qboContextoAuth, employee); + //Update the returned entity data + Employee updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Employee + QBOHelper.VerifyEmployee(changed, updated); + } + + [TestMethod] + public void EmployeeSparseUpdateTestUsingoAuth() + { + Employee employee = Helper.FindOrAdd(qboContextoAuth, new Employee()); + //Change the data of added entity + Employee changed = QBOHelper.SparseUpdateEmployee(qboContextoAuth, employee.Id, employee.SyncToken); + //Update the returned entity data + Employee updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Employee + QBOHelper.VerifyEmployeeSparseUpdate(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] [Ignore]//Not supported + public void EmployeeDeleteTestUsingoAuth() + { + //Creating the Employee for Adding + Employee employee = QBOHelper.CreateEmployee(qboContextoAuth); + //Adding the Employee + Employee added = Helper.Add(qboContextoAuth, employee); + //Delete the returned entity + try + { + Employee deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] [Ignore] + public void EmployeeVoidTestUsingoAuth() + { + //Creating the Employee for Adding + Employee employee = QBOHelper.CreateEmployee(qboContextoAuth); + //Adding the Employee + Employee added = Helper.Add(qboContextoAuth, employee); + //Void the returned entity + try + { + Employee voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void EmployeeCDCTestUsingoAuth() + { + Employee employee = Helper.FindOrAdd(qboContextoAuth, new Employee()); + + //Retrieving the Employee using CDC + List entities = Helper.CDC(qboContextoAuth, new Employee(), DateTime.Now.AddDays(-100)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void EmployeeBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + Employee existing = Helper.FindOrAdd(qboContextoAuth, new Employee()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateEmployee(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateEmployee(qboContextoAuth, existing)); + + //batchEntries.Add(OperationEnum.query, "select * from Employee"); + + //batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as Employee).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + + [TestMethod] + public void EmployeeQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + Employee existing = Helper.FindOrAdd(qboContextoAuth, new Employee()); + + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM Employee where Id='" + existing.Id + "'").ToList(); + + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void EmployeeAddAsyncTestsUsingoAuth() + { + //Creating the Employee for Add + Employee entity = QBOHelper.CreateEmployee(qboContextoAuth); + + Employee added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyEmployee(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void EmployeeRetrieveAsyncTestsUsingoAuth() + { + Employee employee = Helper.FindOrAdd(qboContextoAuth, new Employee()); + + //Retrieving the Employee using FindAll + Helper.FindAllAsync(qboContextoAuth, new Employee()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void EmployeeFindByIdAsyncTestsUsingoAuth() + { + Employee employee = Helper.FindOrAdd(qboContextoAuth, new Employee()); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, employee); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void EmployeeUpdatedAsyncTestsUsingoAuth() + { + Employee employee = Helper.FindOrAdd(qboContextoAuth, new Employee()); + + //Update the Employee + Employee updated = QBOHelper.UpdateEmployee(qboContextoAuth, employee); + //Call the service + Employee updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated Employee + QBOHelper.VerifyEmployee(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] [Ignore] //Not supported + public void EmployeeDeleteAsyncTestsUsingoAuth() + { + //Creating the Employee for Adding + Employee entity = QBOHelper.CreateEmployee(qboContextoAuth); + //Adding the Employee + Employee added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] [Ignore] + public void EmployeeVoidAsyncTestsUsingoAuth() + { + //Creating the Employee for Adding + Employee entity = QBOHelper.CreateEmployee(qboContextoAuth); + //Adding the Employee + Employee added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Estimate.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Estimate.cs new file mode 100644 index 0000000..de8253c --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Estimate.cs @@ -0,0 +1,335 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; +using Intuit.Ipp.QueryFilter; + + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class EstimateTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void EstimateAddTestUsingoAuth() + { + //Creating the Estimate for Add + Estimate estimate = QBOHelper.CreateEstimate(qboContextoAuth); + //Adding the Estimate + Estimate added = Helper.Add(qboContextoAuth, estimate); + //Verify the added Estimate + QBOHelper.VerifyEstimate(estimate, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void EstimateFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + EstimateAddTestUsingoAuth(); + + //Retrieving the Estimate using FindAll + List estimates = Helper.FindAll(qboContextoAuth, new Estimate(), 1, 500); + Assert.IsNotNull(estimates); + Assert.IsTrue(estimates.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void EstimateFindbyIdTestUsingoAuth() + { + //Creating the Estimate for Adding + Estimate estimate = QBOHelper.CreateEstimate(qboContextoAuth); + //Adding the Estimate + Estimate added = Helper.Add(qboContextoAuth, estimate); + Estimate found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyEstimate(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void EstimateUpdateTestUsingoAuth() + { + //Creating the Estimate for Adding + Estimate estimate = QBOHelper.CreateEstimate(qboContextoAuth); + //Adding the Estimate + Estimate added = Helper.Add(qboContextoAuth, estimate); + //Change the data of added entity + Estimate changed = QBOHelper.UpdateEstimate(qboContextoAuth, added); + //Update the returned entity data + Estimate updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Estimate + QBOHelper.VerifyEstimate(changed, updated); + } + + [TestMethod] + public void EstimateSparseUpdateTestUsingoAuth() + { + //Creating the Estimate for Adding + Estimate estimate = QBOHelper.CreateEstimate(qboContextoAuth); + //Adding the Estimate + Estimate added = Helper.Add(qboContextoAuth, estimate); + //Change the data of added entity + Estimate changed = QBOHelper.SparseUpdateEstimate(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + Estimate updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Estimate + QBOHelper.VerifyEstimateSparseUpdate(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void EstimateDeleteTestUsingoAuth() + { + //Creating the Estimate for Adding + Estimate estimate = QBOHelper.CreateEstimate(qboContextoAuth); + //Adding the Estimate + Estimate added = Helper.Add(qboContextoAuth, estimate); + //Delete the returned entity + try + { + Estimate deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] [Ignore] + public void EstimateVoidTestUsingoAuth() + { + //Creating the Estimate for Adding + Estimate estimate = QBOHelper.CreateEstimate(qboContextoAuth); + //Adding the Estimate + Estimate added = Helper.Add(qboContextoAuth, estimate); + //Void the returned entity + try + { + Estimate voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void EstimateCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + EstimateAddTestUsingoAuth(); + + //Retrieving the Estimate using FindAll + List estimates = Helper.CDC(qboContextoAuth, new Estimate(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(estimates); + Assert.IsTrue(estimates.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void EstimateBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + Estimate existing = Helper.FindOrAdd(qboContextoAuth, new Estimate()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateEstimate(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateEstimate(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from Estimate"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as Estimate).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void EstimateQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + Estimate existing = Helper.FindOrAdd(qboContextoAuth, new Estimate()); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM Estimate where Id='" + existing.Id + "'").ToList(); + + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void EstimateAddAsyncTestsUsingoAuth() + { + //Creating the Estimate for Add + Estimate entity = QBOHelper.CreateEstimate(qboContextoAuth); + + Estimate added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyEstimate(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void EstimateRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + EstimateAddTestUsingoAuth(); + + //Retrieving the Estimate using FindAll + Helper.FindAllAsync(qboContextoAuth, new Estimate()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void EstimateFindByIdAsyncTestsUsingoAuth() + { + //Creating the Estimate for Adding + Estimate entity = QBOHelper.CreateEstimate(qboContextoAuth); + //Adding the Estimate + Estimate added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void EstimateUpdatedAsyncTestsUsingoAuth() + { + //Creating the Estimate for Adding + Estimate entity = QBOHelper.CreateEstimate(qboContextoAuth); + //Adding the Estimate + Estimate added = Helper.Add(qboContextoAuth, entity); + + //Update the Estimate + Estimate updated = QBOHelper.UpdateEstimate(qboContextoAuth, added); + //Call the service + Estimate updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated Estimate + QBOHelper.VerifyEstimate(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void EstimateDeleteAsyncTestsUsingoAuth() + { + //Creating the Estimate for Adding + Estimate entity = QBOHelper.CreateEstimate(qboContextoAuth); + //Adding the Estimate + Estimate added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] [Ignore] + public void EstimateVoidAsyncTestsUsingoAuth() + { + //Creating the Estimate for Adding + Estimate entity = QBOHelper.CreateEstimate(qboContextoAuth); + //Adding the Estimate + Estimate added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/ExchangeRate.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/ExchangeRate.cs new file mode 100644 index 0000000..15144ed --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/ExchangeRate.cs @@ -0,0 +1,93 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class ExchangeRateTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region Test cases for FindbyId Operations + + [TestMethod] + [Ignore]//Id is not supported for ExchangeRate + public void ExchangeRateFindbyIdTestUsingoAuth() + { + var existing = Helper.FindAll(qboContextoAuth, new ExchangeRate(), 1, 100).FirstOrDefault(); + + QueryService entityQuery = new QueryService(qboContextoAuth); + + var found = entityQuery.ExecuteIdsQuery("Select * from ExchangeRate where Id='"+existing.Id+"'").FirstOrDefault(); + + + QBOHelper.VerifyExchangeRate(found, existing); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + [Ignore]//Fetch any other currency other than home currency else rate will not be updated + public void ExchangeRateUpdateTestUsingoAuth() + { + var existing = Helper.FindAll(qboContextoAuth, new ExchangeRate(), 1, 100).FirstOrDefault(); + + + //Change the data of added entity + ExchangeRate changed = QBOHelper.UpdateExchangeRate(qboContextoAuth, existing); + //Update the returned entity data + ExchangeRate updated = Helper.Update(qboContextoAuth, changed);//Verify the updated ExchangeRate + QBOHelper.VerifyExchangeRate(changed, updated); + } + + [TestMethod] + [Ignore]//Fetch any other currency other than home currency else rate will not be updated + public void ExchangeRateSparseUpdateTestUsingoAuth() + { + + var existing = Helper.FindAll(qboContextoAuth, new ExchangeRate(), 1, 100).FirstOrDefault(); + + + //Change the data of added entity + ExchangeRate changed = QBOHelper.UpdateExchangeRateSparse(qboContextoAuth, existing.Id, existing.SyncToken); + //Update the returned entity data + ExchangeRate updated = Helper.Update(qboContextoAuth, changed);//Verify the updated ExchangeRate + QBOHelper.VerifyExchangeRateSparse(changed, updated); + } + #endregion + + #region Test cases for Query + [TestMethod] + public void ExchangeRateQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + var existing = Helper.FindAll(qboContextoAuth, new ExchangeRate(), 1, 100); + + Assert.IsTrue(existing.Count() > 0); + } + + #endregion + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/FixedAsset.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/FixedAsset.cs new file mode 100644 index 0000000..4cdff75 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/FixedAsset.cs @@ -0,0 +1,334 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class FixedAssetTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void FixedAssetAddTestUsingoAuth() + { + //Creating the FixedAsset for Add + FixedAsset fixedAsset = QBOHelper.CreateFixedAsset(qboContextoAuth); + //Adding the FixedAsset + FixedAsset added = Helper.Add(qboContextoAuth, fixedAsset); + //Verify the added FixedAsset + QBOHelper.VerifyFixedAsset(fixedAsset, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void FixedAssetFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + FixedAssetAddTestUsingoAuth(); + + //Retrieving the FixedAsset using FindAll + List fixedAssets = Helper.FindAll(qboContextoAuth, new FixedAsset(), 1, 500); + Assert.IsNotNull(fixedAssets); + Assert.IsTrue(fixedAssets.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void FixedAssetFindbyIdTestUsingoAuth() + { + //Creating the FixedAsset for Adding + FixedAsset fixedAsset = QBOHelper.CreateFixedAsset(qboContextoAuth); + //Adding the FixedAsset + FixedAsset added = Helper.Add(qboContextoAuth, fixedAsset); + FixedAsset found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyFixedAsset(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void FixedAssetUpdateTestUsingoAuth() + { + //Creating the FixedAsset for Adding + FixedAsset fixedAsset = QBOHelper.CreateFixedAsset(qboContextoAuth); + //Adding the FixedAsset + FixedAsset added = Helper.Add(qboContextoAuth, fixedAsset); + //Change the data of added entity + FixedAsset changed = QBOHelper.UpdateFixedAsset(qboContextoAuth, added); + //Update the returned entity data + FixedAsset updated = Helper.Update(qboContextoAuth, changed);//Verify the updated FixedAsset + QBOHelper.VerifyFixedAsset(changed, updated); + } + + [TestMethod] + public void FixedAssetSparseUpdateTestUsingoAuth() + { + //Creating the FixedAsset for Adding + FixedAsset fixedAsset = QBOHelper.CreateFixedAsset(qboContextoAuth); + //Adding the FixedAsset + FixedAsset added = Helper.Add(qboContextoAuth, fixedAsset); + //Change the data of added entity + FixedAsset changed = QBOHelper.UpdateFixedAssetSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + FixedAsset updated = Helper.Update(qboContextoAuth, changed);//Verify the updated FixedAsset + QBOHelper.VerifyFixedAssetSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void FixedAssetDeleteTestUsingoAuth() + { + //Creating the FixedAsset for Adding + FixedAsset fixedAsset = QBOHelper.CreateFixedAsset(qboContextoAuth); + //Adding the FixedAsset + FixedAsset added = Helper.Add(qboContextoAuth, fixedAsset); + //Delete the returned entity + try + { + FixedAsset deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + public void FixedAssetVoidTestUsingoAuth() + { + //Creating the entity for Adding + FixedAsset entity = QBOHelper.CreateFixedAsset(qboContextoAuth); + //Adding the entity + FixedAsset added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + FixedAsset voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void FixedAssetCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + FixedAssetAddTestUsingoAuth(); + + //Retrieving the FixedAsset using CDC + List entities = Helper.CDC(qboContextoAuth, new FixedAsset(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void FixedAssetBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + FixedAsset existing = Helper.FindOrAdd(qboContextoAuth, new FixedAsset()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateFixedAsset(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateFixedAsset(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from FixedAsset"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as FixedAsset).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void FixedAssetQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + FixedAsset existing = Helper.FindOrAdd(qboContextoAuth, new FixedAsset()); + int count = entityQuery.ExecuteIdsQuery("Select * from FixedAsset where Id='" + existing.Id + "'").Count; + Assert.IsTrue(count > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void FixedAssetAddAsyncTestsUsingoAuth() + { + //Creating the FixedAsset for Add + FixedAsset entity = QBOHelper.CreateFixedAsset(qboContextoAuth); + + FixedAsset added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyFixedAsset(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void FixedAssetRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + FixedAssetAddTestUsingoAuth(); + + //Retrieving the FixedAsset using FindAll + Helper.FindAllAsync(qboContextoAuth, new FixedAsset()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void FixedAssetFindByIdAsyncTestsUsingoAuth() + { + //Creating the FixedAsset for Adding + FixedAsset entity = QBOHelper.CreateFixedAsset(qboContextoAuth); + //Adding the FixedAsset + FixedAsset added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void FixedAssetUpdatedAsyncTestsUsingoAuth() + { + //Creating the FixedAsset for Adding + FixedAsset entity = QBOHelper.CreateFixedAsset(qboContextoAuth); + //Adding the FixedAsset + FixedAsset added = Helper.Add(qboContextoAuth, entity); + + //Update the FixedAsset + FixedAsset updated = QBOHelper.UpdateFixedAsset(qboContextoAuth, added); + //Call the service + FixedAsset updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated FixedAsset + QBOHelper.VerifyFixedAsset(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void FixedAssetDeleteAsyncTestsUsingoAuth() + { + //Creating the FixedAsset for Adding + FixedAsset entity = QBOHelper.CreateFixedAsset(qboContextoAuth); + //Adding the FixedAsset + FixedAsset added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] + public void FixedAssetVoidAsyncTestsUsingoAuth() + { + //Creating the FixedAsset for Adding + FixedAsset entity = QBOHelper.CreateFixedAsset(qboContextoAuth); + //Adding the FixedAsset + FixedAsset added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/GlobalTaxService.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/GlobalTaxService.cs new file mode 100644 index 0000000..a2a5fef --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/GlobalTaxService.cs @@ -0,0 +1,91 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; +using Intuit.Ipp.QueryFilter; + +using System.Configuration; +using Intuit.Ipp.GlobalTaxService; + + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] //Works only for US realms, not yet supported for global + public class GlobalTaxServiceTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + + + #region Sync Methods + + #region Test cases for Add Operations + + + + [TestMethod] + public void TaxCodeAddTestUsingoAuth() + { + String guid = Helper.GetGuid(); + GlobalTaxService.GlobalTaxService taxSvc = new GlobalTaxService.GlobalTaxService(qboContextoAuth); + Intuit.Ipp.Data.TaxService taxCodetobeAdded = new Data.TaxService(); + taxCodetobeAdded.TaxCode = "taxC_"+guid; + + TaxAgency taxagency = Helper.FindOrAdd(qboContextoAuth, new TaxAgency()); + + + List lstTaxRate = new List(); + TaxRateDetails taxdetail1 = new TaxRateDetails(); + taxdetail1.TaxRateName = "taxR1_"+guid; + taxdetail1.RateValue = 3m; + taxdetail1.RateValueSpecified = true; + taxdetail1.TaxAgencyId = taxagency.Id.ToString(); + taxdetail1.TaxApplicableOn = TaxRateApplicableOnEnum.Sales; + taxdetail1.TaxApplicableOnSpecified = true; + lstTaxRate.Add(taxdetail1); + + TaxRateDetails taxdetail2 = new TaxRateDetails(); + taxdetail2.TaxRateName = "taxR2_" + guid; + taxdetail2.RateValue = 2m; + taxdetail2.RateValueSpecified = true; + taxdetail2.TaxAgencyId = taxagency.Id.ToString(); + taxdetail2.TaxApplicableOn = TaxRateApplicableOnEnum.Sales; + taxdetail2.TaxApplicableOnSpecified = true; + lstTaxRate.Add(taxdetail2); + + //TaxRateDetails taxdetail3 = new TaxRateDetails(); + //taxdetail3.TaxRateName = "rate298"; + //taxdetail3.TaxRateId = "2"; + + //lstTaxRate.Add(taxdetail3); + + taxCodetobeAdded.TaxRateDetails = lstTaxRate.ToArray(); + + Intuit.Ipp.Data.TaxService taxCodeAdded = taxSvc.AddTaxCode(taxCodetobeAdded); + Assert.IsNotNull(taxCodeAdded.TaxCodeId); + } + + #endregion + + #endregion + + + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/InventorySite.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/InventorySite.cs new file mode 100644 index 0000000..9d3d3d0 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/InventorySite.cs @@ -0,0 +1,334 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class InventorySiteTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void InventorySiteAddTestUsingoAuth() + { + //Creating the InventorySite for Add + InventorySite inventorySite = QBOHelper.CreateInventorySite(qboContextoAuth); + //Adding the InventorySite + InventorySite added = Helper.Add(qboContextoAuth, inventorySite); + //Verify the added InventorySite + QBOHelper.VerifyInventorySite(inventorySite, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void InventorySiteFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + InventorySiteAddTestUsingoAuth(); + + //Retrieving the InventorySite using FindAll + List inventorySites = Helper.FindAll(qboContextoAuth, new InventorySite(), 1, 500); + Assert.IsNotNull(inventorySites); + Assert.IsTrue(inventorySites.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void InventorySiteFindbyIdTestUsingoAuth() + { + //Creating the InventorySite for Adding + InventorySite inventorySite = QBOHelper.CreateInventorySite(qboContextoAuth); + //Adding the InventorySite + InventorySite added = Helper.Add(qboContextoAuth, inventorySite); + InventorySite found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyInventorySite(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void InventorySiteUpdateTestUsingoAuth() + { + //Creating the InventorySite for Adding + InventorySite inventorySite = QBOHelper.CreateInventorySite(qboContextoAuth); + //Adding the InventorySite + InventorySite added = Helper.Add(qboContextoAuth, inventorySite); + //Change the data of added entity + InventorySite changed = QBOHelper.UpdateInventorySite(qboContextoAuth, added); + //Update the returned entity data + InventorySite updated = Helper.Update(qboContextoAuth, changed);//Verify the updated InventorySite + QBOHelper.VerifyInventorySite(changed, updated); + } + + [TestMethod] + public void InventorySiteSparseUpdateTestUsingoAuth() + { + //Creating the InventorySite for Adding + InventorySite inventorySite = QBOHelper.CreateInventorySite(qboContextoAuth); + //Adding the InventorySite + InventorySite added = Helper.Add(qboContextoAuth, inventorySite); + //Change the data of added entity + InventorySite changed = QBOHelper.UpdateInventorySiteSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + InventorySite updated = Helper.Update(qboContextoAuth, changed);//Verify the updated InventorySite + QBOHelper.VerifyInventorySiteSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void InventorySiteDeleteTestUsingoAuth() + { + //Creating the InventorySite for Adding + InventorySite inventorySite = QBOHelper.CreateInventorySite(qboContextoAuth); + //Adding the InventorySite + InventorySite added = Helper.Add(qboContextoAuth, inventorySite); + //Delete the returned entity + try + { + InventorySite deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + public void InventorySiteVoidTestUsingoAuth() + { + //Creating the entity for Adding + InventorySite entity = QBOHelper.CreateInventorySite(qboContextoAuth); + //Adding the entity + InventorySite added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + InventorySite voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void InventorySiteCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + InventorySiteAddTestUsingoAuth(); + + //Retrieving the InventorySite using CDC + List entities = Helper.CDC(qboContextoAuth, new InventorySite(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void InventorySiteBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + InventorySite existing = Helper.FindOrAdd(qboContextoAuth, new InventorySite()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateInventorySite(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateInventorySite(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from InventorySite"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as InventorySite).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void InventorySiteQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + InventorySite existing = Helper.FindOrAdd(qboContextoAuth, new InventorySite()); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + int count = entityQuery.ExecuteIdsQuery("Select * from InventorySite where Id='" + existing.Id + "'").Count; + Assert.IsTrue(count > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void InventorySiteAddAsyncTestsUsingoAuth() + { + //Creating the InventorySite for Add + InventorySite entity = QBOHelper.CreateInventorySite(qboContextoAuth); + + InventorySite added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyInventorySite(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void InventorySiteRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + InventorySiteAddTestUsingoAuth(); + + //Retrieving the InventorySite using FindAll + Helper.FindAllAsync(qboContextoAuth, new InventorySite()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void InventorySiteFindByIdAsyncTestsUsingoAuth() + { + //Creating the InventorySite for Adding + InventorySite entity = QBOHelper.CreateInventorySite(qboContextoAuth); + //Adding the InventorySite + InventorySite added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void InventorySiteUpdatedAsyncTestsUsingoAuth() + { + //Creating the InventorySite for Adding + InventorySite entity = QBOHelper.CreateInventorySite(qboContextoAuth); + //Adding the InventorySite + InventorySite added = Helper.Add(qboContextoAuth, entity); + + //Update the InventorySite + InventorySite updated = QBOHelper.UpdateInventorySite(qboContextoAuth, added); + //Call the service + InventorySite updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated InventorySite + QBOHelper.VerifyInventorySite(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void InventorySiteDeleteAsyncTestsUsingoAuth() + { + //Creating the InventorySite for Adding + InventorySite entity = QBOHelper.CreateInventorySite(qboContextoAuth); + //Adding the InventorySite + InventorySite added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] + public void InventorySiteVoidAsyncTestsUsingoAuth() + { + //Creating the InventorySite for Adding + InventorySite entity = QBOHelper.CreateInventorySite(qboContextoAuth); + //Adding the InventorySite + InventorySite added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Invoice.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Invoice.cs new file mode 100644 index 0000000..0ec6eb9 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Invoice.cs @@ -0,0 +1,337 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; +using Intuit.Ipp.QueryFilter; + + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class InvoiceTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void InvoiceAddTestUsingoAuth() + { + //Creating the Invoice for Add + Invoice invoice = QBOHelper.CreateInvoice(qboContextoAuth); + //Adding the Invoice + Invoice added = Helper.Add(qboContextoAuth, invoice); + //Verify the added Invoice + QBOHelper.VerifyInvoice(invoice, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void InvoiceFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + InvoiceAddTestUsingoAuth(); + + //Retrieving the Invoice using FindAll + List invoices = Helper.FindAll(qboContextoAuth, new Invoice(), 1, 500); + Assert.IsNotNull(invoices); + Assert.IsTrue(invoices.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void InvoiceFindbyIdTestUsingoAuth() + { + //Creating the Invoice for Adding + Invoice invoice = QBOHelper.CreateInvoice(qboContextoAuth); + //Adding the Invoice + Invoice added = Helper.Add(qboContextoAuth, invoice); + Invoice found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyInvoice(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void InvoiceUpdateTestUsingoAuth() + { + //Creating the Invoice for Adding + Invoice invoice = QBOHelper.CreateInvoice(qboContextoAuth); + //Adding the Invoice + Invoice added = Helper.Add(qboContextoAuth, invoice); + //Change the data of added entity + Invoice changed = QBOHelper.UpdateInvoice(qboContextoAuth, added); + //Update the returned entity data + Invoice updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Invoice + QBOHelper.VerifyInvoice(changed, updated); + } + + + [TestMethod] + public void InvoiceSparseUpdateTestUsingoAuth() + { + //Creating the Invoice for Adding + Invoice invoice = QBOHelper.CreateInvoice(qboContextoAuth); + //Adding the Invoice + Invoice added = Helper.Add(qboContextoAuth, invoice); + //Change the data of added entity + Invoice changed = QBOHelper.SparseUpdateInvoice(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + Invoice updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Invoice + QBOHelper.VerifyInvoiceSparseUpdate(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void InvoiceDeleteTestUsingoAuth() + { + //Creating the Invoice for Adding + Invoice invoice = QBOHelper.CreateInvoice(qboContextoAuth); + //Adding the Invoice + Invoice added = Helper.Add(qboContextoAuth, invoice); + //Delete the returned entity + try + { + Invoice deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + + [TestMethod] [Ignore] + public void InvoiceVoidTestUsingoAuth() + { + //Creating the Invoice for Adding + Invoice invoice = QBOHelper.CreateInvoice(qboContextoAuth); + //Adding the Invoice + Invoice added = Helper.Add(qboContextoAuth, invoice); + //Void the returned entity + try + { + Invoice voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void InvoiceCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + //InvoiceAddTestUsingoAuth(); + + //Retrieving the Invoice using FindAll + List invoices = Helper.CDC(qboContextoAuth, new Invoice(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(invoices); + Assert.IsTrue(invoices.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void InvoiceBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + Invoice existing = Helper.FindOrAdd(qboContextoAuth, new Invoice()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateInvoice(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateInvoice(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from Invoice"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as Invoice).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void InvoiceQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + Invoice existing = Helper.FindOrAdd(qboContextoAuth, new Invoice()); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM Invoice where Id='" + existing.Id + "'").ToList(); + + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void InvoiceAddAsyncTestsUsingoAuth() + { + //Creating the Invoice for Add + Invoice entity = QBOHelper.CreateInvoice(qboContextoAuth); + + Invoice added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyInvoice(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void InvoiceRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + InvoiceAddTestUsingoAuth(); + + //Retrieving the Invoice using FindAll + Helper.FindAllAsync(qboContextoAuth, new Invoice()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void InvoiceFindByIdAsyncTestsUsingoAuth() + { + //Creating the Invoice for Adding + Invoice entity = QBOHelper.CreateInvoice(qboContextoAuth); + //Adding the Invoice + Invoice added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void InvoiceUpdatedAsyncTestsUsingoAuth() + { + //Creating the Invoice for Adding + Invoice entity = QBOHelper.CreateInvoice(qboContextoAuth); + //Adding the Invoice + Invoice added = Helper.Add(qboContextoAuth, entity); + + //Update the Invoice + Invoice updated = QBOHelper.UpdateInvoice(qboContextoAuth, added); + //Call the service + Invoice updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated Invoice + QBOHelper.VerifyInvoice(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void InvoiceDeleteAsyncTestsUsingoAuth() + { + //Creating the Invoice for Adding + Invoice entity = QBOHelper.CreateInvoice(qboContextoAuth); + //Adding the Invoice + Invoice added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] [Ignore] + public void InvoiceVoidAsyncTestsUsingoAuth() + { + //Creating the Invoice for Adding + Invoice entity = QBOHelper.CreateInvoice(qboContextoAuth); + //Adding the Invoice + Invoice added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Item.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Item.cs new file mode 100644 index 0000000..0663683 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Item.cs @@ -0,0 +1,413 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; +using Intuit.Ipp.QueryFilter; + + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class ItemTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + + + #region Test cases for Add Operations France + + [TestMethod] + public void ItemAddTestUsingoAuthFrance() + { + //Creating the Item for Add + //Item item = QBOHelper.CreateItem(qboContextoAuth); + + Item item = QBOHelper.CreateItemFrance(qboContextoAuth); + //Adding the Item + Item added = Helper.Add(qboContextoAuth, item); + //Verify the added Item + // QBOHelper.VerifyItem(item, added); + QBOHelper.VerifyItemFrance(item, added); + } + + #endregion + + #region Test cases for Add Operations + + [TestMethod] + public void ItemAddTestUsingoAuth() + { + //Creating the Item for Add + Item item = QBOHelper.CreateItem(qboContextoAuth); + //Adding the Item + Item added = Helper.Add(qboContextoAuth, item); + //Verify the added Item + QBOHelper.VerifyItem(item, added); + + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void ItemFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + ItemAddTestUsingoAuth(); + + //Retrieving the Item using FindAll + List items = Helper.FindAll(qboContextoAuth, new Item(), 1, 500); + Assert.IsNotNull(items); + Assert.IsTrue(items.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void ItemFindbyIdTestUsingoAuth() + { + //Creating the Item for Adding + Item item = QBOHelper.CreateItem(qboContextoAuth); + //Adding the Item + Item added = Helper.Add(qboContextoAuth, item); + Item found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyItem(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void ItemUpdateTestUsingoAuth() + { + //Creating the Item for Adding + Item item = QBOHelper.CreateItem(qboContextoAuth); + + //Adding the Item + Item added = Helper.Add(qboContextoAuth, item); + //Change the data of added entity + Item changed = QBOHelper.UpdateItem(qboContextoAuth, added); + //Update the returned entity data + Item updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Item + QBOHelper.VerifyItem(changed, updated); + } + + #region Test cases for Update,donotupdate Operations France + [TestMethod] + public void ItemUpdateTestUsingoAuthFrance() + { + //Creating the Item for Adding + //Item item = QBOHelper.CreateItem(qboContextoAuth); + Item item = QBOHelper.CreateItemFrance(qboContextoAuth); + //Adding the Item + Item added = Helper.Add(qboContextoAuth, item); + //Change the data of added entity + Item changed = QBOHelper.UpdateItemFrance(qboContextoAuth, added); + //Update the returned entity data + Item updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Item + QBOHelper.VerifyItemFrance(changed, updated); + } + + + [TestMethod] + public void ItemdDonotUpdateAccTestUsingoAuthFrance() + { + //Creating the Item for Adding + Item item = QBOHelper.CreateItemFrance(qboContextoAuth); + //Adding the Item + Item added = Helper.Add(qboContextoAuth, item); + //Change the data of added entity + Item changed = QBOHelper.UpdateItemFrance(qboContextoAuth, added); + //Update the returned entity data + Item updated = Helper.DonotUpdateAccountOnTxnsFrance(qboContextoAuth, changed);//Verify the updated Item + QBOHelper.VerifyItemFrance(changed, updated); + } + + #endregion + + + [TestMethod] + public void ItemSparseUpdateTestUsingoAuth() + { + //Creating the Item for Adding + Item item = QBOHelper.CreateItem(qboContextoAuth); + //Adding the Item + Item added = Helper.Add(qboContextoAuth, item); + //Change the data of added entity + Item changed = QBOHelper.SparseUpdateItem(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + Item updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Item + QBOHelper.VerifyItemSparseUpdate(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] [Ignore] //TestComment: Returns Operation Not Supported + public void ItemDeleteTestUsingoAuth() + { + //Creating the Item for Adding + Item item = QBOHelper.CreateItem(qboContextoAuth); + //Adding the Item + Item added = Helper.Add(qboContextoAuth, item); + //Delete the returned entity + try + { + Item deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] [Ignore] + public void ItemVoidTestUsingoAuth() + { + //Creating the Item for Adding + Item item = QBOHelper.CreateItem(qboContextoAuth); + //Adding the Item + Item added = Helper.Add(qboContextoAuth, item); + //Void the returned entity + try + { + Item voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void ItemCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + ItemAddTestUsingoAuth(); + + //Retrieving the Item using FindAll + List items = Helper.CDC(qboContextoAuth, new Item(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(items); + Assert.IsTrue(items.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void ItemBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + Item existing = Helper.FindOrAdd(qboContextoAuth, new Item()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateItem(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateItem(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from Item"); + + //batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as Item).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void ItemQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + Item existing = Helper.FindOrAdd(qboContextoAuth, new Item()); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM Item where Id='" + existing.Id + "'").ToList(); + + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void ItemAddAsyncTestsUsingoAuth() + { + //Creating the Item for Add + Item entity = QBOHelper.CreateItem(qboContextoAuth); + + Item added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyItem(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void ItemRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + ItemAddTestUsingoAuth(); + + //Retrieving the Item using FindAll + Helper.FindAllAsync(qboContextoAuth, new Item()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void ItemFindByIdAsyncTestsUsingoAuth() + { + //Creating the Item for Adding + Item entity = QBOHelper.CreateItem(qboContextoAuth); + //Adding the Item + Item added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void ItemUpdatedAsyncTestsUsingoAuth() + { + //Creating the Item for Adding + Item entity = QBOHelper.CreateItem(qboContextoAuth); + //Adding the Item + Item added = Helper.Add(qboContextoAuth, entity); + + //Update the Item + Item updated = QBOHelper.UpdateItem(qboContextoAuth, added); + //Call the service + Item updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated Item + QBOHelper.VerifyItem(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] [Ignore] //TestComment: Returns Operation Not Supported + public void ItemDeleteAsyncTestsUsingoAuth() + { + //Creating the Item for Adding + Item entity = QBOHelper.CreateItem(qboContextoAuth); + //Adding the Item + Item added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] [Ignore] + public void ItemVoidAsyncTestsUsingoAuth() + { + //Creating the Item for Adding + Item entity = QBOHelper.CreateItem(qboContextoAuth); + //Adding the Item + Item added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + //newly added + #region Test Cases for Do Not Update Account Operation + + [TestMethod][Ignore] + public void ItemDonotUpdatedaccAsyncTestsUsingoAuthFrance() + { + //Creating the Item for Adding + Item entity = QBOHelper.CreateItemFrance(qboContextoAuth); + //Adding the Item + Item added = Helper.Add(qboContextoAuth, entity); + + //Update the Item + // Item updated = QBOHelper.UpdateItem(qboContextoAuth, added); + Item updated = QBOHelper.UpdateItemFrance(qboContextoAuth, added); + //Call the service + Item updatedReturned = Helper.DonotUpdateAccountOnTxnsAsyncFrance(qboContextoAuth, updated); + //Verify updated Item + QBOHelper.VerifyItemFrance(updated, updatedReturned); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/JobType.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/JobType.cs new file mode 100644 index 0000000..8ac2282 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/JobType.cs @@ -0,0 +1,335 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class JobTypeTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void JobTypeAddTestUsingoAuth() + { + //Creating the JobType for Add + JobType jobType = QBOHelper.CreateJobType(qboContextoAuth); + //Adding the JobType + JobType added = Helper.Add(qboContextoAuth, jobType); + //Verify the added JobType + QBOHelper.VerifyJobType(jobType, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void JobTypeFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + JobTypeAddTestUsingoAuth(); + + //Retrieving the JobType using FindAll + List jobTypes = Helper.FindAll(qboContextoAuth, new JobType(), 1, 500); + Assert.IsNotNull(jobTypes); + Assert.IsTrue(jobTypes.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void JobTypeFindbyIdTestUsingoAuth() + { + //Creating the JobType for Adding + JobType jobType = QBOHelper.CreateJobType(qboContextoAuth); + //Adding the JobType + JobType added = Helper.Add(qboContextoAuth, jobType); + JobType found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyJobType(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void JobTypeUpdateTestUsingoAuth() + { + //Creating the JobType for Adding + JobType jobType = QBOHelper.CreateJobType(qboContextoAuth); + //Adding the JobType + JobType added = Helper.Add(qboContextoAuth, jobType); + //Change the data of added entity + JobType changed = QBOHelper.UpdateJobType(qboContextoAuth, added); + //Update the returned entity data + JobType updated = Helper.Update(qboContextoAuth, changed);//Verify the updated JobType + QBOHelper.VerifyJobType(changed, updated); + } + + [TestMethod] + public void JobTypeSparseUpdateTestUsingoAuth() + { + //Creating the JobType for Adding + JobType jobType = QBOHelper.CreateJobType(qboContextoAuth); + //Adding the JobType + JobType added = Helper.Add(qboContextoAuth, jobType); + //Change the data of added entity + JobType changed = QBOHelper.UpdateJobTypeSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + JobType updated = Helper.Update(qboContextoAuth, changed);//Verify the updated JobType + QBOHelper.VerifyJobTypeSparse(changed, updated); + } + + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void JobTypeDeleteTestUsingoAuth() + { + //Creating the JobType for Adding + JobType jobType = QBOHelper.CreateJobType(qboContextoAuth); + //Adding the JobType + JobType added = Helper.Add(qboContextoAuth, jobType); + //Delete the returned entity + try + { + JobType deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + public void JobTypeVoidTestUsingoAuth() + { + //Creating the entity for Adding + JobType entity = QBOHelper.CreateJobType(qboContextoAuth); + //Adding the entity + JobType added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + JobType voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void JobTypeCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + JobTypeAddTestUsingoAuth(); + + //Retrieving the JobType using CDC + List entities = Helper.CDC(qboContextoAuth, new JobType(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void JobTypeBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + JobType existing = Helper.FindOrAdd(qboContextoAuth, new JobType()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateJobType(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateJobType(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from JobType"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as JobType).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void JobTypeQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + JobType existing = Helper.FindOrAdd(qboContextoAuth, new JobType()); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + int count = entityQuery.ExecuteIdsQuery("Select * from JobType where Id='" + existing.Id + "'").Count; + Assert.IsTrue(count > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void JobTypeAddAsyncTestsUsingoAuth() + { + //Creating the JobType for Add + JobType entity = QBOHelper.CreateJobType(qboContextoAuth); + + JobType added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyJobType(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void JobTypeRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + JobTypeAddTestUsingoAuth(); + + //Retrieving the JobType using FindAll + Helper.FindAllAsync(qboContextoAuth, new JobType()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void JobTypeFindByIdAsyncTestsUsingoAuth() + { + //Creating the JobType for Adding + JobType entity = QBOHelper.CreateJobType(qboContextoAuth); + //Adding the JobType + JobType added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void JobTypeUpdatedAsyncTestsUsingoAuth() + { + //Creating the JobType for Adding + JobType entity = QBOHelper.CreateJobType(qboContextoAuth); + //Adding the JobType + JobType added = Helper.Add(qboContextoAuth, entity); + + //Update the JobType + JobType updated = QBOHelper.UpdateJobType(qboContextoAuth, added); + //Call the service + JobType updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated JobType + QBOHelper.VerifyJobType(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void JobTypeDeleteAsyncTestsUsingoAuth() + { + //Creating the JobType for Adding + JobType entity = QBOHelper.CreateJobType(qboContextoAuth); + //Adding the JobType + JobType added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] + public void JobTypeVoidAsyncTestsUsingoAuth() + { + //Creating the JobType for Adding + JobType entity = QBOHelper.CreateJobType(qboContextoAuth); + //Adding the JobType + JobType added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/JournalCode.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/JournalCode.cs new file mode 100644 index 0000000..d864add --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/JournalCode.cs @@ -0,0 +1,433 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; +using Intuit.Ipp.QueryFilter; + + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class JournalCodeTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void AddExpensesJournalCodeTestUsingoAuth() + { + //Creating the JournalCode for Add + JournalCode journalCode = QBOHelper.CreateJournalCode(qboContextoAuth, JournalCodeTypeEnum.Expenses); + + //Adding the JournalCode + JournalCode added = Helper.Add(qboContextoAuth, journalCode); + //Verify the added Account + QBOHelper.VerifyJournalCode(journalCode, added); + + } + + + [TestMethod] + public void AddSalesJournalCodeTestUsingoAuth() + { + //Creating the JournalCode for Add + JournalCode journalCode = QBOHelper.CreateJournalCode(qboContextoAuth, JournalCodeTypeEnum.Sales); + + //Adding the JournalCode + JournalCode added = Helper.Add(qboContextoAuth, journalCode); + //Verify the added Account + QBOHelper.VerifyJournalCode(journalCode, added); + + } + + + [TestMethod] + public void AddBankJournalCodeTestUsingoAuth() + { + //Creating the JournalCode for Add + JournalCode journalCode = QBOHelper.CreateJournalCode(qboContextoAuth, JournalCodeTypeEnum.Bank); + + //Adding the JournalCode + JournalCode added = Helper.Add(qboContextoAuth, journalCode); + //Verify the added Account + QBOHelper.VerifyJournalCode(journalCode, added); + } + + + + [TestMethod] + [Ignore] //IgnoreReason: check "language issue" + public void AddNouveauxJournalCodeTestUsingoAuth() + { + //Creating the JournalCode for Add + JournalCode journalCode = QBOHelper.CreateJournalCode(qboContextoAuth, JournalCodeTypeEnum.Nouveaux); + + //Adding the JournalCode + JournalCode added = Helper.Add(qboContextoAuth, journalCode); + //Verify the added Account + QBOHelper.VerifyJournalCode(journalCode, added); + } + + + + [TestMethod] + public void AddWagesJournalCodeTestUsingoAuth() + { + //Creating the JournalCode for Add + JournalCode journalCode = QBOHelper.CreateJournalCode(qboContextoAuth, JournalCodeTypeEnum.Wages); + + //Adding the JournalCode + JournalCode added = Helper.Add(qboContextoAuth, journalCode); + //Verify the added Account + QBOHelper.VerifyJournalCode(journalCode, added); + } + + + [TestMethod] + public void AddCashJournalCodeTestUsingoAuth() + { + //Creating the JournalCode for Add + JournalCode journalCode = QBOHelper.CreateJournalCode(qboContextoAuth, JournalCodeTypeEnum.Cash); + + //Adding the JournalCode + JournalCode added = Helper.Add(qboContextoAuth, journalCode); + //Verify the added Account + QBOHelper.VerifyJournalCode(journalCode, added); + } + + + + [TestMethod] + public void AddOthersJournalCodeTestUsingoAuth() + { + //Creating the JournalCode for Add + JournalCode journalCode = QBOHelper.CreateJournalCode(qboContextoAuth, JournalCodeTypeEnum.Others); + + //Adding the JournalCode + JournalCode added = Helper.Add(qboContextoAuth, journalCode); + //Verify the added Account + QBOHelper.VerifyJournalCode(journalCode, added); + } + + + #endregion Test cases for Add Operations + + #region Test cases for FindAll Operations + + [TestMethod] + public void JournalCodeFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + AddExpensesJournalCodeTestUsingoAuth(); + + //Retrieving the JournalCode using FindAll + List journalCodes = Helper.FindAll(qboContextoAuth, new JournalCode(), 1, 500); + Assert.IsNotNull(journalCodes); + Assert.IsTrue(journalCodes.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void JournalCodeFindbyIdTestUsingoAuth() + { + //Creating the JournalCode for Adding + JournalCode journalCode = QBOHelper.CreateJournalCode(qboContextoAuth, JournalCodeTypeEnum.Expenses); + //Adding the journalCode + JournalCode added = Helper.Add(qboContextoAuth, journalCode); + JournalCode found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyJournalCode(found, added); + } + + #endregion + + #region Test cases for Update Operations + //check + [TestMethod] + public void JournalCodeUpdateTestUsingoAuth() + { + //Creating the JournalCode for Adding + JournalCode journalCode = QBOHelper.CreateJournalCode(qboContextoAuth, JournalCodeTypeEnum.Expenses); + //Adding the JournalCode + JournalCode added = Helper.Add(qboContextoAuth, journalCode); + //Change the data of added entity + JournalCode changed = QBOHelper.UpdateJournalCode(qboContextoAuth, added); + //Update the returned entity data + JournalCode updated = Helper.Update(qboContextoAuth, changed);//Verify the updated JournalCode + QBOHelper.VerifyJournalCode(changed, updated); + } + + [TestMethod] + + public void JournalCodeSparseUpdateTestUsingoAuth() + { + //Creating the JournalCode for Adding + JournalCode journalCode = QBOHelper.CreateJournalCode(qboContextoAuth, JournalCodeTypeEnum.Expenses); + //Adding the JournalCode + JournalCode added = Helper.Add(qboContextoAuth, journalCode); + //Change the data of added entity + JournalCode changed = QBOHelper.UpdateJournalCodeSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + JournalCode updated = Helper.Update(qboContextoAuth, changed);//Verify the updated JournalCode + QBOHelper.VerifyJournalCodeSparse(changed, updated); + } + //check + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + [Ignore] //IgnoreReason: Not supported + public void JournalCodeDeleteTestUsingoAuth() + { + //Creating the JournalCode for Adding + JournalCode journalCode = QBOHelper.CreateJournalCode(qboContextoAuth, JournalCodeTypeEnum.Expenses); + //Adding the JournalCode + JournalCode added = Helper.Add(qboContextoAuth, journalCode); + //Delete the returned entity + try + { + JournalCode deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for Void Operations + + [TestMethod] + [Ignore] //IgnoreReason: Not supported + public void JournalCodeVoidTestUsingoAuth() + { + //Creating the entity for Adding + JournalCode entity = QBOHelper.CreateJournalCode(qboContextoAuth, JournalCodeTypeEnum.Expenses); + //Adding the entity + JournalCode added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + JournalCode voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + [Ignore] //IgnoreReason: Not supported + public void JournalCodeCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + AddExpensesJournalCodeTestUsingoAuth(); + + //Retrieving the JournalCode using CDC + List entities = Helper.CDC(qboContextoAuth, new JournalCode(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void JournalCodeBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + JournalCode existing = Helper.FindOrAdd(qboContextoAuth, new JournalCode()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateJournalCode(qboContextoAuth, JournalCodeTypeEnum.Expenses)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateJournalCode(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from JournalCode"); + + + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as JournalCode).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void JournalCodeQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + JournalCode existing = Helper.FindOrAdd(qboContextoAuth, new JournalCode()); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM JournalCode where Id='" + existing.Id + "'").ToList(); + + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + + #endregion + + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void JournalCodeAddAsyncTestsUsingoAuth() + { + //Creating the JournalCode for Add + JournalCode entity = QBOHelper.CreateJournalCode(qboContextoAuth, JournalCodeTypeEnum.Expenses); + + JournalCode added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyJournalCode(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void JournalCodeRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + JournalCodeAddAsyncTestsUsingoAuth(); + + //Retrieving the JournalCode using FindAll + Helper.FindAllAsync(qboContextoAuth, new JournalCode()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void JournalCodeFindByIdAsyncTestsUsingoAuth() + { + //Creating the JournalCode for Adding + JournalCode entity = QBOHelper.CreateJournalCode(qboContextoAuth, JournalCodeTypeEnum.Expenses); + //Adding the JournalCode + JournalCode added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void JournalCodeUpdatedAsyncTestsUsingoAuth() + { + //Creating the JournalCode for Adding + JournalCode entity = QBOHelper.CreateJournalCode(qboContextoAuth, JournalCodeTypeEnum.Expenses); + //Adding the JournalCode + JournalCode added = Helper.Add(qboContextoAuth, entity); + + //Update the JournalCode + JournalCode updated = QBOHelper.UpdateJournalCode(qboContextoAuth, added); + //Call the service + JournalCode updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated JournalCode + QBOHelper.VerifyJournalCode(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + [Ignore] //IgnoreReason: Not supported + public void JournalCodeDeleteAsyncTestsUsingoAuth() + { + //Creating the JournalCode for Adding + JournalCode entity = QBOHelper.CreateJournalCode(qboContextoAuth, JournalCodeTypeEnum.Expenses); + //Adding the JournalCode + JournalCode added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] + [Ignore] //IgnoreReason: Not supported + public void JournalCodeVoidAsyncTestsUsingoAuth() + { + //Creating the JournalCode for Adding + JournalCode entity = QBOHelper.CreateJournalCode(qboContextoAuth, JournalCodeTypeEnum.Expenses); + //Adding the JournalCode + JournalCode added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/JournalEntry.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/JournalEntry.cs new file mode 100644 index 0000000..182c48c --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/JournalEntry.cs @@ -0,0 +1,334 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class JournalEntryTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void JournalEntryAddTestUsingoAuth() + { + //Creating the JournalEntry for Add + JournalEntry journalEntry = QBOHelper.CreateJournalEntry(qboContextoAuth); + //Adding the JournalEntry + JournalEntry added = Helper.Add(qboContextoAuth, journalEntry); + //Verify the added JournalEntry + QBOHelper.VerifyJournalEntry(journalEntry, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void JournalEntryFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + JournalEntryAddTestUsingoAuth(); + + //Retrieving the JournalEntry using FindAll + List journalEntrys = Helper.FindAll(qboContextoAuth, new JournalEntry(), 1, 500); + Assert.IsNotNull(journalEntrys); + Assert.IsTrue(journalEntrys.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void JournalEntryFindbyIdTestUsingoAuth() + { + //Creating the JournalEntry for Adding + JournalEntry journalEntry = QBOHelper.CreateJournalEntry(qboContextoAuth); + //Adding the JournalEntry + JournalEntry added = Helper.Add(qboContextoAuth, journalEntry); + JournalEntry found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyJournalEntry(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void JournalEntryUpdateTestUsingoAuth() + { + //Creating the JournalEntry for Adding + JournalEntry journalEntry = QBOHelper.CreateJournalEntry(qboContextoAuth); + //Adding the JournalEntry + JournalEntry added = Helper.Add(qboContextoAuth, journalEntry); + //Change the data of added entity + JournalEntry changed = QBOHelper.UpdateJournalEntry(qboContextoAuth, added); + //Update the returned entity data + JournalEntry updated = Helper.Update(qboContextoAuth, changed);//Verify the updated JournalEntry + QBOHelper.VerifyJournalEntry(changed, updated); + } + + [TestMethod] + public void JournalEntrySparseUpdateTestUsingoAuth() + { + //Creating the JournalEntry for Adding + JournalEntry journalEntry = QBOHelper.CreateJournalEntry(qboContextoAuth); + //Adding the JournalEntry + JournalEntry added = Helper.Add(qboContextoAuth, journalEntry); + //Change the data of added entity + JournalEntry changed = QBOHelper.UpdateJournalEntrySparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + JournalEntry updated = Helper.Update(qboContextoAuth, changed);//Verify the updated JournalEntry + QBOHelper.VerifyJournalEntrySparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void JournalEntryDeleteTestUsingoAuth() + { + //Creating the JournalEntry for Adding + JournalEntry journalEntry = QBOHelper.CreateJournalEntry(qboContextoAuth); + //Adding the JournalEntry + JournalEntry added = Helper.Add(qboContextoAuth, journalEntry); + //Delete the returned entity + try + { + JournalEntry deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] [Ignore] //IgnoreReason: Not supported + public void JournalEntryVoidTestUsingoAuth() + { + //Creating the entity for Adding + JournalEntry entity = QBOHelper.CreateJournalEntry(qboContextoAuth); + //Adding the entity + JournalEntry added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + JournalEntry voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void JournalEntryCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + JournalEntryAddTestUsingoAuth(); + + //Retrieving the JournalEntry using CDC + List entities = Helper.CDC(qboContextoAuth, new JournalEntry(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void JournalEntryBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + JournalEntry existing = Helper.FindOrAdd(qboContextoAuth, new JournalEntry()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateJournalEntry(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateJournalEntry(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from JournalEntry"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as JournalEntry).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void JournalEntryQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + JournalEntry existing = Helper.FindOrAdd(qboContextoAuth, new JournalEntry()); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM JournalEntry where Id='" + existing.Id + "'").ToList(); + + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void JournalEntryAddAsyncTestsUsingoAuth() + { + //Creating the JournalEntry for Add + JournalEntry entity = QBOHelper.CreateJournalEntry(qboContextoAuth); + + JournalEntry added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyJournalEntry(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void JournalEntryRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + JournalEntryAddTestUsingoAuth(); + + //Retrieving the JournalEntry using FindAll + Helper.FindAllAsync(qboContextoAuth, new JournalEntry()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void JournalEntryFindByIdAsyncTestsUsingoAuth() + { + //Creating the JournalEntry for Adding + JournalEntry entity = QBOHelper.CreateJournalEntry(qboContextoAuth); + //Adding the JournalEntry + JournalEntry added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void JournalEntryUpdatedAsyncTestsUsingoAuth() + { + //Creating the JournalEntry for Adding + JournalEntry entity = QBOHelper.CreateJournalEntry(qboContextoAuth); + //Adding the JournalEntry + JournalEntry added = Helper.Add(qboContextoAuth, entity); + + //Update the JournalEntry + JournalEntry updated = QBOHelper.UpdateJournalEntry(qboContextoAuth, added); + //Call the service + JournalEntry updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated JournalEntry + QBOHelper.VerifyJournalEntry(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void JournalEntryDeleteAsyncTestsUsingoAuth() + { + //Creating the JournalEntry for Adding + JournalEntry entity = QBOHelper.CreateJournalEntry(qboContextoAuth); + //Adding the JournalEntry + JournalEntry added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] [Ignore] //IgnoreReason: Not supported + public void JournalEntryVoidAsyncTestsUsingoAuth() + { + //Creating the JournalEntry for Adding + JournalEntry entity = QBOHelper.CreateJournalEntry(qboContextoAuth); + //Adding the JournalEntry + JournalEntry added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/NameBase.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/NameBase.cs new file mode 100644 index 0000000..7cf9e0f --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/NameBase.cs @@ -0,0 +1,141 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class NameBaseTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void NameBaseAddTestUsingoAuth() + { + //Creating the Bill for Add + NameBase nameBase = QBOHelper.CreateNameBase(qboContextoAuth); + //Adding the NameBase + NameBase added = Helper.Add(qboContextoAuth, nameBase); + //Verify the added NameBase + QBOHelper.VerifyNameBase(nameBase, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void NameBaseFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + NameBaseAddTestUsingoAuth(); + + //Retrieving the Bill using FindAll + List nameBases = Helper.FindAll(qboContextoAuth, new NameBase(), 1, 500); + Assert.IsNotNull(nameBases); + Assert.IsTrue(nameBases.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void NameBaseFindbyIdTestUsingoAuth() + { + //Creating the NameBase for Adding + NameBase nameBase = QBOHelper.CreateNameBase(qboContextoAuth); + //Adding the NameBase + NameBase added = Helper.Add(qboContextoAuth, nameBase); + NameBase found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyNameBase(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void NameBaseUpdateTestUsingoAuth() + { + //Creating the NameBase for Adding + NameBase nameBase = QBOHelper.CreateNameBase(qboContextoAuth); + //Adding the NameBase + NameBase added = Helper.Add(qboContextoAuth, nameBase); + //Change the data of added entity + QBOHelper.UpdateNameBase(qboContextoAuth, added); + //Update the returned entity data + NameBase updated = Helper.Update(qboContextoAuth, added);//Verify the updated NameBase + QBOHelper.VerifyNameBase(added, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void NameBaseDeleteTestUsingoAuth() + { + //Creating the NameBase for Adding + NameBase nameBase = QBOHelper.CreateNameBase(qboContextoAuth); + //Adding the NameBase + NameBase added = Helper.Add(qboContextoAuth, nameBase); + //Delete the returned entity + try + { + NameBase deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + public void NameBaseVoidTestUsingoAuth() + { + //Creating the entity for Adding + NameBase entity = QBOHelper.CreateNameBase(qboContextoAuth); + //Adding the entity + NameBase added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + NameBase voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/NameValue.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/NameValue.cs new file mode 100644 index 0000000..3b868a4 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/NameValue.cs @@ -0,0 +1,142 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class NameValueTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void NameValueAddTestUsingoAuth() + { + //Creating the Bill for Add + NameValue nameValue = QBOHelper.CreateNameValue(qboContextoAuth); + //Adding the NameValue + NameValue added = Helper.Add(qboContextoAuth, nameValue); + //Verify the added NameValue + QBOHelper.VerifyNameValue(nameValue, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void NameValueFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + NameValueAddTestUsingoAuth(); + + //Retrieving the Bill using FindAll + List nameValues = Helper.FindAll(qboContextoAuth, new NameValue(), 1, 500); + Assert.IsNotNull(nameValues); + Assert.IsTrue(nameValues.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void NameValueFindbyIdTestUsingoAuth() + { + //Creating the NameValue for Adding + NameValue nameValue = QBOHelper.CreateNameValue(qboContextoAuth); + //Adding the NameValue + NameValue added = Helper.Add(qboContextoAuth, nameValue); + NameValue found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyNameValue(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void NameValueUpdateTestUsingoAuth() + { + //Creating the NameValue for Adding + NameValue nameValue = QBOHelper.CreateNameValue(qboContextoAuth); + //Adding the NameValue + NameValue added = Helper.Add(qboContextoAuth, nameValue); + //Change the data of added entity + QBOHelper.UpdateNameValue(qboContextoAuth, added); + //Update the returned entity data + NameValue updated = Helper.Update(qboContextoAuth, added);//Verify the updated NameValue + QBOHelper.VerifyNameValue(added, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void NameValueDeleteTestUsingoAuth() + { + //Creating the NameValue for Adding + NameValue nameValue = QBOHelper.CreateNameValue(qboContextoAuth); + //Adding the NameValue + NameValue added = Helper.Add(qboContextoAuth, nameValue); + //Delete the returned entity + try + { + NameValue deleted = Helper.Delete(qboContextoAuth, added); + //Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + public void NameValueVoidTestUsingoAuth() + { + //Creating the entity for Adding + NameValue entity = QBOHelper.CreateNameValue(qboContextoAuth); + //Adding the entity + NameValue added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + NameValue voided = Helper.Void(qboContextoAuth, added); + //Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/NumberTypeCustomFieldDefinition.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/NumberTypeCustomFieldDefinition.cs new file mode 100644 index 0000000..1868fe7 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/NumberTypeCustomFieldDefinition.cs @@ -0,0 +1,115 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class NumberTypeCustomFieldDefinitionTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void NumberTypeCustomFieldDefinitionAddTestUsingoAuth() + { + //Creating the Bill for Add + NumberTypeCustomFieldDefinition numberTypeCustomFieldDefinition = QBOHelper.CreateNumberTypeCustomFieldDefinition(qboContextoAuth); + //Adding the NumberTypeCustomFieldDefinition + NumberTypeCustomFieldDefinition added = Helper.Add(qboContextoAuth, numberTypeCustomFieldDefinition); + //Verify the added NumberTypeCustomFieldDefinition + QBOHelper.VerifyNumberTypeCustomFieldDefinition(numberTypeCustomFieldDefinition, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void NumberTypeCustomFieldDefinitionFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + NumberTypeCustomFieldDefinitionAddTestUsingoAuth(); + + //Retrieving the Bill using FindAll + List numberTypeCustomFieldDefinitions = Helper.FindAll(qboContextoAuth, new NumberTypeCustomFieldDefinition(), 1, 500); + Assert.IsNotNull(numberTypeCustomFieldDefinitions); + Assert.IsTrue(numberTypeCustomFieldDefinitions.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void NumberTypeCustomFieldDefinitionFindbyIdTestUsingoAuth() + { + //Creating the NumberTypeCustomFieldDefinition for Adding + NumberTypeCustomFieldDefinition numberTypeCustomFieldDefinition = QBOHelper.CreateNumberTypeCustomFieldDefinition(qboContextoAuth); + //Adding the NumberTypeCustomFieldDefinition + NumberTypeCustomFieldDefinition added = Helper.Add(qboContextoAuth, numberTypeCustomFieldDefinition); + NumberTypeCustomFieldDefinition found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyNumberTypeCustomFieldDefinition(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void NumberTypeCustomFieldDefinitionUpdateTestUsingoAuth() + { + //Creating the NumberTypeCustomFieldDefinition for Adding + NumberTypeCustomFieldDefinition numberTypeCustomFieldDefinition = QBOHelper.CreateNumberTypeCustomFieldDefinition(qboContextoAuth); + //Adding the NumberTypeCustomFieldDefinition + NumberTypeCustomFieldDefinition added = Helper.Add(qboContextoAuth, numberTypeCustomFieldDefinition); + //Change the data of added entity + QBOHelper.UpdateNumberTypeCustomFieldDefinition(qboContextoAuth, added); + //Update the returned entity data + NumberTypeCustomFieldDefinition updated = Helper.Update(qboContextoAuth, added);//Verify the updated NumberTypeCustomFieldDefinition + QBOHelper.VerifyNumberTypeCustomFieldDefinition(added, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void NumberTypeCustomFieldDefinitionDeleteTestUsingoAuth() + { + //Creating the NumberTypeCustomFieldDefinition for Adding + NumberTypeCustomFieldDefinition numberTypeCustomFieldDefinition = QBOHelper.CreateNumberTypeCustomFieldDefinition(qboContextoAuth); + //Adding the NumberTypeCustomFieldDefinition + NumberTypeCustomFieldDefinition added = Helper.Add(qboContextoAuth, numberTypeCustomFieldDefinition); + //Delete the returned entity + Helper.Delete(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/OtherName.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/OtherName.cs new file mode 100644 index 0000000..f8fe5db --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/OtherName.cs @@ -0,0 +1,333 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class OtherNameTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void OtherNameAddTestUsingoAuth() + { + //Creating the OtherName for Add + OtherName otherName = QBOHelper.CreateOtherName(qboContextoAuth); + //Adding the OtherName + OtherName added = Helper.Add(qboContextoAuth, otherName); + //Verify the added OtherName + QBOHelper.VerifyOtherName(otherName, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void OtherNameFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + OtherNameAddTestUsingoAuth(); + + //Retrieving the OtherName using FindAll + List otherNames = Helper.FindAll(qboContextoAuth, new OtherName(), 1, 500); + Assert.IsNotNull(otherNames); + Assert.IsTrue(otherNames.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void OtherNameFindbyIdTestUsingoAuth() + { + //Creating the OtherName for Adding + OtherName otherName = QBOHelper.CreateOtherName(qboContextoAuth); + //Adding the OtherName + OtherName added = Helper.Add(qboContextoAuth, otherName); + OtherName found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyOtherName(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void OtherNameUpdateTestUsingoAuth() + { + //Creating the OtherName for Adding + OtherName otherName = QBOHelper.CreateOtherName(qboContextoAuth); + //Adding the OtherName + OtherName added = Helper.Add(qboContextoAuth, otherName); + //Change the data of added entity + OtherName changed = QBOHelper.UpdateOtherName(qboContextoAuth, added); + //Update the returned entity data + OtherName updated = Helper.Update(qboContextoAuth, changed);//Verify the updated OtherName + QBOHelper.VerifyOtherName(changed, updated); + } + + [TestMethod] + public void OtherNameSparseUpdateTestUsingoAuth() + { + //Creating the OtherName for Adding + OtherName otherName = QBOHelper.CreateOtherName(qboContextoAuth); + //Adding the OtherName + OtherName added = Helper.Add(qboContextoAuth, otherName); + //Change the data of added entity + OtherName changed = QBOHelper.UpdateOtherNameSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + OtherName updated = Helper.Update(qboContextoAuth, changed);//Verify the updated OtherName + QBOHelper.VerifyOtherNameSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void OtherNameDeleteTestUsingoAuth() + { + //Creating the OtherName for Adding + OtherName otherName = QBOHelper.CreateOtherName(qboContextoAuth); + //Adding the OtherName + OtherName added = Helper.Add(qboContextoAuth, otherName); + //Delete the returned entity + try + { + OtherName deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + public void OtherNameVoidTestUsingoAuth() + { + //Creating the entity for Adding + OtherName entity = QBOHelper.CreateOtherName(qboContextoAuth); + //Adding the entity + OtherName added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + OtherName voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void OtherNameCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + OtherNameAddTestUsingoAuth(); + + //Retrieving the OtherName using CDC + List entities = Helper.CDC(qboContextoAuth, new OtherName(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void OtherNameBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + OtherName existing = Helper.FindOrAdd(qboContextoAuth, new OtherName()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateOtherName(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateOtherName(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from OtherName"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as OtherName).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void OtherNameQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + OtherName existing = Helper.FindOrAdd(qboContextoAuth, new OtherName()); + int count = entityQuery.ExecuteIdsQuery("Select * from OtherName where Id='" + existing.Id + "'").Count; + Assert.IsTrue(count > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void OtherNameAddAsyncTestsUsingoAuth() + { + //Creating the OtherName for Add + OtherName entity = QBOHelper.CreateOtherName(qboContextoAuth); + + OtherName added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyOtherName(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void OtherNameRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + OtherNameAddTestUsingoAuth(); + + //Retrieving the OtherName using FindAll + Helper.FindAllAsync(qboContextoAuth, new OtherName()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void OtherNameFindByIdAsyncTestsUsingoAuth() + { + //Creating the OtherName for Adding + OtherName entity = QBOHelper.CreateOtherName(qboContextoAuth); + //Adding the OtherName + OtherName added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void OtherNameUpdatedAsyncTestsUsingoAuth() + { + //Creating the OtherName for Adding + OtherName entity = QBOHelper.CreateOtherName(qboContextoAuth); + //Adding the OtherName + OtherName added = Helper.Add(qboContextoAuth, entity); + + //Update the OtherName + OtherName updated = QBOHelper.UpdateOtherName(qboContextoAuth, added); + //Call the service + OtherName updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated OtherName + QBOHelper.VerifyOtherName(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void OtherNameDeleteAsyncTestsUsingoAuth() + { + //Creating the OtherName for Adding + OtherName entity = QBOHelper.CreateOtherName(qboContextoAuth); + //Adding the OtherName + OtherName added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] + public void OtherNameVoidAsyncTestsUsingoAuth() + { + //Creating the OtherName for Adding + OtherName entity = QBOHelper.CreateOtherName(qboContextoAuth); + //Adding the OtherName + OtherName added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Payment.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Payment.cs new file mode 100644 index 0000000..eed4b5b --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Payment.cs @@ -0,0 +1,357 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class PaymentTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void PaymentAddTestUsingCheck() + { + //Creating the Payment for Add + Payment payment = QBOHelper.CreatePaymentCheck(qboContextoAuth); + //Adding the Payment + Payment added = Helper.Add(qboContextoAuth, payment); + //Verify the added Payment + QBOHelper.VerifyPayment(payment, added); + } + + [TestMethod] + public void PaymentAddTestUsingCreditCard() + { + //Creating the Payment for Add + Payment payment = QBOHelper.CreatePaymentCreditCard(qboContextoAuth); + //Adding the Payment + Payment added = Helper.Add(qboContextoAuth, payment); + //Verify the added Payment + QBOHelper.VerifyPayment(payment, added); + } + + [TestMethod] + public void PaymentAddTestUsingoAuth() + { + //Creating the Payment for Add + Payment payment = QBOHelper.CreatePayment(qboContextoAuth); + //Adding the Payment + Payment added = Helper.Add(qboContextoAuth, payment); + //Verify the added Payment + QBOHelper.VerifyPayment(payment, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void PaymentFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + PaymentAddTestUsingoAuth(); + + //Retrieving the Payment using FindAll + List payments = Helper.FindAll(qboContextoAuth, new Payment(), 1, 500); + Assert.IsNotNull(payments); + Assert.IsTrue(payments.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void PaymentFindbyIdTestUsingoAuth() + { + //Creating the Payment for Adding + Payment payment = QBOHelper.CreatePayment(qboContextoAuth); + //Adding the Payment + Payment added = Helper.Add(qboContextoAuth, payment); + Payment found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyPayment(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void PaymentUpdateTestUsingoAuth() + { + //Creating the Payment for Adding + Payment payment = QBOHelper.CreatePayment(qboContextoAuth); + //Adding the Payment + Payment added = Helper.Add(qboContextoAuth, payment); + //Change the data of added entity + Payment changed = QBOHelper.UpdatePayment(qboContextoAuth, added); + //Update the returned entity data + Payment updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Payment + QBOHelper.VerifyPayment(changed, updated); + } + + [TestMethod] + public void PaymentSparseUpdateTestUsingoAuth() + { + //Creating the Payment for Adding + Payment payment = QBOHelper.CreatePayment(qboContextoAuth); + //Adding the Payment + Payment added = Helper.Add(qboContextoAuth, payment); + //Change the data of added entity + Payment changed = QBOHelper.SparseUpdatePayment(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + Payment updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Payment + QBOHelper.VerifyPaymentSparseUpdate(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void PaymentDeleteTestUsingoAuth() + { + //Creating the Payment for Adding + Payment payment = QBOHelper.CreatePayment(qboContextoAuth); + //Adding the Payment + Payment added = Helper.Add(qboContextoAuth, payment); + //Delete the returned entity + try + { + Payment deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + [Ignore] + public void PaymentVoidTestUsingoAuth() + { + //Creating the Payment for Adding + Payment payment = QBOHelper.CreatePayment(qboContextoAuth); + //Adding the Payment + Payment added = Helper.Add(qboContextoAuth, payment); + try + { + Payment voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void PaymentCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + PaymentAddTestUsingoAuth(); + + //Retrieving the Payment using CDC + List entities = Helper.CDC(qboContextoAuth, new Payment(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void PaymentBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + Payment existing = Helper.FindOrAdd(qboContextoAuth, new Payment()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreatePayment(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdatePayment(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from Payment"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as Payment).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void PaymentQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + Payment existing = Helper.FindOrAdd(qboContextoAuth, new Payment()); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM Payment where Id='" + existing.Id + "'").ToList(); + + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void PaymentAddAsyncTestsUsingoAuth() + { + //Creating the Payment for Add + Payment entity = QBOHelper.CreatePayment(qboContextoAuth); + + Payment added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyPayment(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void PaymentRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + PaymentAddTestUsingoAuth(); + + //Retrieving the Payment using FindAll + Helper.FindAllAsync(qboContextoAuth, new Payment()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void PaymentFindByIdAsyncTestsUsingoAuth() + { + //Creating the Payment for Adding + Payment entity = QBOHelper.CreatePayment(qboContextoAuth); + //Adding the Payment + Payment added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void PaymentUpdatedAsyncTestsUsingoAuth() + { + //Creating the Payment for Adding + Payment entity = QBOHelper.CreatePayment(qboContextoAuth); + //Adding the Payment + Payment added = Helper.Add(qboContextoAuth, entity); + + //Update the Payment + Payment updated = QBOHelper.UpdatePayment(qboContextoAuth, added); + //Call the service + Payment updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated Payment + QBOHelper.VerifyPayment(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void PaymentDeleteAsyncTestsUsingoAuth() + { + //Creating the Payment for Adding + Payment entity = QBOHelper.CreatePayment(qboContextoAuth); + //Adding the Payment + Payment added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod][Ignore] + public void PaymentVoidAsyncTestsUsingoAuth() + { + //Creating the Payment for Adding + Payment entity = QBOHelper.CreatePayment(qboContextoAuth); + //Adding the Payment + Payment added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/PaymentMethod.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/PaymentMethod.cs new file mode 100644 index 0000000..e6fd881 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/PaymentMethod.cs @@ -0,0 +1,337 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class PaymentMethodTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void PaymentMethodAddTestUsingoAuth() + { + //Creating the PaymentMethod for Add + PaymentMethod paymentMethod = QBOHelper.CreatePaymentMethod(qboContextoAuth); + //Adding the PaymentMethod + PaymentMethod added = Helper.Add(qboContextoAuth, paymentMethod); + //Verify the added PaymentMethod + QBOHelper.VerifyPaymentMethod(paymentMethod, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void PaymentMethodFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + PaymentMethodAddTestUsingoAuth(); + + //Retrieving the PaymentMethod using FindAll + List paymentMethods = Helper.FindAll(qboContextoAuth, new PaymentMethod(), 1, 500); + Assert.IsNotNull(paymentMethods); + Assert.IsTrue(paymentMethods.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void PaymentMethodFindbyIdTestUsingoAuth() + { + //Creating the PaymentMethod for Adding + PaymentMethod paymentMethod = QBOHelper.CreatePaymentMethod(qboContextoAuth); + //Adding the PaymentMethod + PaymentMethod added = Helper.Add(qboContextoAuth, paymentMethod); + PaymentMethod found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyPaymentMethod(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void PaymentMethodUpdateTestUsingoAuth() + { + //Creating the PaymentMethod for Adding + PaymentMethod paymentMethod = QBOHelper.CreatePaymentMethod(qboContextoAuth); + //Adding the PaymentMethod + PaymentMethod added = Helper.Add(qboContextoAuth, paymentMethod); + //Change the data of added entity + PaymentMethod changed = QBOHelper.UpdatePaymentMethod(qboContextoAuth, added); + //Update the returned entity data + PaymentMethod updated = Helper.Update(qboContextoAuth, changed); //Verify the updated PaymentMethod + QBOHelper.VerifyPaymentMethod(changed, updated); + } + + [TestMethod] + public void PaymentMethodSparseUpdateTestUsingoAuth() + { + //Creating the PaymentMethod for Adding + PaymentMethod paymentMethod = QBOHelper.CreatePaymentMethod(qboContextoAuth); + //Adding the PaymentMethod + PaymentMethod added = Helper.Add(qboContextoAuth, paymentMethod); + //Change the data of added entity + PaymentMethod changed = QBOHelper.SparseUpdatePaymentMethod(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + PaymentMethod updated = Helper.Update(qboContextoAuth, changed); //Verify the updated PaymentMethod + QBOHelper.VerifyPaymentMethodSparseUpdate(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] [Ignore] //TestComment: Returns Operation Not Supported: DevKit tracker Item #150 + public void PaymentMethodDeleteTestUsingoAuth() + { + //Creating the PaymentMethod for Adding + PaymentMethod paymentMethod = QBOHelper.CreatePaymentMethod(qboContextoAuth); + //Adding the PaymentMethod + PaymentMethod added = Helper.Add(qboContextoAuth, paymentMethod); + //Delete the returned entity + try + { + PaymentMethod deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + + } + + [TestMethod] [Ignore] + public void PaymentMethodVoidTestUsingoAuth() + { + //Creating the PaymentMethod for Adding + PaymentMethod paymentMethod = QBOHelper.CreatePaymentMethod(qboContextoAuth); + //Adding the PaymentMethod + PaymentMethod added = Helper.Add(qboContextoAuth, paymentMethod); + //Void the returned entity + try + { + PaymentMethod voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void PaymentMethodCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + PaymentMethodAddTestUsingoAuth(); + + //Retrieving the PaymentMethod using CDC + List entities = Helper.CDC(qboContextoAuth, new PaymentMethod(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void PaymentMethodBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + PaymentMethod existing = Helper.FindOrAddPaymentMethod(qboContextoAuth, "CREDIT_CARD"); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreatePaymentMethod(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdatePaymentMethod(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from PaymentMethod"); + + // batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as PaymentMethod).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void PaymentMethodQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + PaymentMethod existing = Helper.FindOrAdd(qboContextoAuth, new PaymentMethod()); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM PaymentMethod where Id='" + existing.Id + "'").ToList(); + + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void PaymentMethodAddAsyncTestsUsingoAuth() + { + //Creating the PaymentMethod for Add + PaymentMethod entity = QBOHelper.CreatePaymentMethod(qboContextoAuth); + + PaymentMethod added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyPaymentMethod(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void PaymentMethodRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + PaymentMethodAddTestUsingoAuth(); + + //Retrieving the PaymentMethod using FindAll + Helper.FindAllAsync(qboContextoAuth, new PaymentMethod()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void PaymentMethodFindByIdAsyncTestsUsingoAuth() + { + //Creating the PaymentMethod for Adding + PaymentMethod entity = QBOHelper.CreatePaymentMethod(qboContextoAuth); + //Adding the PaymentMethod + PaymentMethod added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void PaymentMethodUpdatedAsyncTestsUsingoAuth() + { + //Creating the PaymentMethod for Adding + PaymentMethod entity = QBOHelper.CreatePaymentMethod(qboContextoAuth); + //Adding the PaymentMethod + PaymentMethod added = Helper.Add(qboContextoAuth, entity); + + //Update the PaymentMethod + PaymentMethod updated = QBOHelper.UpdatePaymentMethod(qboContextoAuth, added); + //Call the service + PaymentMethod updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated PaymentMethod + QBOHelper.VerifyPaymentMethod(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] [Ignore] //TestComment: Returns Operation Not Supported: DevKit tracker Item #150 + public void PaymentMethodDeleteAsyncTestsUsingoAuth() + { + //Creating the PaymentMethod for Adding + PaymentMethod entity = QBOHelper.CreatePaymentMethod(qboContextoAuth); + //Adding the PaymentMethod + PaymentMethod added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] [Ignore] + public void PaymentMethodVoidAsyncTestsUsingoAuth() + { + //Creating the PaymentMethod for Adding + PaymentMethod entity = QBOHelper.CreatePaymentMethod(qboContextoAuth); + //Adding the PaymentMethod + PaymentMethod added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Preferences.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Preferences.cs new file mode 100644 index 0000000..737f237 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Preferences.cs @@ -0,0 +1,344 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class PreferencesTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] [Ignore] + public void PreferencesAddTestUsingoAuth() + { + //Creating the Bill for Add + Preferences preferences = QBOHelper.CreatePreferences(qboContextoAuth); + //Adding the Preferences + Preferences added = Helper.Add(qboContextoAuth, preferences); + //Verify the added Preferences + QBOHelper.VerifyPreferences(preferences, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void PreferencesFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + //PreferencesAddTestUsingoAuth(); + + //Retrieving the Bill using FindAll + List preferencess = Helper.FindAll(qboContextoAuth, new Preferences(), 1, 500); + Assert.IsNotNull(preferencess); + Assert.IsTrue(preferencess.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void PreferencesFindbyIdTestUsingoAuth() + { + //Creating the Preferences for Adding + // Preferences preferences = QBOHelper.CreatePreferences(qboContextoAuth); + //Adding the Preferences + // Preferences added = Helper.Add(qboContextoAuth, preferences); + List foundall = Helper.FindAll(qboContextoAuth, new Preferences()); + + Assert.IsTrue(foundall.Count > 0); + + foreach (Preferences found in foundall) + { + Preferences findbyId = Helper.FindById(qboContextoAuth, found); + QBOHelper.VerifyPreferences(found, findbyId); + } + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void PreferencesUpdateTestUsingoAuth() + { + //Creating the Preferences for Adding + //Preferences preferences = QBOHelper.CreatePreferences(qboContextoAuth); + //Adding the Preferences + //Preferences added = Helper.Add(qboContextoAuth, preferences); + //Change the data of added entity + List foundall = Helper.FindAll(qboContextoAuth, new Preferences()); + + Assert.IsTrue(foundall.Count > 0); + + foreach (Preferences found in foundall) + { + Preferences changed = QBOHelper.UpdatePreferences(qboContextoAuth, found); + //Update the returned entity data + Preferences updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Preferences + QBOHelper.VerifyPreferences(changed, updated); + } + + } + + [TestMethod] [Ignore] + public void PreferencesSparseUpdateTestUsingoAuth() + { + //Finding Or Adding the Preferences + Preferences found = Helper.FindOrAdd(qboContextoAuth, new Preferences()); + //Change the data of added entity + Preferences changed = QBOHelper.SparseUpdatePreferences(qboContextoAuth, found.Id, found.SyncToken); + //Update the returned entity data + Preferences updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Preferences + QBOHelper.VerifyPreferencesSparseUpdate(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] [Ignore] + public void PreferencesDeleteTestUsingoAuth() + { + //Creating the Preferences for Adding + Preferences preferences = QBOHelper.CreatePreferences(qboContextoAuth); + //Adding the Preferences + Preferences added = Helper.Add(qboContextoAuth, preferences); + //Delete the returned entity + try + { + Preferences deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + + [TestMethod] [Ignore] + public void PreferencesVoidTestUsingoAuth() + { + //Creating the Preferences for Adding + Preferences preferences = QBOHelper.CreatePreferences(qboContextoAuth); + //Adding the Preferences + Preferences added = Helper.Add(qboContextoAuth, preferences); + //Void the returned entity + try + { + Preferences voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] [Ignore] + public void PreferencesCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + PreferencesAddTestUsingoAuth(); + + //Retrieving the Preferences using CDC + List entities = Helper.CDC(qboContextoAuth, new Preferences(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void PreferencesBatchUsingoAuth() + { + DataService.DataService service = new DataService.DataService(qboContextoAuth); + Preferences found = Helper.FindOrAdd(qboContextoAuth, new Preferences()); + + DataService.Batch batch = service.CreateNewBatch(); + batch.Add(QBOHelper.UpdatePreferences(qboContextoAuth, found),"Update",OperationEnum.update); + + batch.Execute(); + + ReadOnlyCollection batchResponses = batch.IntuitBatchItemResponses; + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as Preferences).Id)); + position++; + } + } + + #endregion + + #region Test cases for Query + + [TestMethod] + public void PreferencesQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + Preferences existing = Helper.FindOrAdd(qboContextoAuth, new Preferences()); + //List entities = entityQuery.Where(c => c.MetaData.CreateTime == existing.MetaData.CreateTime).ToList(); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM Preferences").ToList(); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] [Ignore] + public void PreferencesAddAsyncTestsUsingoAuth() + { + //Creating the Preferences for Add + Preferences entity = QBOHelper.CreatePreferences(qboContextoAuth); + + Preferences added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyPreferences(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void PreferencesRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + //PreferencesAddTestUsingoAuth(); + + //Retrieving the Preferences using FindAll + Helper.FindAllAsync(qboContextoAuth, new Preferences()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void PreferencesFindByIdAsyncTestsUsingoAuth() + { + //Creating the Preferences for Adding + // Preferences preferences = QBOHelper.CreatePreferences(qboContextoAuth); + //Adding the Preferences + // Preferences added = Helper.Add(qboContextoAuth, preferences); + List foundall = Helper.FindAll(qboContextoAuth, new Preferences()); + + Assert.IsTrue(foundall.Count > 0); + + foreach (Preferences found in foundall) + { + Helper.FindByIdAsync(qboContextoAuth, found); + } + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void PreferencesUpdatedAsyncTestsUsingoAuth() + { + //Creating the Preferences for Adding + //Preferences preferences = QBOHelper.CreatePreferences(qboContextoAuth); + //Adding the Preferences + //Preferences added = Helper.Add(qboContextoAuth, preferences); + //Change the data of added entity + List foundall = Helper.FindAll(qboContextoAuth, new Preferences()); + + Assert.IsTrue(foundall.Count > 0); + + foreach (Preferences found in foundall) + { + Preferences changed = QBOHelper.UpdatePreferences(qboContextoAuth, found); + //Update the returned entity data + Preferences updated = Helper.UpdateAsync(qboContextoAuth, changed);//Verify the updated Preferences + QBOHelper.VerifyPreferences(changed, updated); + } + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] [Ignore] + public void PreferencesDeleteAsyncTestsUsingoAuth() + { + //Creating the Preferences for Adding + Preferences entity = QBOHelper.CreatePreferences(qboContextoAuth); + //Adding the Preferences + Preferences added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] [Ignore] + public void PreferencesVoidAsyncTestsUsingoAuth() + { + //Creating the Preferences for Adding + Preferences entity = QBOHelper.CreatePreferences(qboContextoAuth); + //Adding the Preferences + Preferences added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/PriceLevel.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/PriceLevel.cs new file mode 100644 index 0000000..207396b --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/PriceLevel.cs @@ -0,0 +1,333 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class PriceLevelTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void PriceLevelAddTestUsingoAuth() + { + //Creating the PriceLevel for Add + PriceLevel priceLevel = QBOHelper.CreatePriceLevel(qboContextoAuth); + //Adding the PriceLevel + PriceLevel added = Helper.Add(qboContextoAuth, priceLevel); + //Verify the added PriceLevel + QBOHelper.VerifyPriceLevel(priceLevel, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void PriceLevelFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + PriceLevelAddTestUsingoAuth(); + + //Retrieving the PriceLevel using FindAll + List priceLevels = Helper.FindAll(qboContextoAuth, new PriceLevel(), 1, 500); + Assert.IsNotNull(priceLevels); + Assert.IsTrue(priceLevels.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void PriceLevelFindbyIdTestUsingoAuth() + { + //Creating the PriceLevel for Adding + PriceLevel priceLevel = QBOHelper.CreatePriceLevel(qboContextoAuth); + //Adding the PriceLevel + PriceLevel added = Helper.Add(qboContextoAuth, priceLevel); + PriceLevel found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyPriceLevel(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void PriceLevelUpdateTestUsingoAuth() + { + //Creating the PriceLevel for Adding + PriceLevel priceLevel = QBOHelper.CreatePriceLevel(qboContextoAuth); + //Adding the PriceLevel + PriceLevel added = Helper.Add(qboContextoAuth, priceLevel); + //Change the data of added entity + PriceLevel changed = QBOHelper.UpdatePriceLevel(qboContextoAuth, added); + //Update the returned entity data + PriceLevel updated = Helper.Update(qboContextoAuth, changed);//Verify the updated PriceLevel + QBOHelper.VerifyPriceLevel(changed, updated); + } + + [TestMethod] + public void PriceLevelSparseUpdateTestUsingoAuth() + { + //Creating the PriceLevel for Adding + PriceLevel priceLevel = QBOHelper.CreatePriceLevel(qboContextoAuth); + //Adding the PriceLevel + PriceLevel added = Helper.Add(qboContextoAuth, priceLevel); + //Change the data of added entity + PriceLevel changed = QBOHelper.UpdatePriceLevelSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + PriceLevel updated = Helper.Update(qboContextoAuth, changed);//Verify the updated PriceLevel + QBOHelper.VerifyPriceLevelSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void PriceLevelDeleteTestUsingoAuth() + { + //Creating the PriceLevel for Adding + PriceLevel priceLevel = QBOHelper.CreatePriceLevel(qboContextoAuth); + //Adding the PriceLevel + PriceLevel added = Helper.Add(qboContextoAuth, priceLevel); + //Delete the returned entity + try + { + PriceLevel deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + public void PriceLevelVoidTestUsingoAuth() + { + //Creating the entity for Adding + PriceLevel entity = QBOHelper.CreatePriceLevel(qboContextoAuth); + //Adding the entity + PriceLevel added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + PriceLevel voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void PriceLevelCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + PriceLevelAddTestUsingoAuth(); + + //Retrieving the PriceLevel using CDC + List entities = Helper.CDC(qboContextoAuth, new PriceLevel(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void PriceLevelBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + PriceLevel existing = Helper.FindOrAdd(qboContextoAuth, new PriceLevel()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreatePriceLevel(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdatePriceLevel(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from PriceLevel"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as PriceLevel).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void PriceLevelQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + PriceLevel existing = Helper.FindOrAdd(qboContextoAuth, new PriceLevel()); + List entities = entityQuery.ExecuteIdsQuery("Select * from Customer where Id == '"+existing.Id+"'").ToList(); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void PriceLevelAddAsyncTestsUsingoAuth() + { + //Creating the PriceLevel for Add + PriceLevel entity = QBOHelper.CreatePriceLevel(qboContextoAuth); + + PriceLevel added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyPriceLevel(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void PriceLevelRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + PriceLevelAddTestUsingoAuth(); + + //Retrieving the PriceLevel using FindAll + Helper.FindAllAsync(qboContextoAuth, new PriceLevel()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void PriceLevelFindByIdAsyncTestsUsingoAuth() + { + //Creating the PriceLevel for Adding + PriceLevel entity = QBOHelper.CreatePriceLevel(qboContextoAuth); + //Adding the PriceLevel + PriceLevel added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void PriceLevelUpdatedAsyncTestsUsingoAuth() + { + //Creating the PriceLevel for Adding + PriceLevel entity = QBOHelper.CreatePriceLevel(qboContextoAuth); + //Adding the PriceLevel + PriceLevel added = Helper.Add(qboContextoAuth, entity); + + //Update the PriceLevel + PriceLevel updated = QBOHelper.UpdatePriceLevel(qboContextoAuth, added); + //Call the service + PriceLevel updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated PriceLevel + QBOHelper.VerifyPriceLevel(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void PriceLevelDeleteAsyncTestsUsingoAuth() + { + //Creating the PriceLevel for Adding + PriceLevel entity = QBOHelper.CreatePriceLevel(qboContextoAuth); + //Adding the PriceLevel + PriceLevel added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] + public void PriceLevelVoidAsyncTestsUsingoAuth() + { + //Creating the PriceLevel for Adding + PriceLevel entity = QBOHelper.CreatePriceLevel(qboContextoAuth); + //Adding the PriceLevel + PriceLevel added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/PriceLevelPerItem.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/PriceLevelPerItem.cs new file mode 100644 index 0000000..519e9f1 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/PriceLevelPerItem.cs @@ -0,0 +1,156 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class PriceLevelPerItemTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void PriceLevelPerItemAddTestUsingoAuth() + { + //Creating the Bill for Add + PriceLevelPerItem priceLevelPerItem = QBOHelper.CreatePriceLevelPerItem(qboContextoAuth); + //Adding the PriceLevelPerItem + PriceLevelPerItem added = Helper.Add(qboContextoAuth, priceLevelPerItem); + //Verify the added PriceLevelPerItem + QBOHelper.VerifyPriceLevelPerItem(priceLevelPerItem, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void PriceLevelPerItemFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + PriceLevelPerItemAddTestUsingoAuth(); + + //Retrieving the Bill using FindAll + List priceLevelPerItems = Helper.FindAll(qboContextoAuth, new PriceLevelPerItem(), 1, 500); + Assert.IsNotNull(priceLevelPerItems); + Assert.IsTrue(priceLevelPerItems.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void PriceLevelPerItemFindbyIdTestUsingoAuth() + { + //Creating the PriceLevelPerItem for Adding + PriceLevelPerItem priceLevelPerItem = QBOHelper.CreatePriceLevelPerItem(qboContextoAuth); + //Adding the PriceLevelPerItem + PriceLevelPerItem added = Helper.Add(qboContextoAuth, priceLevelPerItem); + PriceLevelPerItem found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyPriceLevelPerItem(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void PriceLevelPerItemUpdateTestUsingoAuth() + { + //Creating the PriceLevelPerItem for Adding + PriceLevelPerItem priceLevelPerItem = QBOHelper.CreatePriceLevelPerItem(qboContextoAuth); + //Adding the PriceLevelPerItem + PriceLevelPerItem added = Helper.Add(qboContextoAuth, priceLevelPerItem); + //Change the data of added entity + PriceLevelPerItem changed = QBOHelper.UpdatePriceLevelPerItem(qboContextoAuth, added); + //Update the returned entity data + PriceLevelPerItem updated = Helper.Update(qboContextoAuth, changed);//Verify the updated PriceLevelPerItem + QBOHelper.VerifyPriceLevelPerItem(changed, updated); + } + + [TestMethod] + public void PriceLevelPerItemSparseUpdateTestUsingoAuth() + { + //Creating the PriceLevelPerItem for Adding + PriceLevelPerItem priceLevelPerItem = QBOHelper.CreatePriceLevelPerItem(qboContextoAuth); + //Adding the PriceLevelPerItem + PriceLevelPerItem added = Helper.Add(qboContextoAuth, priceLevelPerItem); + //Change the data of added entity + PriceLevelPerItem changed = QBOHelper.UpdatePriceLevelPerItemSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + PriceLevelPerItem updated = Helper.Update(qboContextoAuth, changed);//Verify the updated PriceLevelPerItem + QBOHelper.VerifyPriceLevelPerItemSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void PriceLevelPerItemDeleteTestUsingoAuth() + { + //Creating the PriceLevelPerItem for Adding + PriceLevelPerItem priceLevelPerItem = QBOHelper.CreatePriceLevelPerItem(qboContextoAuth); + //Adding the PriceLevelPerItem + PriceLevelPerItem added = Helper.Add(qboContextoAuth, priceLevelPerItem); + //Delete the returned entity + try + { + PriceLevelPerItem deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + public void PriceLevelPerItemVoidTestUsingoAuth() + { + //Creating the entity for Adding + PriceLevelPerItem entity = QBOHelper.CreatePriceLevelPerItem(qboContextoAuth); + //Adding the entity + PriceLevelPerItem added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + PriceLevelPerItem voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Purchase.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Purchase.cs new file mode 100644 index 0000000..039c817 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Purchase.cs @@ -0,0 +1,576 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; +using Intuit.Ipp.QueryFilter; + +using System.Configuration; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class PurchaseTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Cash Purchase Methods + + #region Test cases for Add Operations + + [TestMethod] + public void CashPurchaseAddTestUsingoAuth() + { + //Creating the Purchase for Add + Purchase purchase = QBOHelper.CreatePurchase(qboContextoAuth, PaymentTypeEnum.Cash); + //Adding the Purchase + Purchase added = Helper.Add(qboContextoAuth, purchase); + //Verify the added Purchase + QBOHelper.VerifyPurchase(purchase, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void CashPurchaseFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + CashPurchaseAddTestUsingoAuth(); + + //Retrieving the Purchase using FindAll + List purchases = Helper.FindAll(qboContextoAuth, new Purchase(), 1, 500); + Assert.IsNotNull(purchases); + Assert.IsTrue(purchases.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void CashPurchaseFindbyIdTestUsingoAuth() + { + //Creating the Purchase for Adding + Purchase purchase = QBOHelper.CreatePurchase(qboContextoAuth, PaymentTypeEnum.Cash); + //Adding the Purchase + Purchase added = Helper.Add(qboContextoAuth, purchase); + Purchase found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyPurchase(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void CashPurchaseUpdateTestUsingoAuth() + { + //Creating the Purchase for Adding + Purchase purchase = QBOHelper.CreatePurchase(qboContextoAuth, PaymentTypeEnum.Cash); + //Adding the Purchase + Purchase added = Helper.Add(qboContextoAuth, purchase); + //Change the data of added entity + Purchase changed = QBOHelper.UpdatePurchase(qboContextoAuth, added); + //Update the returned entity data + Purchase updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Purchase + QBOHelper.VerifyPurchase(changed, updated); + } + + + [TestMethod] + public void CashPurchaseSparseUpdateTestUsingoAuth() + { + //Creating the Purchase for Adding + Purchase purchase = QBOHelper.CreatePurchase(qboContextoAuth, PaymentTypeEnum.Cash); + //Adding the Purchase + Purchase added = Helper.Add(qboContextoAuth, purchase); + //Change the data of added entity + Purchase changed = QBOHelper.SparseUpdatePurchase(qboContextoAuth, added.Id, added.PaymentType, added.SyncToken); + //Update the returned entity data + Purchase updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Purchase + QBOHelper.VerifyPurchaseSparseUpdate(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void CashPurchaseDeleteTestUsingoAuth() + { + //Creating the Purchase for Adding + Purchase purchase = QBOHelper.CreatePurchase(qboContextoAuth, PaymentTypeEnum.Cash); + //Adding the Purchase + Purchase added = Helper.Add(qboContextoAuth, purchase); + //Delete the returned entity + try + { + Purchase deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + [Ignore] + public void CashPurchaseVoidTestUsingoAuth() + { + //Creating the Purchase for Adding + Purchase purchase = QBOHelper.CreatePurchase(qboContextoAuth, PaymentTypeEnum.Cash); + //Adding the Purchase + Purchase added = Helper.Add(qboContextoAuth, purchase); + //Void the returned entity + try + { + Purchase voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void CashPurchaseCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + CashPurchaseAddTestUsingoAuth(); + + //Retrieving the Purchase using FindAll + List cashPurchases = Helper.CDC(qboContextoAuth, new Purchase(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(cashPurchases); + Assert.IsTrue(cashPurchases.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void PurchaseBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + Purchase existing = Helper.FindOrAdd(qboContextoAuth, new Purchase()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreatePurchase(qboContextoAuth, PaymentTypeEnum.Cash)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdatePurchase(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from Purchase"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as Purchase).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void CashPurchaseQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + Purchase existing = Helper.FindOrAddPurchase(qboContextoAuth, PaymentTypeEnum.Cash); + + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM Purchase where Id='" + existing.Id + "'").ToList(); + + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region Check Purchase Methods + + #region Test cases for Add Operations + + [TestMethod] + public void CheckPurchaseAddTestUsingoAuth() + { + //Creating the Purchase for Add + Purchase purchase = QBOHelper.CreatePurchase(qboContextoAuth, PaymentTypeEnum.Check); + //Adding the Purchase + Purchase added = Helper.Add(qboContextoAuth, purchase); + //Verify the added Purchase + QBOHelper.VerifyPurchase(purchase, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void CheckPurchaseFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + CheckPurchaseAddTestUsingoAuth(); + + //Retrieving the Purchase using FindAll + List purchases = Helper.FindAll(qboContextoAuth, new Purchase(), 1, 500); + Assert.IsNotNull(purchases); + Assert.IsTrue(purchases.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void CheckPurchaseFindbyIdTestUsingoAuth() + { + //Creating the Purchase for Adding + Purchase purchase = QBOHelper.CreatePurchase(qboContextoAuth, PaymentTypeEnum.Check); + //Adding the Purchase + Purchase added = Helper.Add(qboContextoAuth, purchase); + Purchase found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyPurchase(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void CheckPurchaseUpdateTestUsingoAuth() + { + //Creating the Purchase for Adding + Purchase purchase = QBOHelper.CreatePurchase(qboContextoAuth, PaymentTypeEnum.Check); + //Adding the Purchase + Purchase added = Helper.Add(qboContextoAuth, purchase); + //Change the data of added entity + Purchase changed = QBOHelper.UpdatePurchase(qboContextoAuth, added); + //Update the returned entity data + Purchase updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Purchase + QBOHelper.VerifyPurchase(changed, updated); + } + + + [TestMethod] + public void CheckPurchaseSparseUpdateTestUsingoAuth() + { + //Creating the Purchase for Adding + Purchase purchase = QBOHelper.CreatePurchase(qboContextoAuth, PaymentTypeEnum.Check); + //Adding the Purchase + Purchase added = Helper.Add(qboContextoAuth, purchase); + //Change the data of added entity + Purchase changed = QBOHelper.SparseUpdatePurchase(qboContextoAuth, added.Id, added.PaymentType, added.SyncToken); + //Update the returned entity data + Purchase updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Purchase + QBOHelper.VerifyPurchaseSparseUpdate(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void CheckPurchaseDeleteTestUsingoAuth() + { + //Creating the Purchase for Adding + Purchase purchase = QBOHelper.CreatePurchase(qboContextoAuth, PaymentTypeEnum.Check); + //Adding the Purchase + Purchase added = Helper.Add(qboContextoAuth, purchase); + //Delete the returned entity + try + { + Purchase deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + [Ignore] + public void CheckPurchaseVoidTestUsingoAuth() + { + //Creating the Purchase for Adding + Purchase purchase = QBOHelper.CreatePurchase(qboContextoAuth, PaymentTypeEnum.Check); + //Adding the Purchase + Purchase added = Helper.Add(qboContextoAuth, purchase); + //Void the returned entity + try + { + Purchase voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void CheckPurchaseCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + CheckPurchaseAddTestUsingoAuth(); + + //Retrieving the Purchase using FindAll + List checkPurchases = Helper.CDC(qboContextoAuth, new Purchase(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(checkPurchases); + Assert.IsTrue(checkPurchases.Count() > 0); + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void CheckPurchaseQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + Purchase existing = Helper.FindOrAddPurchase(qboContextoAuth, PaymentTypeEnum.Check); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM Purchase where Id='" + existing.Id + "'").ToList(); + + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region CreditCard Purchase Methods + + #region Test cases for Add Operations + + [TestMethod] + public void CreditCardPurchaseAddTestUsingoAuth() + { + //Creating the Purchase for Add + Purchase purchase = QBOHelper.CreatePurchase(qboContextoAuth, PaymentTypeEnum.CreditCard); + //Adding the Purchase + Purchase added = Helper.Add(qboContextoAuth, purchase); + //Verify the added Purchase + QBOHelper.VerifyPurchase(purchase, added); + } + + + [TestMethod] + public void CheckPurchaseAddDuplicateDocNumberGlobalTestUsingoAuth() + { + try + { + //Creating the Purchase for Add + Purchase purchase = QBOHelper.CreatePurchase(qboContextoAuth, PaymentTypeEnum.Check); + purchase.DocNumber = "DUPLICATE"; + //Pass parameter to allow duplicate doc numbers + qboContextoAuth.Include.Add("allowduplicatedocnum"); + //Adding the Purchase + Purchase added = Helper.Add(qboContextoAuth, purchase); + Purchase addedDuplicate = Helper.Add(qboContextoAuth, purchase); + //Verify the added Purchase + QBOHelper.VerifyPurchase(purchase, added); + } + finally { qboContextoAuth.Include.Clear(); } + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void CreditCardPurchaseFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + CreditCardPurchaseAddTestUsingoAuth(); + + //Retrieving the Purchase using FindAll + List purchases = Helper.FindAll(qboContextoAuth, new Purchase(), 1, 500); + Assert.IsNotNull(purchases); + Assert.IsTrue(purchases.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void CreditCardPurchaseFindbyIdTestUsingoAuth() + { + //Creating the Purchase for Adding + Purchase purchase = QBOHelper.CreatePurchase(qboContextoAuth, PaymentTypeEnum.CreditCard); + //Adding the Purchase + Purchase added = Helper.Add(qboContextoAuth, purchase); + Purchase found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyPurchase(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void CreditCardPurchaseUpdateTestUsingoAuth() + { + //Creating the Purchase for Adding + Purchase purchase = QBOHelper.CreatePurchase(qboContextoAuth, PaymentTypeEnum.CreditCard); + //Adding the Purchase + Purchase added = Helper.Add(qboContextoAuth, purchase); + //Change the data of added entity + Purchase changed = QBOHelper.UpdatePurchase(qboContextoAuth, added); + //Update the returned entity data + Purchase updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Purchase + QBOHelper.VerifyPurchase(changed, updated); + } + + + [TestMethod] + public void CreditCardPurchaseSparseUpdateTestUsingoAuth() + { + //Creating the Purchase for Adding + Purchase purchase = QBOHelper.CreatePurchase(qboContextoAuth, PaymentTypeEnum.CreditCard); + //Adding the Purchase + Purchase added = Helper.Add(qboContextoAuth, purchase); + //Change the data of added entity + Purchase changed = QBOHelper.SparseUpdatePurchase(qboContextoAuth, added.Id, added.PaymentType, added.SyncToken); + //Update the returned entity data + Purchase updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Purchase + QBOHelper.VerifyPurchaseSparseUpdate(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void CreditCardPurchaseDeleteTestUsingoAuth() + { + //Creating the Purchase for Adding + Purchase purchase = QBOHelper.CreatePurchase(qboContextoAuth, PaymentTypeEnum.CreditCard); + //Adding the Purchase + Purchase added = Helper.Add(qboContextoAuth, purchase); + //Delete the returned entity + try + { + Purchase deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + + } + + [TestMethod] + [Ignore] + public void CreditCardPurchaseVoidTestUsingoAuth() + { + //Creating the Purchase for Adding + Purchase purchase = QBOHelper.CreatePurchase(qboContextoAuth, PaymentTypeEnum.CreditCard); + //Adding the Purchase + Purchase added = Helper.Add(qboContextoAuth, purchase); + //Void the returned entity + try + { + Purchase voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void CreditCardPurchaseCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + CreditCardPurchaseAddTestUsingoAuth(); + + //Retrieving the Purchase using FindAll + List creditCardPurchases = Helper.CDC(qboContextoAuth, new Purchase(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(creditCardPurchases); + Assert.IsTrue(creditCardPurchases.Count() > 0); + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void CreditCardPurchaseQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + Purchase existing = Helper.FindOrAddPurchase(qboContextoAuth, PaymentTypeEnum.CreditCard); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM Purchase where Id='" + existing.Id + "'").ToList(); + + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/PurchaseByVendor.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/PurchaseByVendor.cs new file mode 100644 index 0000000..cd02ee8 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/PurchaseByVendor.cs @@ -0,0 +1,156 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class PurchaseByVendorTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void PurchaseByVendorAddTestUsingoAuth() + { + //Creating the Bill for Add + PurchaseByVendor purchaseByVendor = QBOHelper.CreatePurchaseByVendor(qboContextoAuth); + //Adding the PurchaseByVendor + PurchaseByVendor added = Helper.Add(qboContextoAuth, purchaseByVendor); + //Verify the added PurchaseByVendor + QBOHelper.VerifyPurchaseByVendor(purchaseByVendor, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void PurchaseByVendorFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + PurchaseByVendorAddTestUsingoAuth(); + + //Retrieving the Bill using FindAll + List purchaseByVendors = Helper.FindAll(qboContextoAuth, new PurchaseByVendor(), 1, 500); + Assert.IsNotNull(purchaseByVendors); + Assert.IsTrue(purchaseByVendors.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void PurchaseByVendorFindbyIdTestUsingoAuth() + { + //Creating the PurchaseByVendor for Adding + PurchaseByVendor purchaseByVendor = QBOHelper.CreatePurchaseByVendor(qboContextoAuth); + //Adding the PurchaseByVendor + PurchaseByVendor added = Helper.Add(qboContextoAuth, purchaseByVendor); + PurchaseByVendor found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyPurchaseByVendor(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void PurchaseByVendorUpdateTestUsingoAuth() + { + //Creating the PurchaseByVendor for Adding + PurchaseByVendor purchaseByVendor = QBOHelper.CreatePurchaseByVendor(qboContextoAuth); + //Adding the PurchaseByVendor + PurchaseByVendor added = Helper.Add(qboContextoAuth, purchaseByVendor); + //Change the data of added entity + PurchaseByVendor changed = QBOHelper.UpdatePurchaseByVendor(qboContextoAuth, added); + //Update the returned entity data + PurchaseByVendor updated = Helper.Update(qboContextoAuth, changed);//Verify the updated PurchaseByVendor + QBOHelper.VerifyPurchaseByVendor(changed, updated); + } + + [TestMethod] + public void PurchaseByVendorSparseUpdateTestUsingoAuth() + { + //Creating the PurchaseByVendor for Adding + PurchaseByVendor purchaseByVendor = QBOHelper.CreatePurchaseByVendor(qboContextoAuth); + //Adding the PurchaseByVendor + PurchaseByVendor added = Helper.Add(qboContextoAuth, purchaseByVendor); + //Change the data of added entity + PurchaseByVendor changed = QBOHelper.UpdatePurchaseByVendorSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + PurchaseByVendor updated = Helper.Update(qboContextoAuth, changed);//Verify the updated PurchaseByVendor + QBOHelper.VerifyPurchaseByVendorSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void PurchaseByVendorDeleteTestUsingoAuth() + { + //Creating the PurchaseByVendor for Adding + PurchaseByVendor purchaseByVendor = QBOHelper.CreatePurchaseByVendor(qboContextoAuth); + //Adding the PurchaseByVendor + PurchaseByVendor added = Helper.Add(qboContextoAuth, purchaseByVendor); + //Delete the returned entity + try + { + PurchaseByVendor deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + public void PurchaseByVendorVoidTestUsingoAuth() + { + //Creating the entity for Adding + PurchaseByVendor entity = QBOHelper.CreatePurchaseByVendor(qboContextoAuth); + //Adding the entity + PurchaseByVendor added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + PurchaseByVendor voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/PurchaseOrder.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/PurchaseOrder.cs new file mode 100644 index 0000000..69aaef4 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/PurchaseOrder.cs @@ -0,0 +1,353 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class PurchaseOrderTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void PurchaseOrderAddTestUsingoAuth() + { + //Creating the PurchaseOrder for Add + PurchaseOrder purchaseOrder = QBOHelper.CreatePurchaseOrder(qboContextoAuth); + //Adding the PurchaseOrder + PurchaseOrder added = Helper.Add(qboContextoAuth, purchaseOrder); + //Verify the added PurchaseOrder + QBOHelper.VerifyPurchaseOrder(purchaseOrder, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void PurchaseOrderFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + PurchaseOrderAddTestUsingoAuth(); + + //Retrieving the PurchaseOrder using FindAll + List purchaseOrders = Helper.FindAll(qboContextoAuth, new PurchaseOrder(), 1, 500); + Assert.IsNotNull(purchaseOrders); + Assert.IsTrue(purchaseOrders.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void PurchaseOrderFindbyIdTestUsingoAuth() + { + //Creating the PurchaseOrder for Adding + PurchaseOrder purchaseOrder = QBOHelper.CreatePurchaseOrder(qboContextoAuth); + //Adding the PurchaseOrder + PurchaseOrder added = Helper.Add(qboContextoAuth, purchaseOrder); + PurchaseOrder found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyPurchaseOrder(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void PurchaseOrderUpdateTestUsingoAuth() + { + //Creating the PurchaseOrder for Adding + PurchaseOrder purchaseOrder = QBOHelper.CreatePurchaseOrder(qboContextoAuth); + //Adding the PurchaseOrder + PurchaseOrder added = Helper.Add(qboContextoAuth, purchaseOrder); + //Change the data of added entity + PurchaseOrder changed = QBOHelper.UpdatePurchaseOrder(qboContextoAuth, added); + //Update the returned entity data + PurchaseOrder updated = Helper.Update(qboContextoAuth, changed); + //Verify the updated PurchaseOrder + QBOHelper.VerifyPurchaseOrder(changed, updated); + } + + [TestMethod] + public void PurchaseOrderSparseUpdateTestUsingoAuth() + { + //Creating the PurchaseOrder for Adding + PurchaseOrder purchaseOrder = QBOHelper.CreatePurchaseOrder(qboContextoAuth); + //Adding the PurchaseOrder + PurchaseOrder added = Helper.Add(qboContextoAuth, purchaseOrder); + //Change the data of added entity + PurchaseOrder changed = QBOHelper.UpdatePurchaseOrderSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + PurchaseOrder updated = Helper.Update(qboContextoAuth, changed); + //Verify the updated PurchaseOrder + QBOHelper.VerifyPurchaseOrderSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void PurchaseOrderDeleteTestUsingoAuth() + { + //Creating the PurchaseOrder for Adding + PurchaseOrder purchaseOrder = QBOHelper.CreatePurchaseOrder(qboContextoAuth); + //Adding the PurchaseOrder + PurchaseOrder added = Helper.Add(qboContextoAuth, purchaseOrder); + //Delete the returned entity + try + { + PurchaseOrder deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod][Ignore] + public void PurchaseOrderVoidTestUsingoAuth() + { + //Creating the PurchaseOrder for Adding + PurchaseOrder purchaseOrder = QBOHelper.CreatePurchaseOrder(qboContextoAuth); + //Adding the PurchaseOrder + PurchaseOrder added = Helper.Add(qboContextoAuth, purchaseOrder); + //Delete the returned entity + try + { + PurchaseOrder voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void PurchaseOrderCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + PurchaseOrderAddTestUsingoAuth(); + + //Retrieving the PurchaseOrder using CDC + List entities = Helper.CDC(qboContextoAuth, new PurchaseOrder(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void PurchaseOrderBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + PurchaseOrder existing = Helper.FindOrAdd(qboContextoAuth, new PurchaseOrder()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreatePurchaseOrder(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdatePurchaseOrder(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from PurchaseOrder"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as PurchaseOrder).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void PurchaseOrderQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + PurchaseOrder existing = Helper.FindOrAdd(qboContextoAuth, new PurchaseOrder()); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM PurchaseOrder where Id='" + existing.Id + "'").ToList(); + + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void PurchaseOrderAddAsyncTestsUsingoAuth() + { + //Creating the PurchaseOrder for Add + PurchaseOrder entity = QBOHelper.CreatePurchaseOrder(qboContextoAuth); + + PurchaseOrder added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyPurchaseOrder(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void PurchaseOrderRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + PurchaseOrderAddTestUsingoAuth(); + + //Retrieving the PurchaseOrder using FindAll + Helper.FindAllAsync(qboContextoAuth, new PurchaseOrder()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void PurchaseOrderFindByIdAsyncTestsUsingoAuth() + { + //Creating the PurchaseOrder for Adding + PurchaseOrder entity = QBOHelper.CreatePurchaseOrder(qboContextoAuth); + //Adding the PurchaseOrder + PurchaseOrder added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void PurchaseOrderUpdatedAsyncTestsUsingoAuth() + { + //Creating the PurchaseOrder for Adding + PurchaseOrder entity = QBOHelper.CreatePurchaseOrder(qboContextoAuth); + //Adding the PurchaseOrder + PurchaseOrder added = Helper.Add(qboContextoAuth, entity); + + //Update the PurchaseOrder + PurchaseOrder updated = QBOHelper.UpdatePurchaseOrder(qboContextoAuth, added); + //Call the service + PurchaseOrder updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated PurchaseOrder + QBOHelper.VerifyPurchaseOrder(updated, updatedReturned); + } + + [TestMethod] + public void PurchaseOrderSparseUpdatedAsyncTestsUsingoAuth() + { + //Creating the PurchaseOrder for Adding + PurchaseOrder entity = QBOHelper.CreatePurchaseOrder(qboContextoAuth); + //Adding the PurchaseOrder + PurchaseOrder added = Helper.Add(qboContextoAuth, entity); + + //Update the PurchaseOrder + PurchaseOrder updated = QBOHelper.UpdatePurchaseOrderSparse(qboContextoAuth, added.Id, added.SyncToken); + //Call the service + PurchaseOrder updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated PurchaseOrder + QBOHelper.VerifyPurchaseOrderSparse(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void PurchaseOrderDeleteAsyncTestsUsingoAuth() + { + //Creating the PurchaseOrder for Adding + PurchaseOrder entity = QBOHelper.CreatePurchaseOrder(qboContextoAuth); + //Adding the PurchaseOrder + PurchaseOrder added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] [Ignore] + public void PurchaseOrderVoidAsyncTestsUsingoAuth() + { + //Creating the PurchaseOrder for Adding + PurchaseOrder entity = QBOHelper.CreatePurchaseOrder(qboContextoAuth); + //Adding the PurchaseOrder + PurchaseOrder added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/QueryFilterTests.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/QueryFilterTests.cs new file mode 100644 index 0000000..fb8921b --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/QueryFilterTests.cs @@ -0,0 +1,1722 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.QueryFilter; +using Intuit.Ipp.Data; + +using System.Diagnostics; +using System.Collections.ObjectModel; +using Intuit.Ipp.Exception; + +namespace Intuit.Ipp.Test.QBO +{ + [TestClass] + [Ignore] ///https://jira.intuit.com/browse/IPP-5966 + public class QueryFilterTests + { + private static ServiceContext serviceContextoAuth; + static QueryService customerQueryService = null; + static QueryService invoiceQueryService = null; + static List customers = new List(); + static List invoices = new List(); + public QueryFilterTests() + { + + } + + [ClassInitialize] + public static void ClassInitialize(TestContext context) + { + serviceContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + customerQueryService = new QueryService(serviceContextoAuth); + invoiceQueryService = new QueryService(serviceContextoAuth); + DataService.DataService service = new DataService.DataService(serviceContextoAuth); + customers = service.FindAll(new Customer(), 1, 100).ToList(); + Assert.IsTrue(customers.Count > 0); + invoices = service.FindAll(new Invoice(), 1, 100).ToList(); + Assert.IsTrue(invoices.Count > 0); + } + + #region Where + + //[TestMethod] + //public void CustomerQueryWhereMiddleNameLikeStartWithEndsWithTests() + //{ + // //QUERY * FROM Customer WHERE MiddleName LIKE 'Test' + // List customers = customerQueryService.Where(c => c.MiddleName.StartsWith("c")).ToList(); + // foreach (var item in customers) + // { + + // } + //} + + [TestMethod] + public void CustomerQueryWhereMiddleNameLikeStartWithTests() + { + //Customer cust1 = Initializer.CreateCustomer1(); + //Customer cust2 = Initializer.CreateCustomer2(); + //Customer cust3 = Initializer.CreateCustomer3(); + //Customer cust4 = Initializer.CreateCustomer4(); + //Initializer.AddCustomerHelper(serviceContextoAuth, cust1); + //Initializer.AddCustomerHelper(serviceContextoAuth, cust2); + //Initializer.AddCustomerHelper(serviceContextoAuth, cust3); + //Initializer.AddCustomerHelper(serviceContextoAuth, cust4); + //Customer cust6 = Initializer.CreateCustomer6(); + //Customer cust7 = Initializer.CreateCustomer7(); + //Customer cust8 = Initializer.CreateCustomer8(); + //Initializer.AddCustomerHelper(serviceContextoAuth, cust6); + //Initializer.AddCustomerHelper(serviceContextoAuth, cust7); + //Initializer.AddCustomerHelper(serviceContextoAuth, cust8); + + IEnumerable filterCustomer = from customer in customers + where customer.MiddleName != null && customer.MiddleName.StartsWith("C") + select customer; + + List expectedCustomers = filterCustomer.ToList(); + //QUERY * FROM Customer WHERE MiddleName LIKE 'C*' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MiddleName.StartsWith('C')").ToList(); + + VerifyCustomers(expectedCustomers, actualCustomers, false); + + } + + [TestMethod] + public void CustomerQueryWhereMiddleNameLikeEndsWithTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.MiddleName != null && customer.MiddleName.EndsWith("t") + select customer; + + List expectedCustomers = filterCustomer.ToList(); + //QUERY * FROM Customer WHERE MiddleName LIKE '12' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MiddleName.EndsWith('t')").ToList(); + VerifyCustomers(expectedCustomers, actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereMiddleNameLikeContainsTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.MiddleName != null && customer.MiddleName.Contains("Cust") + select customer; + + List expectedCustomers = filterCustomer.ToList(); + + //QUERY * FROM Customer WHERE MiddleName LIKE 'Test*12' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MiddleName like 'Cust')").ToList(); + + VerifyCustomers(expectedCustomers, actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereMiddleNameEQTests() + { + //QUERY * FROM Customer WHERE MiddleName EQ 'Cust' + IEnumerable filterCustomer = from customer in customers + where customer.MiddleName != null && customer.MiddleName.Equals("Cust") + select customer; + + List expectedCustomers = filterCustomer.ToList(); + + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MiddleName == 'Cust'").ToList(); + + VerifyCustomers(expectedCustomers, actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereGivenNameLikeStartWithTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.GivenName != null && customer.GivenName.StartsWith("C") + select customer; + + List expectedCustomers = filterCustomer.ToList(); + //QUERY * FROM Customer WHERE GivenName LIKE 'C%' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where GivenName.StartsWith('C')").ToList(); + + VerifyCustomers(expectedCustomers, actualCustomers, false); + + } + + [TestMethod] + public void CustomerQueryWhereGivenNameLikeEndsWithTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.GivenName != null && customer.GivenName.EndsWith("t", StringComparison.OrdinalIgnoreCase) + select customer; + + List expectedCustomers = filterCustomer.ToList(); + //QUERY * FROM Customer WHERE GivenName LIKE '12' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from customer where GivenName.EndsWith('t')").ToList(); + VerifyCustomers(expectedCustomers, actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereGivenNameLikeContainsTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.GivenName != null && customer.GivenName.StartsWith("C") && customer.GivenName.EndsWith("t") + select customer; + + List expectedCustomers = filterCustomer.ToList(); + + //QUERY * FROM Customer WHERE GivenName LIKE 'Test*12' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where GivenName.Contains('C %t')").ToList(); + + VerifyCustomers(expectedCustomers, actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereGivenNameContainsTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.GivenName != null && customer.GivenName.Contains("est") + select customer; + + List expectedCustomers = filterCustomer.ToList(); + + //QUERY * FROM Customer WHERE GivenName LIKE 'Test*12' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where GivenName.Contains('est')").ToList(); + + VerifyCustomers(expectedCustomers, actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereGivenNameEQTests() + { + //QUERY * FROM Customer WHERE GivenName EQ 'Cust' + IEnumerable filterCustomer = from customer in customers + where customer.GivenName != null && customer.GivenName.Equals("Cust") + select customer; + + List expectedCustomers = filterCustomer.ToList(); + + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where GivenName == 'Cust'").ToList(); + + VerifyCustomers(expectedCustomers, actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereFamilyNameLikeStartWithTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.FamilyName != null && customer.FamilyName.StartsWith("C") + select customer; + + List expectedCustomers = filterCustomer.ToList(); + //QUERY * FROM Customer WHERE FamilyName LIKE 'C*' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where FamilyName.StartsWith('C')").ToList(); + + VerifyCustomers(expectedCustomers, actualCustomers, false); + + } + + [TestMethod] + public void CustomerQueryWhereFamilyNameLikeEndsWithTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.FamilyName != null && customer.FamilyName.EndsWith("t") + select customer; + + List expectedCustomers = filterCustomer.ToList(); + //QUERY * FROM Customer WHERE FamilyName LIKE '12' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where FamilyName.EndsWith('t')").ToList(); + VerifyCustomers(expectedCustomers, actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereFamilyNameLikeContainsTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.FamilyName != null && customer.FamilyName.StartsWith("C") && customer.FamilyName.EndsWith("t") + select customer; + + List expectedCustomers = filterCustomer.ToList(); + + //QUERY * FROM Customer WHERE FamilyName LIKE 'Test*12' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where FamilyName.Contains('C %t')").ToList(); + + VerifyCustomers(expectedCustomers, actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereFamilyNameEQTests() + { + //QUERY * FROM Customer WHERE FamilyName EQ 'Cust' + IEnumerable filterCustomer = from customer in customers + where customer.FamilyName != null && customer.FamilyName.Equals("Cust") + select customer; + + List expectedCustomers = filterCustomer.ToList(); + + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where FamilyName == 'Cust'").ToList(); + + VerifyCustomers(expectedCustomers, actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereActiveTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.Active == true + select customer; + + List expectedCustomers = filterCustomer.ToList(); + + //QUERY * FROM Customer WHERE Active EQ True + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where Active == true").ToList(); + + VerifyCustomers(expectedCustomers, actualCustomers); + } + + //[TestMethod] + //public void CustomerQueryWhereStatusTests() + //{ + // IEnumerable filterCustomer = from customer in customers + // where customer.status == EntityStatusEnum.Pending + // select customer; + + // List expectedCustomers = filterCustomer.ToList(); + // //QUERY * FROM Customer WHERE Active EQ True + // List actualCustomers = customerQueryService.Where(customer => customer.status == EntityStatusEnum.Pending).ToList(); + // VerifyCustomers(expectedCustomers, actualCustomers); + //} + + [TestMethod] + public void CustomerQueryWhereBalanceEQTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.Balance == 1000 + select customer; + + List expectedCustomers = filterCustomer.ToList(); + //QUERY * FROM Customer WHERE Balance EQ '1000' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where Balance == 1000").ToList(); + VerifyCustomers(expectedCustomers, actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereBalanceLTTests() + { + + IEnumerable filterCustomer = from customer in customers + where customer.Balance < 1000 + select customer; + + List expectedCustomers = filterCustomer.ToList(); + //QUERY * FROM Customer WHERE Balance LT '1000' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where Balance < 1000").ToList(); + VerifyCustomers(expectedCustomers, actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereBalanceGTTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.Balance > 1000 + select customer; + + List expectedCustomers = filterCustomer.ToList(); + //QUERY * FROM Customer WHERE Balance GT '1000' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where Balance > 1000").ToList(); + VerifyCustomers(expectedCustomers, actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereBalanceLETests() + { + IEnumerable filterCustomer = from customer in customers + where customer.Balance <= 1000 + select customer; + List expectedCustomers = filterCustomer.ToList(); + //QUERY * FROM Customer WHERE Balance LTE '1000' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where Balance <= 1000").ToList(); + VerifyCustomers(expectedCustomers, actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereBalanceGETests() + { + IEnumerable filterCustomer = from customer in customers + where customer.Balance >= 1000 + select customer; + List expectedCustomers = filterCustomer.ToList(); + //QUERY * FROM Customer WHERE Balance GTE '1000' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where Balance >= 1000").ToList(); + VerifyCustomers(expectedCustomers, actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereCreateTimeEQNowTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.MetaData.CreateTime == DateTime.Now + select customer; + List expectedCustomers = filterCustomer.ToList(); + //QUERY * FROM Customer WHERE MetaData.CreateTime EQ '2012-07-10T15:16:51+05:30' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MetaData.CreateTime =="+ DateTime.Now).ToList(); + VerifyCustomers(expectedCustomers, actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereCreateTimeEQTodayTests() + { + + IEnumerable filterCustomer = from customer in customers + where customer.MetaData.CreateTime == DateTime.Today + select customer; + List expectedCustomers = filterCustomer.ToList(); + //QUERY * FROM Customer WHERE MetaData.CreateTime EQ '2012-07-10T00:00:00+05:30' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MetaData.CreateTime == "+DateTime.Today).ToList(); + VerifyCustomers(expectedCustomers, actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereCreateTimeGTNowTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.MetaData.CreateTime > DateTime.Now.AddDays(-2) + select customer; + List expectedCustomers = filterCustomer.ToList(); + //QUERY * FROM Customer WHERE MetaData.CreateTime EQ '2012-07-10T15:16:51+05:30' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MetaData.CreateTime > "+DateTime.Now.AddDays(-2)).ToList(); + VerifyCustomers(expectedCustomers, actualCustomers, false); + } + + [TestMethod] + public void CustomerQueryWhereCreateTimeGTTodayTests() + { + + IEnumerable filterCustomer = from customer in customers + where customer.MetaData.CreateTime > DateTime.Today.AddDays(-2) + select customer; + List expectedCustomers = filterCustomer.ToList(); + //QUERY * FROM Customer WHERE MetaData.CreateTime EQ '2012-07-10T00:00:00+05:30' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Custo mer whereMetaData.CreateTime >"+ DateTime.Today.AddDays(-2)).ToList(); + VerifyCustomers(expectedCustomers, actualCustomers, false); + } + + [TestMethod] + public void CustomerQueryWhereCreateTimeGTDateTimeTests() + { + + IEnumerable filterCustomer = from customer in customers + where customer.MetaData.CreateTime > new DateTime(2012, 06, 30, 11, 20, 50) + select customer; + List expectedCustomers = filterCustomer.ToList(); + //QUERY * FROM Customer WHERE MetaData.CreateTime EQ '2012-07-10T15:16:51+05:30' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MetaData.CreateTime > "+new DateTime(2012, 06, 30, 11, 20, 50)).ToList(); + VerifyCustomers(expectedCustomers, actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereCreateTimeGTDateTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.MetaData.CreateTime > new DateTime(2012, 06, 30) + select customer; + List expectedCustomers = filterCustomer.ToList(); + //QUERY * FROM Customer WHERE MetaData.CreateTime EQ '2012-07-10T00:00:00+05:30' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer whereMetaData.CreateTime > "+new DateTime(2012, 06, 30)).ToList(); + VerifyCustomers(expectedCustomers, actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereLastUpdatedTimeEQNowTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.MetaData.LastUpdatedTime == DateTime.Now + select customer; + List expectedCustomers = filterCustomer.ToList(); + //QUERY * FROM Customer WHERE MetaData.LastUpdatedTime EQ '2012-07-10T15:16:51+05:30' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MetaData.LastUpdatedTime =="+ DateTime.Now).ToList(); + VerifyCustomers(expectedCustomers, actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereLastUpdatedTimeEQTodayTests() + { + + IEnumerable filterCustomer = from customer in customers + where customer.MetaData.LastUpdatedTime != DateTime.Today + select customer; + List expectedCustomers = filterCustomer.ToList(); + //QUERY * FROM Customer WHERE MetaData.LastUpdatedTime EQ '2012-07-10T00:00:00+05:30' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MetaData.LastUpdatedTime != "+DateTime.Today).ToList(); + VerifyCustomers(expectedCustomers, actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereLastUpdatedTimeGTNowTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.MetaData.LastUpdatedTime > DateTime.Now.AddDays(-2) + select customer; + List expectedCustomers = filterCustomer.ToList(); + //QUERY * FROM Customer WHERE MetaData.LastUpdatedTime EQ '2012-07-10T15:16:51+05:30' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MetaData.LastUpdatedTime >"+ DateTime.Now.AddDays(-2)).ToList(); + VerifyCustomers(expectedCustomers, actualCustomers, false); + } + + [TestMethod] + public void CustomerQueryWhereLastUpdatedTimeGTTodayTests() + { + + IEnumerable filterCustomer = from customer in customers + where customer.MetaData.LastUpdatedTime > DateTime.Today.AddDays(-2) + select customer; + List expectedCustomers = filterCustomer.ToList(); + //QUERY * FROM Customer WHERE MetaData.LastUpdatedTime EQ '2012-07-10T00:00:00+05:30' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MetaData.LastUpdatedTime >"+ DateTime.Today.AddDays(-2)).ToList(); + VerifyCustomers(expectedCustomers, actualCustomers, false); + } + + [TestMethod] + public void CustomerQueryWhereLastUpdatedTimeGTDateTimeTests() + { + + IEnumerable filterCustomer = from customer in customers + where customer.MetaData.LastUpdatedTime > new DateTime(2012, 06, 30, 11, 20, 50) + select customer; + List expectedCustomers = filterCustomer.ToList(); + //QUERY * FROM Customer WHERE MetaData.LastUpdatedTime EQ '2012-07-10T15:16:51+05:30' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MetaData.LastUpdatedTime >"+ new DateTime(2012, 06, 30, 11, 20, 50)).ToList(); + VerifyCustomers(expectedCustomers, actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereLastUpdatedTimeGTDateTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.MetaData.LastUpdatedTime > new DateTime(2012, 06, 30) + select customer; + List expectedCustomers = filterCustomer.ToList(); + //QUERY * FROM Customer WHERE MetaData.LastUpdatedTime EQ '2012-07-10T00:00:00+05:30' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MetaData.LastUpdatedTime > "+new DateTime(2012, 06, 30)).ToList(); + VerifyCustomers(expectedCustomers, actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereIDEQTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.Id == "1" + select customer; + List expectedCustomers = filterCustomer.ToList(); + //QUERY * FROM Customer WHERE Id EQ 'NG:456344' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where Id='1'").ToList(); + VerifyCustomers(expectedCustomers, actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereMiddleGivenFamilyNameLikeStartWithTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.MiddleName != null && customer.MiddleName.StartsWith("C") && customer.GivenName != null && + customer.GivenName.StartsWith("Test") && customer.FamilyName != null && customer.FamilyName.StartsWith("C") + select customer; + + List expectedCustomers = filterCustomer.ToList(); + //QUERY * FROM Customer WHERE MiddleName LIKE 'C' AND FamilyName LIKE 'C' AND GivenName LIKE 'Test' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from customer where MiddleName like'C' && FamilyName like 'C' && GivenName like 'Test')").ToList(); + + VerifyCustomers(expectedCustomers, actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereMiddleGivenFamilyNameLikeEndsWithTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.MiddleName != null && customer.MiddleName.EndsWith("C") && customer.GivenName != null && + customer.GivenName.EndsWith("Test") && customer.FamilyName != null && customer.FamilyName.EndsWith("C") + select customer; + + List expectedCustomers = filterCustomer.ToList(); + //QUERY * FROM Customer WHERE MiddleName LIKE 'C' AND FamilyName LIKE 'C' AND GivenName LIKE 'Test' + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from customer Where MiddleName.EndsWith('C') && FamilyName.EndsWith('C') && GivenName.EndsWith('Test')").ToList(); + + VerifyCustomers(expectedCustomers, actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereMiddleGivenFamilyNameLikeContainsTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.MiddleName != null && customer.MiddleName.Contains("C%t") && customer.GivenName != null && + customer.GivenName.Contains("T%1") && customer.FamilyName != null && customer.FamilyName.Contains("T%1") + select customer; + + List expectedCustomers = filterCustomer.ToList(); + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from customer Where MiddleName.Contains('C%t') && FamilyName.Contains('T%1') && GivenName.Contains('T%1')").ToList(); + + VerifyCustomers(expectedCustomers, actualCustomers); + } + + #endregion + + #region Select + + [TestMethod] + public void CustomerQuerySelectAllTests() + { + var filterCustomers = from customer in customers + select new { customer, customer.BalanceWithJobs }; + + + + var actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer").Select(c => new { Customer = c, c.BalanceWithJobs }); + foreach (var cust in actualCustomers) + { + Debug.WriteLine(cust.BalanceWithJobs + " --- " + cust.Customer.GivenName); + } + + } + + [TestMethod] + public void CustomerQuerySelectAllTests1() + { + var filterCustomers = from customer in customers + select new { customer, customer.BalanceWithJobs }; + + var actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from customer").Select(c => new { Customer = c, c.BalanceWithJobs }); + foreach (var cust in actualCustomers) + { + Debug.WriteLine(cust.BalanceWithJobs + " --- " + cust.Customer.GivenName); + } + + } + + [TestMethod] + public void CustomerQuerySelectDefaultTests() + { + var filterCustomer = from customer in customers + select customer; + + var actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from customer").Select(c => c); + //int i = 0; + foreach (var cust in actualCustomers) + { + //Debug.WriteLine(cust.BalanceWithJobs); + //Debug.WriteLine(cust.GivenName); + //i++; + } + + } + + [TestMethod] + public void CustomerQuerySelectNonDefaultTests() + { + var filterCustomer = from customer in customers + select customer.BalanceWithJobs; + + var actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer").Select(c => c.BalanceWithJobs); + + foreach (var cust in actualCustomers) + { + } + + } + + [TestMethod] + public void CustomerQuerySelectTests() + { + var filterCustomer = from customer in customers + select new { customer.BalanceWithJobs, customer.GivenName }; + + var actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from customer").Select(c => new { c.BalanceWithJobs, c.GivenName }); + + foreach (var cust in actualCustomers) + { + } + + } + + [TestMethod] + public void CustomerQuerySelectIdGivenNameTests() + { + var filterCustomer = from customer in customers + select new { customer.Id, customer.GivenName }; + + var actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from customer").Select(c => new { c.Id, c.GivenName }); + + foreach (var cust in actualCustomers) + { + } + + } + + [TestMethod] + public void InvoiceQuerySelectTests() + { + //var filterCustomer = from customer in customers + // select new { customer.Id, customer.GivenName }; + + var actualInvoices = invoiceQueryService.ExecuteIdsQuery("Select * from customer").Select(i => new { i.Id, i.DocNumber }); + + foreach (var invoice in actualInvoices) + { + Assert.IsNotNull(invoice.Id); + Assert.IsNotNull(invoice.DocNumber); + } + + } + + [TestMethod] + public void InvoiceQueryComplexSelectTests() + { + //var filterCustomer = from customer in customers + // select new { customer.Id, customer.GivenName }; + + var actualInvoices = invoiceQueryService.ExecuteIdsQuery("Select * from customer").Select(i => new { i.Id, i.Line }); + + foreach (var invoice in actualInvoices) + { + + } + + } + + [TestMethod] + public void InvoiceQueryComplexSelectLineIdTests() + { + var filterCustomer = from invoice in invoices + select new { invoice.Line }; + + var actualInvoices = invoiceQueryService.ExecuteIdsQuery("Select * from invoice").Select(i => new { Line = i.Line }); + + foreach (var inv in actualInvoices) + { + foreach (var line in inv.Line) + { + Debug.WriteLine(line.Id); + } + } + + } + #endregion + + #region OrderBy + + [TestMethod] + public void CustomerQueryOrderByTests() + { + IEnumerable filterCustomer = from customer in customers + orderby customer.FamilyName + select customer; + + List expectedCustomers = filterCustomer.ToList(); + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from customer").OrderBy(c => c.FamilyName).ToList(); + // VerifyCustomers(expectedCustomers, actualCustomers, false); + } + + [TestMethod] + public void CustomerQueryOrderAscDescByTests() + { + IEnumerable filterCustomer = from customer in customers + orderby customer.FamilyName, customer.GivenName descending + select customer; + + List expectedCustomers = filterCustomer.ToList(); + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from customer").OrderBy(c => c.FamilyName).OrderByDescending(c => c.GivenName).ToList(); + //VerifyCustomers(expectedCustomers, actualCustomers, false); + } + + [TestMethod] + public void CustomerQueryOrderDescAscByTests() + { + IEnumerable filterCustomer = from customer in customers + orderby customer.FamilyName descending, customer.GivenName + select customer; + + List expectedCustomers = filterCustomer.ToList(); + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from customer").OrderByDescending(c => c.FamilyName).OrderBy(c => c.GivenName).ToList(); + //VerifyCustomers(expectedCustomers, actualCustomers, false); + } + + [TestMethod] + public void CustomerQueryOrderByDescTests() + { + IEnumerable filterCustomer = from customer in customers + orderby customer.FamilyName descending + select customer; + + List expectedCustomers = filterCustomer.ToList(); + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from customer").OrderByDescending(c => c.FamilyName).ToList(); + //VerifyCustomers(expectedCustomers, actualCustomers, false); + } + + #endregion + + #region Count + + [TestMethod] + public void CustomerQueryCountTests() + { + int filterCustomer = (from customer in customers + select customer).Count(); + + int actualLinq = customerQueryService.ExecuteIdsQuery("Select * from customer").Count(); + int actualString = ((ReadOnlyCollection)customerQueryService.ExecuteIdsQuery("Select Count(*) From Customer")).Count(); + + Assert.IsTrue(filterCustomer <= actualLinq && actualLinq == actualString); + } + + [TestMethod] + public void InvoiceQueryCountTests() + { + int filterCustomer = (from invoice in invoices + select invoice).Count(); + + int actualLinq = invoiceQueryService.ExecuteIdsQuery("Select * from invoice").Count(); + int actualString = ((ReadOnlyCollection)invoiceQueryService.ExecuteIdsQuery("Select Count(*) From Invoice")).Count(); + + Assert.IsTrue(filterCustomer <= actualLinq && actualLinq == actualString); + } + + #endregion + + #region Take-Skip + + [TestMethod] + public void CustomerQueryTakeSkipTests() + { + var filterCustomers = from customer in customers + select customer; + + var actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer").Take(6).Skip(3); + foreach (var cust in actualCustomers) + { + } + + } + + #endregion + + #region WhereIn + + [TestMethod] + public void CustomerQueryWhereInTests() + { + string[] values = { "1", "2", "3" }; + IEnumerable filterCustomer = from customer in customers + where customer.Id.In(values) + select customer; + + List expectedCustomers = filterCustomer.ToList(); + IEnumerable actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where Id.In('" + values + "')"); + VerifyCustomers(expectedCustomers, actualCustomers.ToList()); + } + + [TestMethod] + public void CustomerQueryWhereInToIdsQueryTests() + { + string[] values = { "1", "2", "3" }; + IEnumerable filterCustomer = from customer in customers + where customer.Id.In(values) + select customer; + + List expectedCustomers = filterCustomer.ToList(); + List actualcustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where Id.In('" + values + "')", QueryOperationType.query).ToList(); + VerifyCustomers(expectedCustomers, actualcustomers); + } + + [TestMethod] + public void InvoiceQueryWhereInTests() + { + string[] values = { "1", "2", "3" }; + IEnumerable filterInvoice = from invoice in invoices + where invoice.Id.In(values) + select invoice; + + List expectedInvoices = filterInvoice.ToList(); + IEnumerable actualInvoices = invoiceQueryService.ExecuteIdsQuery("Select * from Customer where Id.In('"+values+"')"); + //VerifyInvoices(expectedInvoices, actualInvoices.ToList()); //Result sets are not the same + } + + #endregion + + #region Where + Select + [TestMethod] + public void CustomerQuerySelectWhereAllTests() + { + var filterCustomers = from customer in customers + where customer.MetaData.CreateTime < DateTime.Today + select new { customer, customer.BalanceWithJobs }; + + var actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MetaData.CreateTime <"+ DateTime.Today).Select(c => new { Customer = c, c.BalanceWithJobs }); + foreach (var cust in actualCustomers) + { + Debug.WriteLine(cust.BalanceWithJobs + " --- " + cust.Customer.GivenName); + } + + } + + [TestMethod] + public void CustomerQuerySelectWhereAllTests1() + { + var filterCustomers = from customer in customers + select new { customer, customer.BalanceWithJobs }; + + var actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MetaData.CreateTime < "+DateTime.Today).Select(c => new { Customer = c, c.BalanceWithJobs }); + foreach (var cust in actualCustomers) + { + Debug.WriteLine(cust.BalanceWithJobs + " --- " + cust.Customer.GivenName); + } + + } + + [TestMethod] + public void CustomerQuerySelectWhereDefaultTests() + { + var filterCustomer = from customer in customers + select customer; + + var actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MetaData.CreateTime <"+ DateTime.Today).Select(c => c); + //int i = 0; + foreach (var cust in actualCustomers) + { + //Debug.WriteLine(cust.BalanceWithJobs); + //Debug.WriteLine(cust.GivenName); + //i++; + } + + } + + [TestMethod] + public void CustomerQuerySelectWhereNonDefaultTests() + { + var filterCustomer = from customer in customers + select customer.BalanceWithJobs; + + var actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MetaData.CreateTime <"+ DateTime.Today).Select(c => c.BalanceWithJobs); + + foreach (var cust in actualCustomers) + { + } + + } + + [TestMethod] + public void CustomerQuerySelectWhereTests() + { + var filterCustomer = from customer in customers + select new { customer.BalanceWithJobs, customer.GivenName }; + + var actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MetaData.CreateTime <"+ DateTime.Today).Select(c => new { c.BalanceWithJobs, c.GivenName }); + + foreach (var cust in actualCustomers) + { + } + + } + + [TestMethod] + public void CustomerQuerySelectWhereIdGivenNameTests() + { + var filterCustomer = from customer in customers + select new { customer.Id, customer.GivenName }; + + var actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MetaData.CreateTime <"+ DateTime.Today).Select(c => new { c.Id, c.GivenName }); + + foreach (var cust in actualCustomers) + { + + } + + } + + [TestMethod] + public void InvoiceQuerySelectWhereTests() + { + //var filterCustomer = from customer in customers + // select new { customer.Id, customer.GivenName }; + + var actualInvoices = invoiceQueryService.ExecuteIdsQuery("Select * from Customer where MetaData.CreateTime <"+ DateTime.Today).Select(i => new { i.Id, i.DocNumber }); + + foreach (var invoice in actualInvoices) + { + + } + + } + + [TestMethod] + public void InvoiceQueryComplexSelectWhereTests() + { + //var filterCustomer = from customer in customers + // select new { customer.Id, customer.GivenName }; + + var actualInvoices = invoiceQueryService.ExecuteIdsQuery("Select * from Customer where MetaData.CreateTime <"+ DateTime.Today).Select(i => new { i.Id, i.Line }); + + foreach (var invoice in actualInvoices) + { + + } + + } + + [TestMethod] + public void InvoiceQueryComplexSelectWhereLineIdTests() + { + var filterCustomer = from invoice in invoices + select new { invoice.Line }; + + var actualInvoices = invoiceQueryService.ExecuteIdsQuery("Select * from Customer where MetaData.CreateTime <"+ DateTime.Today).Select(i => new { Line = i.Line }); + + foreach (var inv in actualInvoices) + { + foreach (var line in inv.Line) + { + Debug.WriteLine(line.Id); + } + } + + } + #endregion + + #region Where + OrderBy + + [TestMethod] + public void CustomerQueryWhereOrderByTests() + { + string[] values = { "1", "2", "3" }; + IEnumerable filterCustomer = from customer in customers + where customer.Id.In(values) + orderby customer.GivenName + select customer; + + List expectedCustomers = filterCustomer.ToList(); + IEnumerable actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MetaData.CreateTime >= "+DateTime.Today.AddDays(-5)).OrderBy(c => c.FamilyName).OrderByDescending(c => c.GivenName).Skip(2); + } + + [TestMethod] + public void CustomerQueryWhereOrderByDescTests() + { + string[] values = { "1", "2", "3" }; + IEnumerable filterCustomer = from customer in customers + where customer.Id.In(values) + orderby customer.GivenName descending + select customer; + + List expectedCustomers = filterCustomer.ToList(); + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where Id.In('"+values+"')").OrderByDescending(c => c.GivenName).ToList(); + } + + #endregion + + #region Where + Count + + [TestMethod] + public void CustomerQueryWhereCountMiddleNameLikeStartWithTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.MiddleName != null && customer.MiddleName.StartsWith("C") + select customer; + + int expectedCustomers = filterCustomer.Count(); + //QUERY * FROM Customer WHERE MiddleName LIKE 'C*' + int actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MiddleName.StartsWith('C')").Count(); + + Assert.IsTrue(expectedCustomers <= actualCustomers); + + } + + [TestMethod] + public void CustomerQueryWhereCountMiddleNameLikeEndsWithTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.MiddleName != null && customer.MiddleName.EndsWith("t") + select customer; + + int expectedCustomers = filterCustomer.Count(); + //QUERY * FROM Customer WHERE MiddleName LIKE '12' + int actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MiddleName.EndsWith('t')").Count(); + Assert.IsTrue(expectedCustomers <= actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereCountMiddleNameLikeContainsTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.MiddleName != null && customer.MiddleName.StartsWith("C") && customer.MiddleName.Contains("t") + select customer; + + int expectedCustomers = filterCustomer.Count(); + + //QUERY * FROM Customer WHERE MiddleName LIKE 'Test*12' + int actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MiddleName.Contains('C %t')").Count(); + + Assert.IsTrue(expectedCustomers <= actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereCountMiddleNameEQTests() + { + //QUERY * FROM Customer WHERE MiddleName EQ 'Cust' + IEnumerable filterCustomer = from customer in customers + where customer.MiddleName != null && customer.MiddleName.Equals("Cust") + select customer; + + int expectedCustomers = filterCustomer.Count(); + + int actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MiddleName == 'Cust'").Count(); + + Assert.IsTrue(expectedCustomers <= actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereCountGivenNameLikeStartWithTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.GivenName != null && customer.GivenName.StartsWith("C") + select customer; + + int expectedCustomers = filterCustomer.Count(); + //QUERY * FROM Customer WHERE GivenName LIKE 'C*' + int actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from customer where GivenName.StartsWith('C')").Count(); + + Assert.IsTrue(expectedCustomers <= actualCustomers); + + } + + [TestMethod] + public void CustomerQueryWhereCountGivenNameLikeEndsWithTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.GivenName != null && customer.GivenName.EndsWith("t", StringComparison.OrdinalIgnoreCase) + select customer; + + int expectedCustomers = filterCustomer.Count(); + //QUERY * FROM Customer WHERE GivenName LIKE '12' + int actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where GivenName.EndsWith('t')").Count(); + Assert.IsTrue(expectedCustomers <= actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereCountGivenNameLikeContainsTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.GivenName != null && customer.GivenName.StartsWith("C") && customer.GivenName.EndsWith("t") + select customer; + + int expectedCustomers = filterCustomer.Count(); + + //QUERY * FROM Customer WHERE GivenName LIKE 'Test*12' + int actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from customer where GivenName like ('C%t')").Count(); + + Assert.IsTrue(expectedCustomers <= actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereCountGivenNameContainsTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.GivenName != null && customer.GivenName.Contains("est") + select customer; + + int expectedCustomers = filterCustomer.Count(); + + //QUERY * FROM Customer WHERE GivenName LIKE 'Test*12' + int actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from customer where GivenName like 'est'").Count(); + + Assert.IsTrue(expectedCustomers <= actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereCountGivenNameEQTests() + { + //QUERY * FROM Customer WHERE GivenName EQ 'Cust' + IEnumerable filterCustomer = from customer in customers + where customer.GivenName != null && customer.GivenName.Equals("Cust") + select customer; + + int expectedCustomers = filterCustomer.Count(); + + int actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from customer where GivenName == 'Cust'").Count(); + + Assert.IsTrue(expectedCustomers <= actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereCountFamilyNameLikeStartWithTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.FamilyName != null && customer.FamilyName.StartsWith("C") + select customer; + + int expectedCustomers = filterCustomer.Count(); + //QUERY * FROM Customer WHERE FamilyName LIKE 'C*' + int actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from customer where FamilyName.StartsWith('C')").Count(); + + Assert.IsTrue(expectedCustomers <= actualCustomers); + + } + + [TestMethod] + public void CustomerQueryWhereCountFamilyNameLikeEndsWithTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.FamilyName != null && customer.FamilyName.EndsWith("t") + select customer; + + int expectedCustomers = filterCustomer.Count(); + //QUERY * FROM Customer WHERE FamilyName LIKE '12' + int actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where FamilyName.EndsWith('t')").Count(); + Assert.IsTrue(expectedCustomers <= actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereCountFamilyNameLikeContainsTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.FamilyName != null && customer.FamilyName.StartsWith("C") && customer.FamilyName.EndsWith("t") + select customer; + + int expectedCustomers = filterCustomer.Count(); + + //QUERY * FROM Customer WHERE FamilyName LIKE 'Test*12' + int actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where FamilyName.Contains('C%t')").Count(); + + Assert.IsTrue(expectedCustomers <= actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereCountFamilyNameEQTests() + { + //QUERY * FROM Customer WHERE FamilyName EQ 'Cust' + IEnumerable filterCustomer = from customer in customers + where customer.FamilyName != null && customer.FamilyName.Equals("Cust") + select customer; + + int expectedCustomers = filterCustomer.Count(); + + int actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where FamilyName == 'Cust'").Count(); + + Assert.IsTrue(expectedCustomers <= actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereCountActiveTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.Active == true + select customer; + + int expectedCustomers = filterCustomer.Count(); + + //QUERY * FROM Customer WHERE Active EQ True + int actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from customer where Active == true").Count(); + + Assert.IsTrue(expectedCustomers <= actualCustomers); + } + + //[TestMethod] + ////Service gives error : QueryValidationError: Property status not found for Entity Customer if status field is included in the query + //public void CustomerQueryWhereCountStatusTests() + //{ + // IEnumerable filterCustomer = from customer in customers + // where customer.status == EntityStatusEnum.Pending + // select customer; + + // int expectedCustomers = filterCustomer.Count(); + // //QUERY * FROM Customer WHERE Active EQ True + // int actualCustomers = customerQueryService.Where(customer => customer.status == EntityStatusEnum.Pending).Count(); + // Assert.IsTrue(expectedCustomers <= actualCustomers); + //} + + [TestMethod] + public void CustomerQueryWhereCountBalanceEQTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.Balance == 1000 + select customer; + + int expectedCustomers = filterCustomer.Count(); + //QUERY * FROM Customer WHERE Balance EQ '1000' + int actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from customer where Balance == 1000").Count(); + Assert.IsTrue(expectedCustomers <= actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereCountBalanceLTTests() + { + + IEnumerable filterCustomer = from customer in customers + where customer.Balance < 1000 + select customer; + + int expectedCustomers = filterCustomer.Count(); + //QUERY * FROM Customer WHERE Balance LT '1000' + int actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from customer where Balance < 1000").Count(); + Assert.IsTrue(expectedCustomers <= actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereCountBalanceGTTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.Balance > 1000 + select customer; + + int expectedCustomers = filterCustomer.Count(); + //QUERY * FROM Customer WHERE Balance GT '1000' + int actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from customer where Balance > 1000").Count; + Assert.IsTrue(expectedCustomers <= actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereCountBalanceLETests() + { + IEnumerable filterCustomer = from customer in customers + where customer.Balance <= 1000 + select customer; + int expectedCustomers = filterCustomer.Count(); + //QUERY * FROM Customer WHERE Balance LTE '1000' + int actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where Balance <= 1000").Count(); + Assert.IsTrue(expectedCustomers <= actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereCountBalanceGETests() + { + IEnumerable filterCustomer = from customer in customers + where customer.Balance >= 1000 + select customer; + int expectedCustomers = filterCustomer.Count(); + //QUERY * FROM Customer WHERE Balance GTE '1000' + int actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from customer where Balance >= 1000").Count(); + Assert.IsTrue(expectedCustomers <= actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereCountCreateTimeEQNowTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.MetaData.CreateTime == DateTime.Now + select customer; + int expectedCustomers = filterCustomer.Count(); + //QUERY * FROM Customer WHERE MetaData.CreateTime EQ '2012-07-10T15:16:51+05:30' + var actualCustomersData = customerQueryService.ExecuteIdsQuery("Select * from Customer").ToList(); + int count = 0; + foreach (Customer c in actualCustomersData) + { + if (c.MetaData.LastUpdatedTime > new DateTime(2012, 06, 30, 11, 20, 50)) + if (c.MetaData != null && c.MetaData.LastUpdatedTime == DateTime.Now) + { + count++; + } + } + Assert.IsTrue(expectedCustomers <= count); + } + + [TestMethod] + public void CustomerQueryWhereCountCreateTimeEQTodayTests() + { + + IEnumerable filterCustomer = from customer in customers + where customer.MetaData.CreateTime == DateTime.Today + select customer; + int expectedCustomers = filterCustomer.Count(); + //QUERY * FROM Customer WHERE MetaData.CreateTime EQ '2012-07-10T00:00:00+05:30' + var actualCustomersData = customerQueryService.ExecuteIdsQuery("Select * from Customer").ToList(); + int count = 0; + foreach (Customer c in actualCustomersData) + { + if (c.MetaData.LastUpdatedTime > new DateTime(2012, 06, 30, 11, 20, 50)) + if (c.MetaData != null && c.MetaData.LastUpdatedTime == DateTime.Today) + { + count++; + } + } + Assert.IsTrue(expectedCustomers <= count); + } + + [TestMethod] + public void CustomerQueryWhereCountCreateTimeGTNowTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.MetaData.CreateTime > DateTime.Now.AddDays(-2) + select customer; + int expectedCustomers = filterCustomer.Count(); + //QUERY * FROM Customer WHERE MetaData.CreateTime EQ '2012-07-10T15:16:51+05:30' + int actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MetaData.CreateTime >"+ DateTime.Now.AddDays(-2)).Count(); + Assert.IsTrue(expectedCustomers <= actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereCountCreateTimeGTTodayTests() + { + + IEnumerable filterCustomer = from customer in customers + where customer.MetaData.CreateTime > DateTime.Today.AddDays(-2) + select customer; + int expectedCustomers = filterCustomer.Count(); + //QUERY * FROM Customer WHERE MetaData.CreateTime EQ '2012-07-10T00:00:00+05:30' + var actualCustomersData = customerQueryService.ExecuteIdsQuery("Select * from Customer").ToList(); + int count = 0; + foreach (Customer c in actualCustomersData) + { + if (c.MetaData.LastUpdatedTime > new DateTime(2012, 06, 30, 11, 20, 50)) + if (c.MetaData != null && c.MetaData.LastUpdatedTime > DateTime.Today.AddDays(-2)) + { + count++; + } + } + Assert.IsTrue(expectedCustomers <= count); + } + + [TestMethod] + public void CustomerQueryWhereCountCreateTimeGTDateTimeTests() + { + + IEnumerable filterCustomer = from customer in customers + where customer.MetaData.CreateTime > new DateTime(2012, 06, 30, 11, 20, 50) + select customer; + int expectedCustomers = filterCustomer.Count(); + //QUERY * FROM Customer WHERE MetaData.CreateTime EQ '2012-07-10T15:16:51+05:30' + var actualCustomersData = customerQueryService.ExecuteIdsQuery("Select * from Customer").ToList(); + int count = 0; + foreach (Customer c in actualCustomersData) + { + if (c.MetaData.LastUpdatedTime > new DateTime(2012, 06, 30, 11, 20, 50)) + if (c.MetaData != null && c.MetaData.LastUpdatedTime > new DateTime(2012, 06, 30, 11, 20, 50)) + { + count++; + } + } + Assert.IsTrue(expectedCustomers <= count); + } + + [TestMethod] + public void CustomerQueryWhereCountCreateTimeGTDateTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.MetaData.CreateTime > new DateTime(2012, 06, 30) + select customer; + int expectedCustomers = filterCustomer.Count(); + //QUERY * FROM Customer WHERE MetaData.CreateTime EQ '2012-07-10T00:00:00+05:30' + var actualCustomersData = customerQueryService.ExecuteIdsQuery("Select * from Customer").ToList(); + int count = 0; + foreach (Customer c in actualCustomersData) + { + if (c.MetaData.LastUpdatedTime > new DateTime(2012, 06, 30)) + if (c.MetaData != null && c.MetaData.LastUpdatedTime > new DateTime(2012, 06, 30)) + { + count++; + } + } + Assert.IsTrue(expectedCustomers <= count); + } + + [TestMethod] + public void CustomerQueryWhereCountLastUpdatedTimeEQNowTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.MetaData.LastUpdatedTime == DateTime.Now + select customer; + int expectedCustomers = filterCustomer.Count(); + //QUERY * FROM Customer WHERE MetaData.LastUpdatedTime EQ '2012-07-10T15:16:51+05:30' + var actualCustomersData = customerQueryService.ExecuteIdsQuery("Select * from Customer").ToList(); + int count = 0; + foreach (Customer c in actualCustomersData) + { + if (c.MetaData.LastUpdatedTime > new DateTime(2012, 06, 30, 11, 20, 50)) + if (c.MetaData != null && c.MetaData.LastUpdatedTime == DateTime.Now) + { + count++; + } + } + Assert.IsTrue(expectedCustomers <= count); + } + + [TestMethod] + public void CustomerQueryWhereCountLastUpdatedTimeEQTodayTests() + { + + IEnumerable filterCustomer = from customer in customers + where customer.MetaData.LastUpdatedTime != DateTime.Today + select customer; + int expectedCustomers = filterCustomer.Count(); + //QUERY * FROM Customer WHERE MetaData.LastUpdatedTime EQ '2012-07-10T00:00:00+05:30' + var actualCustomersData = customerQueryService.ExecuteIdsQuery("Select * from Customer").ToList(); + int count = 0; + foreach (Customer c in actualCustomersData) + { + if (c.MetaData.LastUpdatedTime > new DateTime(2012, 06, 30, 11, 20, 50)) + if (c.MetaData != null && c.MetaData.LastUpdatedTime != DateTime.Today) + { + count++; + } + } + Assert.IsTrue(expectedCustomers <= count); + } + + [TestMethod] + public void CustomerQueryWhereCountLastUpdatedTimeGTNowTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.MetaData.LastUpdatedTime > DateTime.Now.AddDays(-2) + select customer; + int expectedCustomers = filterCustomer.Count(); + //QUERY * FROM Customer WHERE MetaData.LastUpdatedTime EQ '2012-07-10T15:16:51+05:30' + var actualCustomersData = customerQueryService.ExecuteIdsQuery("Select * from Customer").ToList(); + int count = 0; + foreach (Customer c in actualCustomersData) + { + if (c.MetaData.LastUpdatedTime > new DateTime(2012, 06, 30, 11, 20, 50)) + if (c.MetaData != null && c.MetaData.LastUpdatedTime > DateTime.Now.AddDays(-2)) + { + count++; + } + } + Assert.IsTrue(expectedCustomers <= count); + } + + [TestMethod] + public void CustomerQueryWhereCountLastUpdatedTimeGTTodayTests() + { + + IEnumerable filterCustomer = from customer in customers + where customer.MetaData.LastUpdatedTime > DateTime.Today.AddDays(-2) + select customer; + int expectedCustomers = filterCustomer.Count(); + //QUERY * FROM Customer WHERE MetaData.LastUpdatedTime EQ '2012-07-10T00:00:00+05:30' + var actualCustomersData = customerQueryService.ExecuteIdsQuery("Select * from Customer").ToList(); + int count = 0; + foreach (Customer c in actualCustomersData) + { + if (c.MetaData.LastUpdatedTime > new DateTime(2012, 06, 30, 11, 20, 50)) + if (c.MetaData != null && c.MetaData.LastUpdatedTime > DateTime.Today.AddDays(-2)) + { + count++; + } + } + Assert.IsTrue(expectedCustomers <= count); + } + + [TestMethod] + public void CustomerQueryWhereCountLastUpdatedTimeGTDateTimeTests() + { + + IEnumerable filterCustomer = from customer in customers + where customer.MetaData.LastUpdatedTime > new DateTime(2012, 06, 30, 11, 20, 50) + select customer; + int expectedCustomers = filterCustomer.Count(); + //QUERY * FROM Customer WHERE MetaData.LastUpdatedTime EQ '2012-07-10T15:16:51+05:30' + var actualCustomersData = customerQueryService.ExecuteIdsQuery("Select * from Customer").ToList(); + int count = 0; + foreach (Customer c in actualCustomersData) + { + if (c.MetaData.LastUpdatedTime > new DateTime(2012, 06, 30, 11, 20, 50)) + if (c.MetaData != null && c.MetaData.LastUpdatedTime > new DateTime(2012, 06, 30)) + { + count++; + } + } + Assert.IsTrue(expectedCustomers <= count); + } + + [TestMethod] + public void CustomerQueryWhereCountLastUpdatedTimeGTDateTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.MetaData.LastUpdatedTime > new DateTime(2012, 06, 30) + select customer; + int expectedCustomers = filterCustomer.Count(); + //QUERY * FROM Customer WHERE MetaData.LastUpdatedTime EQ '2012-07-10T00:00:00+05:30' + var actualCustomersData = customerQueryService.ExecuteIdsQuery("Select * from Customer").ToList(); + int count = 0; + foreach(Customer c in actualCustomersData) + { + if (c.MetaData.LastUpdatedTime > new DateTime(2012, 06, 30)) + if (c.MetaData!=null && c.MetaData.LastUpdatedTime > new DateTime(2012, 06, 30)) + { + count++; + } + } + Assert.IsTrue(expectedCustomers <= count); + } + + [TestMethod] + public void CustomerQueryWhereCountIDEQTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.Id == "1" + select customer; + int expectedCustomers = filterCustomer.Count(); + //QUERY * FROM Customer WHERE Id EQ 'NG:456344' + int actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where Id='1'").Count; + Assert.IsTrue(expectedCustomers <= actualCustomers); + } + + + [TestMethod] + public void CustomerQueryWhereCountMiddleGivenFamilyNameLikeStartWithTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.MiddleName != null && customer.MiddleName.StartsWith("C") && customer.GivenName != null && + customer.GivenName.StartsWith("Test") && customer.FamilyName != null && customer.FamilyName.StartsWith("C") + select customer; + + int expectedCustomers = filterCustomer.Count(); + //QUERY * FROM Customer WHERE MiddleName LIKE 'C' AND FamilyName LIKE 'C' AND GivenName LIKE 'Test' + int actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from customer where MiddleName.StartsWith('C') && FamilyName.StartsWith('C') && GivenName.StartsWith('Test')").Count; + + Assert.IsTrue(expectedCustomers <= actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereCountMiddleGivenFamilyNameLikeEndsWithTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.MiddleName != null && customer.MiddleName.EndsWith("C") && customer.GivenName != null && + customer.GivenName.EndsWith("Test") && customer.FamilyName != null && customer.FamilyName.EndsWith("C") + select customer; + + int expectedCustomers = filterCustomer.Count(); + //QUERY * FROM Customer WHERE MiddleName LIKE 'C' AND FamilyName LIKE 'C' AND GivenName LIKE 'Test' + int actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MiddleName.EndsWith('C') && FamilyName.EndsWith('C') && GivenName.EndsWith('Test')").Count; + + Assert.IsTrue(expectedCustomers <= actualCustomers); + } + + [TestMethod] + public void CustomerQueryWhereCountMiddleGivenFamilyNameLikeContainsTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.MiddleName != null && customer.MiddleName.Contains("C%t") && customer.GivenName != null && + customer.GivenName.Contains("T%1") && customer.FamilyName != null && customer.FamilyName.Contains("T%1") + select customer; + + int expectedCustomers = filterCustomer.Count(); + int actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where MiddleName.Contains('C%t') && FamilyName.Contains('T%1') && GivenName.Contains('T%1')").Count; + + Assert.IsTrue(expectedCustomers <= actualCustomers); + } + + #endregion + + #region Where + Select + OrderBy + + #endregion + + #region Where + Select + OrderBy + Take - Skip + + [TestMethod] + public void CustomerQueryTests() + { + var filterCustomers = from customer in customers + select customer; + + // var actualCustomers = customerQueryService.Where(c => c.MiddleName.StartsWith("C")).Take(7).Skip(2).Select(c => new { c.Id, c.GivenName, c.FamilyName }); + var actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from customers where c.MiddleName.StartsWith('C')").Take(7).Skip(2).Select(c => new { c.Id, c.GivenName, c.FamilyName }); + foreach (var cust in actualCustomers) + { + } + + } + + #endregion + + #region Not + + [TestMethod] + public void CustomerQueryWhereNOTGivenNameEQTests() + { + IEnumerable filterCustomer = from customer in customers + where customer.Active == true && customer.MetaData.CreateTime > DateTime.Today.AddDays(-5) + select customer; + + List expectedCustomers = filterCustomer.ToList(); + + List actualCustomers = customerQueryService.ExecuteIdsQuery("Select * from Customer where !(Active != true) && !(MetaData.CreateTime < DateTime.Today.AddDays(-5))).ToList()").ToList(); + + VerifyCustomers(expectedCustomers, actualCustomers, false); + } + + #endregion + + #region Multiple Queries + + [TestMethod] + public void MultipleQueryTests() + { + string invoiceQueryValue = invoiceQueryService.ExecuteIdsQuery("Select * from invoice").Select(i => new { i.Id, i.status }).ToString(); + List values = new List { "Select * from customer where MetaData.CreateTime > " + DateTime.Today.AddDays(-20), invoiceQueryValue }; + + try + { + ReadOnlyCollection> results = customerQueryService.ExecuteMultipleEntityQueries(values.AsReadOnly()); + foreach (var item in results) + { + } + } + catch (ValidationException) + { + } + catch (IdsException ex) + { + Assert.Fail(ex.ToString()); + } + + } + + #endregion + + #region PreDefined Property Set + + [TestMethod] + public void PredefinedPropertySetTest() + { + var query = customerQueryService.ExecuteIdsQuery("Select * from customer").Select(c => new { c.MiddleName, c.Balance }); + foreach (var item in query) + { + + } + } + + + #endregion + + #region Helper + + private void VerifyCustomers(List expectedCustomers, List actualCustomers) + { + VerifyCustomers(expectedCustomers, actualCustomers, true); + } + + private void VerifyCustomers(List expectedCustomers, List actualCustomers, bool verifyCount) + { + if (verifyCount) { Assert.AreEqual(expectedCustomers.Count, actualCustomers.Count); } + foreach (Customer customer in expectedCustomers) + { + bool foundActualCustomer = false; + foreach (Customer actualCustomer in actualCustomers) + { + if (actualCustomer.Id == customer.Id) + { + foundActualCustomer = true; + break; + } + } + Assert.IsTrue(foundActualCustomer); + } + } + + private void VerifyInvoices(List expectedInvoices, List actualInvoices) + { + Assert.AreEqual(expectedInvoices.Count, actualInvoices.Count); + int i = 0; + foreach (Invoice invoice in expectedInvoices) + { + Assert.AreEqual(invoice.Id, actualInvoices[i].Id); + i++; + } + } + + #endregion + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/RefundReceipt.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/RefundReceipt.cs new file mode 100644 index 0000000..726dbeb --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/RefundReceipt.cs @@ -0,0 +1,336 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class RefundReceiptTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void RefundReceiptAddTestUsingoAuth() + { + //Creating the RefundReceipt for Add + RefundReceipt refundReceipt = QBOHelper.CreateRefundReceipt(qboContextoAuth); + //Adding the RefundReceipt + RefundReceipt added = Helper.Add(qboContextoAuth, refundReceipt); + //Verify the added RefundReceipt + QBOHelper.VerifyRefundReceipt(refundReceipt, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void RefundReceiptFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + RefundReceiptAddTestUsingoAuth(); + + //Retrieving the RefundReceipt using FindAll + List refundReceipts = Helper.FindAll(qboContextoAuth, new RefundReceipt(), 1, 500); + Assert.IsNotNull(refundReceipts); + Assert.IsTrue(refundReceipts.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void RefundReceiptFindbyIdTestUsingoAuth() + { + //Creating the RefundReceipt for Adding + RefundReceipt refundReceipt = QBOHelper.CreateRefundReceipt(qboContextoAuth); + //Adding the RefundReceipt + RefundReceipt added = Helper.Add(qboContextoAuth, refundReceipt); + RefundReceipt found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyRefundReceipt(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void RefundReceiptUpdateTestUsingoAuth() + { + //Creating the RefundReceipt for Adding + RefundReceipt refundReceipt = QBOHelper.CreateRefundReceipt(qboContextoAuth); + //Adding the RefundReceipt + RefundReceipt added = Helper.Add(qboContextoAuth, refundReceipt); + //Change the data of added entity + RefundReceipt changed = QBOHelper.UpdateRefundReceipt(qboContextoAuth, added); + //Update the returned entity data + RefundReceipt updated = Helper.Update(qboContextoAuth, changed);//Verify the updated RefundReceipt + QBOHelper.VerifyRefundReceipt(changed, updated); + } + + [TestMethod] + public void RefundReceiptSparseUpdateTestUsingoAuth() + { + //Creating the RefundReceipt for Adding + RefundReceipt refundReceipt = QBOHelper.CreateRefundReceipt(qboContextoAuth); + //Adding the RefundReceipt + RefundReceipt added = Helper.Add(qboContextoAuth, refundReceipt); + //Change the data of added entity + RefundReceipt changed = QBOHelper.UpdateRefundReceiptSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + RefundReceipt updated = Helper.Update(qboContextoAuth, changed);//Verify the updated RefundReceipt + QBOHelper.VerifyRefundReceiptSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void RefundReceiptDeleteTestUsingoAuth() + { + //Creating the RefundReceipt for Adding + RefundReceipt refundReceipt = QBOHelper.CreateRefundReceipt(qboContextoAuth); + //Adding the RefundReceipt + RefundReceipt added = Helper.Add(qboContextoAuth, refundReceipt); + //Delete the returned entity + try + { + RefundReceipt deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod][Ignore] + public void RefundReceiptVoidTestUsingoAuth() + { + //Creating the entity for Adding + RefundReceipt entity = QBOHelper.CreateRefundReceipt(qboContextoAuth); + //Adding the entity + RefundReceipt added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + RefundReceipt voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void RefundReceiptCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + RefundReceiptAddTestUsingoAuth(); + + //Retrieving the RefundReceipt using CDC + List entities = Helper.CDC(qboContextoAuth, new RefundReceipt(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void RefundReceiptBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + RefundReceipt existing = Helper.FindOrAdd(qboContextoAuth, new RefundReceipt()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateRefundReceipt(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateRefundReceipt(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from RefundReceipt"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as RefundReceipt).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void RefundReceiptQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + RefundReceipt existing = Helper.FindOrAdd(qboContextoAuth, new RefundReceipt()); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM RefundReceipt where Id='" + existing.Id + "'").ToList(); + + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void RefundReceiptAddAsyncTestsUsingoAuth() + { + //Creating the RefundReceipt for Add + RefundReceipt entity = QBOHelper.CreateRefundReceipt(qboContextoAuth); + + RefundReceipt added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyRefundReceipt(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void RefundReceiptRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + RefundReceiptAddTestUsingoAuth(); + + //Retrieving the RefundReceipt using FindAll + Helper.FindAllAsync(qboContextoAuth, new RefundReceipt()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void RefundReceiptFindByIdAsyncTestsUsingoAuth() + { + //Creating the RefundReceipt for Adding + RefundReceipt entity = QBOHelper.CreateRefundReceipt(qboContextoAuth); + //Adding the RefundReceipt + RefundReceipt added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void RefundReceiptUpdatedAsyncTestsUsingoAuth() + { + //Creating the RefundReceipt for Adding + RefundReceipt entity = QBOHelper.CreateRefundReceipt(qboContextoAuth); + //Adding the RefundReceipt + RefundReceipt added = Helper.Add(qboContextoAuth, entity); + + //Update the RefundReceipt + RefundReceipt updated = QBOHelper.UpdateRefundReceipt(qboContextoAuth, added); + //Call the service + RefundReceipt updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated RefundReceipt + QBOHelper.VerifyRefundReceipt(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void RefundReceiptDeleteAsyncTestsUsingoAuth() + { + //Creating the RefundReceipt for Adding + RefundReceipt entity = QBOHelper.CreateRefundReceipt(qboContextoAuth); + //Adding the RefundReceipt + RefundReceipt added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] + [Ignore] + public void RefundReceiptVoidAsyncTestsUsingoAuth() + { + //Creating the RefundReceipt for Adding + RefundReceipt entity = QBOHelper.CreateRefundReceipt(qboContextoAuth); + //Adding the RefundReceipt + RefundReceipt added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Reports.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Reports.cs new file mode 100644 index 0000000..53f5c28 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Reports.cs @@ -0,0 +1,563 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using Intuit.Ipp.DataService; +using System.Collections.ObjectModel; +using Intuit.Ipp.ReportService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class ReportsTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + qboContextoAuth.IppConfiguration.Message.Response.SerializationFormat = Intuit.Ipp.Core.Configuration.SerializationFormat.Json; + } + + #region " Sync Methods " + + [TestMethod] + public void ReportsBalanceSheetTestUsingoAuth() + { + ReportService.ReportService reportsService = new ReportService.ReportService(qboContextoAuth); + reportsService.start_date = "2014-01-01"; + reportsService.end_date = "2014-12-31"; + reportsService.qzurl = "true"; //should return href tag + reportsService.subcol_py_chg = "true"; + reportsService.accounting_method = "Accrual"; + Report report = reportsService.ExecuteReport("BalanceSheet"); + Assert.IsNotNull(report); + Assert.AreEqual("BalanceSheet", report.Header.ReportName); + Assert.AreEqual(report.Header.ReportBasis.ToString(), reportsService.accounting_method); + Assert.AreEqual(report.Header.StartPeriod, reportsService.start_date); + } + + + [TestMethod] + public void ReportsProfitAndLossTestUsingoAuth() + { + ReportService.ReportService reportsService = new ReportService.ReportService(qboContextoAuth); + reportsService.date_macro = "This Fiscal Year-to-date"; + reportsService.accounting_method = "Accrual"; + reportsService.qzurl = "true"; + reportsService.subcol_py_chg = "true"; + Report report = reportsService.ExecuteReport("ProfitAndLoss"); + Assert.IsNotNull(report); + Assert.AreEqual("ProfitAndLoss", report.Header.ReportName); + Assert.AreEqual(report.Header.ReportBasis.ToString(), reportsService.accounting_method); + + } + + [TestMethod] + public void ReportsCashFlowTestUsingoAuth() + { + ReportService.ReportService reportsService = new ReportService.ReportService(qboContextoAuth); + reportsService.start_date = "2014-01-01"; + reportsService.end_date = "2014-12-31"; + reportsService.qzurl = "true"; + Report report = reportsService.ExecuteReport("CashFlow"); + Assert.IsNotNull(report); + Assert.AreEqual("CashFlow", report.Header.ReportName); + Assert.AreEqual(report.Header.StartPeriod, reportsService.start_date); + + } + + [TestMethod] + public void ReportsAPAgingSummaryTestUsingoAuth() + { + ReportService.ReportService reportsService = new ReportService.ReportService(qboContextoAuth); + reportsService.start_date = "2014-01-01"; + reportsService.end_date = "2014-12-31"; + reportsService.qzurl = "true"; + Report report = reportsService.ExecuteReport("AgedPayables"); + Assert.IsNotNull(report); + Assert.AreEqual("AgedPayables", report.Header.ReportName); + + } + + + + [TestMethod] + public void ReportsARAgingSummaryTestUsingoAuth() + { + ReportService.ReportService reportsService = new ReportService.ReportService(qboContextoAuth); + reportsService.start_date = "2014-01-01"; + reportsService.end_date ="2014-12-31"; + reportsService.qzurl = "true"; + Report report = reportsService.ExecuteReport("AgedReceivables"); + Assert.IsNotNull(report); + Assert.AreEqual("AgedReceivables", report.Header.ReportName); + + } + + [TestMethod] + public void ReportsCustomerIncomeTestUsingoAuth() + { + ReportService.ReportService reportsService = new ReportService.ReportService(qboContextoAuth); + reportsService.start_date = "2014-01-01"; + reportsService.end_date = "2014-12-31"; + reportsService.accounting_method = "Accrual"; + reportsService.subcol_py_chg = "true"; + Report report = reportsService.ExecuteReport("CustomerIncome"); + Assert.IsNotNull(report); + Assert.AreEqual("CustomerIncome", report.Header.ReportName); + Assert.AreEqual(report.Header.ReportBasis.ToString(), reportsService.accounting_method); + Assert.AreEqual(report.Header.StartPeriod, reportsService.start_date); + + } + + [TestMethod] + public void ReportsCustomerBalanceTestUsingoAuth() + { + ReportService.ReportService reportsService = new ReportService.ReportService(qboContextoAuth); + reportsService.start_date = "2014-01-01"; + reportsService.end_date = "2014-12-31"; + Report report = reportsService.ExecuteReport("CustomerBalance"); + Assert.IsNotNull(report); + Assert.AreEqual("CustomerBalance", report.Header.ReportName); + + } + + [TestMethod] + public void ReportsCustomerSalesTestUsingoAuth() + { + ReportService.ReportService reportsService = new ReportService.ReportService(qboContextoAuth); + reportsService.start_date = "2014-01-01"; + reportsService.end_date = "2014-12-31"; + reportsService.accounting_method = "Accrual"; + reportsService.subcol_py_chg = "true"; + Report report = reportsService.ExecuteReport("CustomerSales"); + Assert.IsNotNull(report); + Assert.AreEqual("CustomerSales", report.Header.ReportName); + Assert.AreEqual(report.Header.ReportBasis.ToString(), reportsService.accounting_method); + Assert.AreEqual(report.Header.StartPeriod, reportsService.start_date); + + } + + [TestMethod] + public void ReportsItemSalesTestUsingoAuth() + { + ReportService.ReportService reportsService = new ReportService.ReportService(qboContextoAuth); + reportsService.start_date = "2014-01-01"; + reportsService.end_date = "2014-12-31"; + reportsService.accounting_method = "Accrual"; + Report report = reportsService.ExecuteReport("ItemSales"); + Assert.IsNotNull(report); + Assert.AreEqual("ItemSales", report.Header.ReportName); + Assert.AreEqual(report.Header.ReportBasis.ToString(), reportsService.accounting_method); + Assert.AreEqual(report.Header.StartPeriod, reportsService.start_date); + + } + + [TestMethod] + public void ReportsDepartmentSalesTestUsingoAuth() + { + ReportService.ReportService reportsService = new ReportService.ReportService(qboContextoAuth); + reportsService.start_date = "2014-01-01"; + reportsService.end_date = "2014-12-31"; + reportsService.accounting_method = "Accrual"; + reportsService.subcol_py_chg = "true"; + Report report = reportsService.ExecuteReport("DepartmentSales"); + Assert.IsNotNull(report); + Assert.AreEqual("DepartmentSales", report.Header.ReportName); + Assert.AreEqual(report.Header.ReportBasis.ToString(), reportsService.accounting_method); + Assert.AreEqual(report.Header.StartPeriod, reportsService.start_date); + + } + + [TestMethod] [Ignore] + public void ReportsBASTestUsingoAuth() + { + ReportService.ReportService reportsService = new ReportService.ReportService(qboContextoAuth); + reportsService.start_date = "2014-01-01"; + reportsService.end_date = "2014-12-31"; + reportsService.accounting_method = "cashbasis"; + Report report = reportsService.ExecuteReport("BAS"); + Assert.IsNotNull(report); + Assert.AreEqual("BAS", report.Header.ReportName); + Assert.AreEqual(report.Header.ReportBasis.ToString(), reportsService.accounting_method); + Assert.AreEqual(report.Header.StartPeriod, reportsService.start_date); + + } + + [TestMethod] + [Ignore]//QBO-47289 + public void ReportsInventoryTestUsingoAuth() + { + ReportService.ReportService reportsService = new ReportService.ReportService(qboContextoAuth); + reportsService.report_date = "2014-12-31"; + Report report = reportsService.ExecuteReport("InventoryValuationSummary"); + Assert.IsNotNull(report); + Assert.AreEqual("InventoryValuationSummary", report.Header.ReportName); + } + + [TestMethod] + public void ReportsSalesByProductTestUsingoAuth() + { + ReportService.ReportService reportsService = new ReportService.ReportService(qboContextoAuth); + reportsService.start_date = "2013-01-01"; + reportsService.end_date = "2014-12-31"; + Report report = reportsService.ExecuteReport("ItemSales"); + Assert.IsNotNull(report); + Assert.AreEqual("ItemSales", report.Header.ReportName); + } + + [TestMethod] + public void ReportsVendorBalanceTestUsingoAuth() + { + ReportService.ReportService reportsService = new ReportService.ReportService(qboContextoAuth); ; + reportsService.start_date = "2013-01-01"; + reportsService.end_date = "2014-12-31"; + Report report = reportsService.ExecuteReport("VendorBalance"); + Assert.IsNotNull(report); + Assert.AreEqual("VendorBalance", report.Header.ReportName); + } + + [TestMethod] + public void ReportsVendorExpenseTestUsingoAuth() + { + ReportService.ReportService reportsService = new ReportService.ReportService(qboContextoAuth); + reportsService.start_date = "2014-01-01"; + reportsService.end_date = "2014-12-31"; + reportsService.accounting_method = "Accrual"; + reportsService.subcol_py_chg = "true"; + Report report = reportsService.ExecuteReport("VendorExpenses"); + Assert.IsNotNull(report); + Assert.AreEqual("VendorExpenses", report.Header.ReportName); + Assert.AreEqual(report.Header.ReportBasis.ToString(), reportsService.accounting_method); + Assert.AreEqual(report.Header.StartPeriod, reportsService.start_date); + + } + + [TestMethod] + public void ReportsTrialBalanceTestUsingoAuth() + { + ReportService.ReportService reportsService = new ReportService.ReportService(qboContextoAuth); + reportsService.start_date = "2014-01-01"; + reportsService.end_date = "2014-12-31"; + Report report = reportsService.ExecuteReport("TrialBalance"); + Assert.IsNotNull(report); + Assert.AreEqual("TrialBalance", report.Header.ReportName); + Assert.AreEqual(report.Header.StartPeriod, reportsService.start_date); + + } + + [TestMethod] + public void ReportsClassSalesTestUsingoAuth() + { + ReportService.ReportService reportsService = new ReportService.ReportService(qboContextoAuth); + reportsService.start_date = "2014-01-01"; + reportsService.end_date = "2014-12-31"; + reportsService.subcol_py_chg = "true"; + reportsService.accounting_method = "Accrual"; + Report report = reportsService.ExecuteReport("ClassSales"); + Assert.IsNotNull(report); + Assert.AreEqual("ClassSales", report.Header.ReportName); + Assert.AreEqual(report.Header.ReportBasis.ToString(), reportsService.accounting_method); + Assert.AreEqual(report.Header.StartPeriod, reportsService.start_date); + + } + + //new ones + + [TestMethod] + public void ReportsAPAgingDetailTestUsingoAuth() + { + ReportService.ReportService reportsService = new ReportService.ReportService(qboContextoAuth); + reportsService.start_date = "2014-01-01"; + reportsService.end_date = "2014-12-31"; + Report report = reportsService.ExecuteReport("AgedPayableDetail"); + Assert.IsNotNull(report); + Assert.AreEqual("AgedPayableDetail", report.Header.ReportName); + + } + + [TestMethod] + public void ReportsARAgingDetailTestUsingoAuth() + { + ReportService.ReportService reportsService = new ReportService.ReportService(qboContextoAuth); + reportsService.start_date = "2014-01-01"; + reportsService.end_date = "2014-12-31"; + //reportsService.columns = "tx_date"; + Report report = reportsService.ExecuteReport("AgedReceivableDetail"); + Assert.IsNotNull(report); + Assert.AreEqual("AgedReceivableDetail", report.Header.ReportName); + + } + + [TestMethod] + public void ReportsCustomerBalanceDetailTestUsingoAuth() + { + ReportService.ReportService reportsService = new ReportService.ReportService(qboContextoAuth); + reportsService.start_date = "2014-01-01"; + reportsService.end_date = "2014-12-31"; + Report report = reportsService.ExecuteReport("CustomerBalanceDetail"); + Assert.IsNotNull(report); + Assert.AreEqual("CustomerBalanceDetail", report.Header.ReportName); + + } + + [TestMethod] + public void ReportsProfitAndLossDetailTestUsingoAuth() + { + ReportService.ReportService reportsService = new ReportService.ReportService(qboContextoAuth); + reportsService.start_date = "2014-01-01"; + reportsService.end_date = "2014-12-31"; + Report report = reportsService.ExecuteReport("ProfitAndLossDetail"); + Assert.IsNotNull(report); + Assert.AreEqual("ProfitAndLossDetail", report.Header.ReportName); + + } + + [TestMethod] + public void ReportsVendorBalanceDetailTestUsingoAuth() + { + ReportService.ReportService reportsService = new ReportService.ReportService(qboContextoAuth); ; + reportsService.start_date = "2014-01-01"; + reportsService.end_date = "2014-12-31"; + reportsService.qzurl = "true"; + Report report = reportsService.ExecuteReport("VendorBalanceDetail"); + Assert.IsNotNull(report); + Assert.AreEqual("VendorBalanceDetail", report.Header.ReportName); + } + + [TestMethod] + public void ReportsGeneralLedgerDetailTestUsingoAuth() + { + ReportService.ReportService reportsService = new ReportService.ReportService(qboContextoAuth); ; + reportsService.start_date = "2014-01-01"; + reportsService.end_date = "2014-12-31"; + Report report = reportsService.ExecuteReport("GeneralLedger"); + Assert.IsNotNull(report); + Assert.AreEqual("GeneralLedger", report.Header.ReportName); + } + + + + + [TestMethod] + public void ReportsAccountListTestUsingoAuth() + { + ReportService.ReportService reportsService = new ReportService.ReportService(qboContextoAuth); ; + reportsService.start_date = "2014-01-01"; + reportsService.end_date = "2014-12-31"; + reportsService.qzurl = "true";//not yet supported + Report report = reportsService.ExecuteReport("AccountList"); + Assert.IsNotNull(report); + Assert.AreEqual("AccountList", report.Header.ReportName); + } + + [TestMethod] + public void ReportsTransactionListTestUsingoAuth() + { + ReportService.ReportService reportsService = new ReportService.ReportService(qboContextoAuth); ; + reportsService.start_date = "2014-01-01"; + reportsService.end_date = "2014-12-31"; + reportsService.qzurl = "true";//not yet supported + Report report = reportsService.ExecuteReport("TransactionList"); + Assert.IsNotNull(report); + Assert.AreEqual("TransactionList", report.Header.ReportName); + } + + + + [TestMethod] + public void ReportsPrintTestUsingoAuth() + { + ReportService.ReportService reportsService = new ReportService.ReportService(qboContextoAuth); + reportsService.start_date = "2014-01-01"; + reportsService.end_date = "2014-12-31"; + reportsService.accounting_method = "Accrual"; + Report report = reportsService.ExecuteReport("BalanceSheet"); + StringBuilder reportText = new StringBuilder(); + //Append Report Header + printHeader(reportText, report); + //Determine Maxmimum Text Lengths to format Report + int[] maximumColumnTextSize = getMaximumColumnTextSize(report); + //Append Column Headers + printColumnData(reportText, report.Columns, maximumColumnTextSize, 0); + //Append Rows + printRows(reportText, report.Rows, maximumColumnTextSize, 1); + //Print Formatted Report to Console + Console.Write(reportText.ToString()); + } + + #endregion + + #region "Async Methods " + + [TestMethod] + public void ReportsBalanceSheetAsyncTestUsingoAuth() + { + Report report = Helper.GetReportAsync(qboContextoAuth, "BalanceSheet"); + Assert.AreEqual("BalanceSheet", report.Header.ReportName); + Assert.IsNotNull(report.Header.ReportBasis); + Assert.IsNotNull(report.Header.StartPeriod); + } + + + #endregion + + #region " Helper Methods " + + #region " Determine Maximum Column Text Length " + + static int[] getMaximumColumnTextSize(Report report) + { + if (report.Columns == null) { return null; } + int[] maximumColumnSize = new int[report.Columns.Count()]; + for (int columnIndex = 0; columnIndex < report.Columns.Count(); columnIndex++) + { + maximumColumnSize[columnIndex] = Math.Max(maximumColumnSize[columnIndex], report.Columns[columnIndex].ColTitle.Length); + } + return getMaximumRowColumnTextSize(report.Rows, maximumColumnSize, 1); + } + + static int[] getMaximumRowColumnTextSize(Row[] rows, int[] maximumColumnSize, int level) + { + for (int rowIndex = 0; rowIndex < rows.Length; rowIndex++) + { + Row row = rows[rowIndex]; + Header rowHeader = getRowProperty
(row, ItemsChoiceType1.Header); + if (rowHeader != null) { getMaximumColDataTextSize(rowHeader.ColData, maximumColumnSize, level); } + ColData[] colData = getRowProperty(row, ItemsChoiceType1.ColData); + if (colData != null) { getMaximumColDataTextSize(colData, maximumColumnSize, level); } + Rows nestedRows = getRowProperty(row, ItemsChoiceType1.Rows); + if (nestedRows != null) { getMaximumRowColumnTextSize(nestedRows.Row, maximumColumnSize, level + 1); } + Summary rowSummary = getRowProperty(row, ItemsChoiceType1.Summary); + if (rowSummary != null) { getMaximumColDataTextSize(rowSummary.ColData, maximumColumnSize, level); } + } + return maximumColumnSize; + } + + static int[] getMaximumColDataTextSize(ColData[] colData, int[] maximumColumnSize, int level) + { + for (int colDataIndex = 0; colDataIndex < colData.Length; colDataIndex++) + { + maximumColumnSize[colDataIndex] = Math.Max(maximumColumnSize[colDataIndex], (new String(' ', level * 3) + colData[colDataIndex].value).Length); + } + return maximumColumnSize; + } + + #endregion + + #region " Print Report Sections " + + static void printHeader(StringBuilder reportText, Report report) + { + const string lineDelimiter = "-----------------------------------------------------"; + reportText.AppendLine(report.Header.ReportName); + reportText.AppendLine(lineDelimiter); + reportText.AppendLine("As of " + report.Header.StartPeriod); + reportText.AppendLine(lineDelimiter); + reportText.AppendLine(lineDelimiter); + } + + static void printRows(StringBuilder reportText, Row[] rows, int[] maxColumnSize, int level) + { + for (int rowIndex = 0; rowIndex < rows.Length; rowIndex++) + { + Row row = rows[rowIndex]; + + //Get Row Header + Header rowHeader = getRowProperty
(row, ItemsChoiceType1.Header); + + //Append Row Header + if (rowHeader != null && rowHeader.ColData != null) { printColData(reportText, rowHeader.ColData, maxColumnSize, level); } + + //Get Row ColData + ColData[] colData = getRowProperty(row, ItemsChoiceType1.ColData); + + //Append ColData + if (colData != null) { printColData(reportText, colData, maxColumnSize, level); } + + //Get Child Rows + Rows childRows = getRowProperty(row, ItemsChoiceType1.Rows); + + //Append Child Rows + if (childRows != null) { printRows(reportText, childRows.Row, maxColumnSize, level + 1); } + + //Get Row Summary + Summary rowSummary = getRowProperty(row, ItemsChoiceType1.Summary); + + //Append Row Summary + if (rowSummary != null && rowSummary.ColData != null) { printColData(reportText, rowSummary.ColData, maxColumnSize, level); } + } + } + + static void printColData(StringBuilder reportText, ColData[] colData, int[] maxColumnSize, int level) + { + for (int colDataIndex = 0; colDataIndex < colData.Length; colDataIndex++) + { + if (colDataIndex > 0) { reportText.Append(" "); } + StringBuilder rowText = new StringBuilder(); + if (colDataIndex == 0) { rowText.Append(new String(' ', level * 3)); }; + rowText.Append(colData[colDataIndex].value); + if (rowText.Length < maxColumnSize[colDataIndex]) + { + rowText.Append(new String(' ', maxColumnSize[colDataIndex] - rowText.Length)); + } + reportText.Append(rowText.ToString()); + } + reportText.AppendLine(); + } + + static void printColumnData(StringBuilder reportText, Column[] columns, int[] maxColumnSize, int level) + { + for (int colDataIndex = 0; colDataIndex < columns.Length; colDataIndex++) + { + if (colDataIndex > 0) { reportText.Append(" "); } + StringBuilder rowText = new StringBuilder(); + if (colDataIndex == 0) { rowText.Append(new String(' ', level * 3)); }; + rowText.Append(columns[colDataIndex].ColTitle); + if (rowText.Length < maxColumnSize[colDataIndex]) + { + rowText.Append(new String(' ', maxColumnSize[colDataIndex] - rowText.Length)); + } + reportText.Append(rowText.ToString()); + } + reportText.AppendLine(); + } + + #endregion + + #region " Get Row Property Helper Methods - Header, ColData, Rows (children), Summary " + + static T getRowProperty(Row row, ItemsChoiceType1 itemsChoiceType) + { + int choiceElementIndex = getChoiceElementIndex(row, itemsChoiceType); + if (choiceElementIndex == -1) { return default(T); } else { return (T)row.AnyIntuitObjects[choiceElementIndex]; } + } + + static int getChoiceElementIndex(Row row, ItemsChoiceType1 itemsChoiceType) + { + if (row.ItemsElementName != null) + { + for (int itemsChoiceTypeIndex = 0; itemsChoiceTypeIndex < row.ItemsElementName.Count(); itemsChoiceTypeIndex++) + { + if (row.ItemsElementName[itemsChoiceTypeIndex] == itemsChoiceType) { return itemsChoiceTypeIndex; } + } + } + return -1; + } + + #endregion + + #endregion + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/SalesOrder.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/SalesOrder.cs new file mode 100644 index 0000000..416f70b --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/SalesOrder.cs @@ -0,0 +1,332 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class SalesOrderTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void SalesOrderAddTestUsingoAuth() + { + //Creating the SalesOrder for Add + SalesOrder salesOrder = QBOHelper.CreateSalesOrder(qboContextoAuth); + //Adding the SalesOrder + SalesOrder added = Helper.Add(qboContextoAuth, salesOrder); + //Verify the added SalesOrder + QBOHelper.VerifySalesOrder(salesOrder, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void SalesOrderFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + SalesOrderAddTestUsingoAuth(); + + //Retrieving the SalesOrder using FindAll + List salesOrders = Helper.FindAll(qboContextoAuth, new SalesOrder(), 1, 500); + Assert.IsNotNull(salesOrders); + Assert.IsTrue(salesOrders.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void SalesOrderFindbyIdTestUsingoAuth() + { + //Creating the SalesOrder for Adding + SalesOrder salesOrder = QBOHelper.CreateSalesOrder(qboContextoAuth); + //Adding the SalesOrder + SalesOrder added = Helper.Add(qboContextoAuth, salesOrder); + SalesOrder found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifySalesOrder(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void SalesOrderUpdateTestUsingoAuth() + { + //Creating the SalesOrder for Adding + SalesOrder salesOrder = QBOHelper.CreateSalesOrder(qboContextoAuth); + //Adding the SalesOrder + SalesOrder added = Helper.Add(qboContextoAuth, salesOrder); + //Change the data of added entity + SalesOrder changed = QBOHelper.UpdateSalesOrder(qboContextoAuth, added); + //Update the returned entity data + SalesOrder updated = Helper.Update(qboContextoAuth, changed);//Verify the updated SalesOrder + QBOHelper.VerifySalesOrder(changed, updated); + } + + [TestMethod] + public void SalesOrderSparseUpdateTestUsingoAuth() + { + //Creating the SalesOrder for Adding + SalesOrder salesOrder = QBOHelper.CreateSalesOrder(qboContextoAuth); + //Adding the SalesOrder + SalesOrder added = Helper.Add(qboContextoAuth, salesOrder); + //Change the data of added entity + SalesOrder changed = QBOHelper.UpdateSalesOrderSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + SalesOrder updated = Helper.Update(qboContextoAuth, changed);//Verify the updated SalesOrder + QBOHelper.VerifySalesOrderSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void SalesOrderDeleteTestUsingoAuth() + { + //Creating the SalesOrder for Adding + SalesOrder salesOrder = QBOHelper.CreateSalesOrder(qboContextoAuth); + //Adding the SalesOrder + SalesOrder added = Helper.Add(qboContextoAuth, salesOrder); + //Delete the returned entity + try + { + SalesOrder deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + public void SalesOrderVoidTestUsingoAuth() + { + //Creating the entity for Adding + SalesOrder entity = QBOHelper.CreateSalesOrder(qboContextoAuth); + //Adding the entity + SalesOrder added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + SalesOrder voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void SalesOrderCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + SalesOrderAddTestUsingoAuth(); + + //Retrieving the SalesOrder using CDC + List entities = Helper.CDC(qboContextoAuth, new SalesOrder(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void SalesOrderBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + SalesOrder existing = Helper.FindOrAdd(qboContextoAuth, new SalesOrder()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateSalesOrder(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateSalesOrder(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from SalesOrder"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as SalesOrder).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void SalesOrderQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + SalesOrder existing = Helper.FindOrAdd(qboContextoAuth, new SalesOrder()); + List entities = entityQuery.ExecuteIdsQuery("Select * from Customer where Id == "+existing.Id+"'").ToList(); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void SalesOrderAddAsyncTestsUsingoAuth() + { + //Creating the SalesOrder for Add + SalesOrder entity = QBOHelper.CreateSalesOrder(qboContextoAuth); + + SalesOrder added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifySalesOrder(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void SalesOrderRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + SalesOrderAddTestUsingoAuth(); + + //Retrieving the SalesOrder using FindAll + Helper.FindAllAsync(qboContextoAuth, new SalesOrder()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void SalesOrderFindByIdAsyncTestsUsingoAuth() + { + //Creating the SalesOrder for Adding + SalesOrder entity = QBOHelper.CreateSalesOrder(qboContextoAuth); + //Adding the SalesOrder + SalesOrder added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void SalesOrderUpdatedAsyncTestsUsingoAuth() + { + //Creating the SalesOrder for Adding + SalesOrder entity = QBOHelper.CreateSalesOrder(qboContextoAuth); + //Adding the SalesOrder + SalesOrder added = Helper.Add(qboContextoAuth, entity); + + //Update the SalesOrder + SalesOrder updated = QBOHelper.UpdateSalesOrder(qboContextoAuth, added); + //Call the service + SalesOrder updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated SalesOrder + QBOHelper.VerifySalesOrder(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void SalesOrderDeleteAsyncTestsUsingoAuth() + { + //Creating the SalesOrder for Adding + SalesOrder entity = QBOHelper.CreateSalesOrder(qboContextoAuth); + //Adding the SalesOrder + SalesOrder added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] + public void SalesOrderVoidAsyncTestsUsingoAuth() + { + //Creating the SalesOrder for Adding + SalesOrder entity = QBOHelper.CreateSalesOrder(qboContextoAuth); + //Adding the SalesOrder + SalesOrder added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/SalesReceipt.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/SalesReceipt.cs new file mode 100644 index 0000000..f38f9ee --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/SalesReceipt.cs @@ -0,0 +1,338 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; +using Intuit.Ipp.QueryFilter; + + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class SalesReceiptTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void SalesReceiptAddTestUsingoAuth() + { + //Creating the SalesReceipt for Add + SalesReceipt salesReceipt = QBOHelper.CreateSalesReceipt(qboContextoAuth); + //Adding the SalesReceipt + SalesReceipt added = Helper.Add(qboContextoAuth, salesReceipt); + //Verify the added SalesReceipt + QBOHelper.VerifySalesReceipt(salesReceipt, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void SalesReceiptFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + SalesReceiptAddTestUsingoAuth(); + + //Retrieving the SalesReceipt using FindAll + List salesReceipts = Helper.FindAll(qboContextoAuth, new SalesReceipt(), 1, 500); + Assert.IsNotNull(salesReceipts); + Assert.IsTrue(salesReceipts.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void SalesReceiptFindbyIdTestUsingoAuth() + { + //Creating the SalesReceipt for Adding + SalesReceipt salesReceipt = QBOHelper.CreateSalesReceipt(qboContextoAuth); + //Adding the SalesReceipt + SalesReceipt added = Helper.Add(qboContextoAuth, salesReceipt); + SalesReceipt found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifySalesReceipt(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void SalesReceiptUpdateTestUsingoAuth() + { + + //Creating the SalesReceipt for Adding + SalesReceipt salesReceipt = QBOHelper.CreateSalesReceipt(qboContextoAuth); + //Adding the SalesReceipt + SalesReceipt added = Helper.Add(qboContextoAuth, salesReceipt); + //Change the data of added entity + SalesReceipt changed = QBOHelper.UpdateSalesReceipt(qboContextoAuth, added); + //Update the returned entity data + SalesReceipt updated = Helper.Update(qboContextoAuth, changed);//Verify the updated SalesReceipt + QBOHelper.VerifySalesReceipt(changed, updated); + } + + [TestMethod] + public void SalesReceiptSparseUpdateTestUsingoAuth() + { + //Creating the SalesReceipt for Adding + SalesReceipt salesReceipt = QBOHelper.CreateSalesReceipt(qboContextoAuth); + //Adding the SalesReceipt + SalesReceipt added = Helper.Add(qboContextoAuth, salesReceipt); + //Change the data of added entity + SalesReceipt changed = QBOHelper.SparseUpdateSalesReceipt(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + SalesReceipt updated = Helper.Update(qboContextoAuth, changed);//Verify the updated SalesReceipt + QBOHelper.VerifySalesReceiptSparseUpdate(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void SalesReceiptDeleteTestUsingoAuth() + { + //Creating the SalesReceipt for Adding + SalesReceipt salesReceipt = QBOHelper.CreateSalesReceipt(qboContextoAuth); + //Adding the SalesReceipt + SalesReceipt added = Helper.Add(qboContextoAuth, salesReceipt); + //Delete the returned entity + try + { + SalesReceipt deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + [Ignore] + public void SalesReceiptVoidTestUsingoAuth() + { + //Creating the SalesReceipt for Adding + SalesReceipt salesReceipt = QBOHelper.CreateSalesReceipt(qboContextoAuth); + //Adding the SalesReceipt + SalesReceipt added = Helper.Add(qboContextoAuth, salesReceipt); + //Void the returned entity + try + { + SalesReceipt voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void SalesReceiptCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + SalesReceiptAddTestUsingoAuth(); + + //Retrieving the SalesReceipt using FindAll + List salesReceipts = Helper.CDC(qboContextoAuth, new SalesReceipt(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(salesReceipts); + Assert.IsTrue(salesReceipts.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void SalesReceiptBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + SalesReceipt existing = Helper.FindOrAdd(qboContextoAuth, new SalesReceipt()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateSalesReceipt(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateSalesReceipt(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from SalesReceipt"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as SalesReceipt).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void SalesReceiptQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + SalesReceipt existing = Helper.FindOrAdd(qboContextoAuth, new SalesReceipt()); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM SalesReceipt where Id='" + existing.Id + "'").ToList(); + + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void SalesReceiptAddAsyncTestsUsingoAuth() + { + //Creating the SalesReceipt for Add + SalesReceipt entity = QBOHelper.CreateSalesReceipt(qboContextoAuth); + + SalesReceipt added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifySalesReceipt(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void SalesReceiptRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + SalesReceiptAddTestUsingoAuth(); + + //Retrieving the SalesReceipt using FindAll + Helper.FindAllAsync(qboContextoAuth, new SalesReceipt()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void SalesReceiptFindByIdAsyncTestsUsingoAuth() + { + //Creating the SalesReceipt for Adding + SalesReceipt entity = QBOHelper.CreateSalesReceipt(qboContextoAuth); + //Adding the SalesReceipt + SalesReceipt added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void SalesReceiptUpdatedAsyncTestsUsingoAuth() + { + //Creating the SalesReceipt for Adding + SalesReceipt entity = QBOHelper.CreateSalesReceipt(qboContextoAuth); + //Adding the SalesReceipt + SalesReceipt added = Helper.Add(qboContextoAuth, entity); + + //Update the SalesReceipt + SalesReceipt updated = QBOHelper.UpdateSalesReceipt(qboContextoAuth, added); + //Call the service + SalesReceipt updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated SalesReceipt + QBOHelper.VerifySalesReceipt(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void SalesReceiptDeleteAsyncTestsUsingoAuth() + { + //Creating the SalesReceipt for Adding + SalesReceipt entity = QBOHelper.CreateSalesReceipt(qboContextoAuth); + //Adding the SalesReceipt + SalesReceipt added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] + [Ignore] + public void SalesReceiptVoidAsyncTestsUsingoAuth() + { + //Creating the SalesReceipt for Adding + SalesReceipt entity = QBOHelper.CreateSalesReceipt(qboContextoAuth); + //Adding the SalesReceipt + SalesReceipt added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/SalesRep.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/SalesRep.cs new file mode 100644 index 0000000..8244564 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/SalesRep.cs @@ -0,0 +1,334 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class SalesRepTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void SalesRepAddTestUsingoAuth() + { + //Creating the SalesRep for Add + SalesRep salesRep = QBOHelper.CreateSalesRep(qboContextoAuth); + //Adding the SalesRep + SalesRep added = Helper.Add(qboContextoAuth, salesRep); + //Verify the added SalesRep + QBOHelper.VerifySalesRep(salesRep, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void SalesRepFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + SalesRepAddTestUsingoAuth(); + + //Retrieving the SalesRep using FindAll + List salesReps = Helper.FindAll(qboContextoAuth, new SalesRep(), 1, 500); + Assert.IsNotNull(salesReps); + Assert.IsTrue(salesReps.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void SalesRepFindbyIdTestUsingoAuth() + { + //Creating the SalesRep for Adding + SalesRep salesRep = QBOHelper.CreateSalesRep(qboContextoAuth); + //Adding the SalesRep + SalesRep added = Helper.Add(qboContextoAuth, salesRep); + SalesRep found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifySalesRep(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void SalesRepUpdateTestUsingoAuth() + { + //Creating the SalesRep for Adding + SalesRep salesRep = QBOHelper.CreateSalesRep(qboContextoAuth); + //Adding the SalesRep + SalesRep added = Helper.Add(qboContextoAuth, salesRep); + //Change the data of added entity + SalesRep changed = QBOHelper.UpdateSalesRep(qboContextoAuth, added); + //Update the returned entity data + SalesRep updated = Helper.Update(qboContextoAuth, changed);//Verify the updated SalesRep + QBOHelper.VerifySalesRep(changed, updated); + } + + + [TestMethod] + public void SalesRepSparseUpdateTestUsingoAuth() + { + //Creating the SalesRep for Adding + SalesRep salesRep = QBOHelper.CreateSalesRep(qboContextoAuth); + //Adding the SalesRep + SalesRep added = Helper.Add(qboContextoAuth, salesRep); + //Change the data of added entity + SalesRep changed = QBOHelper.UpdateSalesRepSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + SalesRep updated = Helper.Update(qboContextoAuth, changed);//Verify the updated SalesRep + QBOHelper.VerifySalesRepSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void SalesRepDeleteTestUsingoAuth() + { + //Creating the SalesRep for Adding + SalesRep salesRep = QBOHelper.CreateSalesRep(qboContextoAuth); + //Adding the SalesRep + SalesRep added = Helper.Add(qboContextoAuth, salesRep); + //Delete the returned entity + try + { + SalesRep deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + public void SalesRepVoidTestUsingoAuth() + { + //Creating the entity for Adding + SalesRep entity = QBOHelper.CreateSalesRep(qboContextoAuth); + //Adding the entity + SalesRep added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + SalesRep voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void SalesRepCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + SalesRepAddTestUsingoAuth(); + + //Retrieving the SalesRep using CDC + List entities = Helper.CDC(qboContextoAuth, new SalesRep(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void SalesRepBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + SalesRep existing = Helper.FindOrAdd(qboContextoAuth, new SalesRep()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateSalesRep(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateSalesRep(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from SalesRep"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as SalesRep).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void SalesRepQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + SalesRep existing = Helper.FindOrAdd(qboContextoAuth, new SalesRep()); + List entities = entityQuery.ExecuteIdsQuery("Select * from Customer where Id == "+existing.Id+"'").ToList(); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void SalesRepAddAsyncTestsUsingoAuth() + { + //Creating the SalesRep for Add + SalesRep entity = QBOHelper.CreateSalesRep(qboContextoAuth); + + SalesRep added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifySalesRep(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void SalesRepRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + SalesRepAddTestUsingoAuth(); + + //Retrieving the SalesRep using FindAll + Helper.FindAllAsync(qboContextoAuth, new SalesRep()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void SalesRepFindByIdAsyncTestsUsingoAuth() + { + //Creating the SalesRep for Adding + SalesRep entity = QBOHelper.CreateSalesRep(qboContextoAuth); + //Adding the SalesRep + SalesRep added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void SalesRepUpdatedAsyncTestsUsingoAuth() + { + //Creating the SalesRep for Adding + SalesRep entity = QBOHelper.CreateSalesRep(qboContextoAuth); + //Adding the SalesRep + SalesRep added = Helper.Add(qboContextoAuth, entity); + + //Update the SalesRep + SalesRep updated = QBOHelper.UpdateSalesRep(qboContextoAuth, added); + //Call the service + SalesRep updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated SalesRep + QBOHelper.VerifySalesRep(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void SalesRepDeleteAsyncTestsUsingoAuth() + { + //Creating the SalesRep for Adding + SalesRep entity = QBOHelper.CreateSalesRep(qboContextoAuth); + //Adding the SalesRep + SalesRep added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] + public void SalesRepVoidAsyncTestsUsingoAuth() + { + //Creating the SalesRep for Adding + SalesRep entity = QBOHelper.CreateSalesRep(qboContextoAuth); + //Adding the SalesRep + SalesRep added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/SalesTransaction.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/SalesTransaction.cs new file mode 100644 index 0000000..cdca5c6 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/SalesTransaction.cs @@ -0,0 +1,156 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class SalesTransactionTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void SalesTransactionAddTestUsingoAuth() + { + //Creating the Bill for Add + SalesTransaction salesTransaction = QBOHelper.CreateSalesTransaction(qboContextoAuth); + //Adding the SalesTransaction + SalesTransaction added = Helper.Add(qboContextoAuth, salesTransaction); + //Verify the added SalesTransaction + QBOHelper.VerifySalesTransaction(salesTransaction, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void SalesTransactionFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + SalesTransactionAddTestUsingoAuth(); + + //Retrieving the Bill using FindAll + List salesTransactions = Helper.FindAll(qboContextoAuth, new SalesTransaction(), 1, 500); + Assert.IsNotNull(salesTransactions); + Assert.IsTrue(salesTransactions.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void SalesTransactionFindbyIdTestUsingoAuth() + { + //Creating the SalesTransaction for Adding + SalesTransaction salesTransaction = QBOHelper.CreateSalesTransaction(qboContextoAuth); + //Adding the SalesTransaction + SalesTransaction added = Helper.Add(qboContextoAuth, salesTransaction); + SalesTransaction found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifySalesTransaction(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void SalesTransactionUpdateTestUsingoAuth() + { + //Creating the SalesTransaction for Adding + SalesTransaction salesTransaction = QBOHelper.CreateSalesTransaction(qboContextoAuth); + //Adding the SalesTransaction + SalesTransaction added = Helper.Add(qboContextoAuth, salesTransaction); + //Change the data of added entity + SalesTransaction changed = QBOHelper.UpdateSalesTransaction(qboContextoAuth, added); + //Update the returned entity data + SalesTransaction updated = Helper.Update(qboContextoAuth, changed);//Verify the updated SalesTransaction + QBOHelper.VerifySalesTransaction(changed, updated); + } + + [TestMethod] + public void SalesTransactionSparseUpdateTestUsingoAuth() + { + //Creating the SalesTransaction for Adding + SalesTransaction salesTransaction = QBOHelper.CreateSalesTransaction(qboContextoAuth); + //Adding the SalesTransaction + SalesTransaction added = Helper.Add(qboContextoAuth, salesTransaction); + //Change the data of added entity + SalesTransaction changed = QBOHelper.UpdateSalesTransactionSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + SalesTransaction updated = Helper.Update(qboContextoAuth, changed);//Verify the updated SalesTransaction + QBOHelper.VerifySalesTransactionSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void SalesTransactionDeleteTestUsingoAuth() + { + //Creating the SalesTransaction for Adding + SalesTransaction salesTransaction = QBOHelper.CreateSalesTransaction(qboContextoAuth); + //Adding the SalesTransaction + SalesTransaction added = Helper.Add(qboContextoAuth, salesTransaction); + //Delete the returned entity + try + { + SalesTransaction deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + public void SalesTransactionVoidTestUsingoAuth() + { + //Creating the entity for Adding + SalesTransaction entity = QBOHelper.CreateSalesTransaction(qboContextoAuth); + //Adding the entity + SalesTransaction added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + SalesTransaction voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/ShipMethod.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/ShipMethod.cs new file mode 100644 index 0000000..fec1a4e --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/ShipMethod.cs @@ -0,0 +1,333 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class ShipMethodTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void ShipMethodAddTestUsingoAuth() + { + //Creating the ShipMethod for Add + ShipMethod shipMethod = QBOHelper.CreateShipMethod(qboContextoAuth); + //Adding the ShipMethod + ShipMethod added = Helper.Add(qboContextoAuth, shipMethod); + //Verify the added ShipMethod + QBOHelper.VerifyShipMethod(shipMethod, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void ShipMethodFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + ShipMethodAddTestUsingoAuth(); + + //Retrieving the ShipMethod using FindAll + List shipMethods = Helper.FindAll(qboContextoAuth, new ShipMethod(), 1, 500); + Assert.IsNotNull(shipMethods); + Assert.IsTrue(shipMethods.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void ShipMethodFindbyIdTestUsingoAuth() + { + //Creating the ShipMethod for Adding + ShipMethod shipMethod = QBOHelper.CreateShipMethod(qboContextoAuth); + //Adding the ShipMethod + ShipMethod added = Helper.Add(qboContextoAuth, shipMethod); + ShipMethod found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyShipMethod(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void ShipMethodUpdateTestUsingoAuth() + { + //Creating the ShipMethod for Adding + ShipMethod shipMethod = QBOHelper.CreateShipMethod(qboContextoAuth); + //Adding the ShipMethod + ShipMethod added = Helper.Add(qboContextoAuth, shipMethod); + //Change the data of added entity + ShipMethod changed = QBOHelper.UpdateShipMethod(qboContextoAuth, added); + //Update the returned entity data + ShipMethod updated = Helper.Update(qboContextoAuth, changed);//Verify the updated ShipMethod + QBOHelper.VerifyShipMethod(changed, updated); + } + + [TestMethod] + public void ShipMethodSparseUpdateTestUsingoAuth() + { + //Creating the ShipMethod for Adding + ShipMethod shipMethod = QBOHelper.CreateShipMethod(qboContextoAuth); + //Adding the ShipMethod + ShipMethod added = Helper.Add(qboContextoAuth, shipMethod); + //Change the data of added entity + ShipMethod changed = QBOHelper.UpdateShipMethodSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + ShipMethod updated = Helper.Update(qboContextoAuth, changed);//Verify the updated ShipMethod + QBOHelper.VerifyShipMethodSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void ShipMethodDeleteTestUsingoAuth() + { + //Creating the ShipMethod for Adding + ShipMethod shipMethod = QBOHelper.CreateShipMethod(qboContextoAuth); + //Adding the ShipMethod + ShipMethod added = Helper.Add(qboContextoAuth, shipMethod); + //Delete the returned entity + try + { + ShipMethod deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + public void ShipMethodVoidTestUsingoAuth() + { + //Creating the entity for Adding + ShipMethod entity = QBOHelper.CreateShipMethod(qboContextoAuth); + //Adding the entity + ShipMethod added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + ShipMethod voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void ShipMethodCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + ShipMethodAddTestUsingoAuth(); + + //Retrieving the ShipMethod using CDC + List entities = Helper.CDC(qboContextoAuth, new ShipMethod(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void ShipMethodBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + ShipMethod existing = Helper.FindOrAdd(qboContextoAuth, new ShipMethod()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateShipMethod(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateShipMethod(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from ShipMethod"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as ShipMethod).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void ShipMethodQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + ShipMethod existing = Helper.FindOrAdd(qboContextoAuth, new ShipMethod()); + List entities = entityQuery.ExecuteIdsQuery("Select * from Customer where Id='"+existing.Id+"'").ToList(); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void ShipMethodAddAsyncTestsUsingoAuth() + { + //Creating the ShipMethod for Add + ShipMethod entity = QBOHelper.CreateShipMethod(qboContextoAuth); + + ShipMethod added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyShipMethod(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void ShipMethodRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + ShipMethodAddTestUsingoAuth(); + + //Retrieving the ShipMethod using FindAll + Helper.FindAllAsync(qboContextoAuth, new ShipMethod()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void ShipMethodFindByIdAsyncTestsUsingoAuth() + { + //Creating the ShipMethod for Adding + ShipMethod entity = QBOHelper.CreateShipMethod(qboContextoAuth); + //Adding the ShipMethod + ShipMethod added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void ShipMethodUpdatedAsyncTestsUsingoAuth() + { + //Creating the ShipMethod for Adding + ShipMethod entity = QBOHelper.CreateShipMethod(qboContextoAuth); + //Adding the ShipMethod + ShipMethod added = Helper.Add(qboContextoAuth, entity); + + //Update the ShipMethod + ShipMethod updated = QBOHelper.UpdateShipMethod(qboContextoAuth, added); + //Call the service + ShipMethod updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated ShipMethod + QBOHelper.VerifyShipMethod(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void ShipMethodDeleteAsyncTestsUsingoAuth() + { + //Creating the ShipMethod for Adding + ShipMethod entity = QBOHelper.CreateShipMethod(qboContextoAuth); + //Adding the ShipMethod + ShipMethod added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] + public void ShipMethodVoidAsyncTestsUsingoAuth() + { + //Creating the ShipMethod for Adding + ShipMethod entity = QBOHelper.CreateShipMethod(qboContextoAuth); + //Adding the ShipMethod + ShipMethod added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/StatementCharge.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/StatementCharge.cs new file mode 100644 index 0000000..c8dfef0 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/StatementCharge.cs @@ -0,0 +1,333 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class StatementChargeTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void StatementChargeAddTestUsingoAuth() + { + //Creating the StatementCharge for Add + StatementCharge statementCharge = QBOHelper.CreateStatementCharge(qboContextoAuth); + //Adding the StatementCharge + StatementCharge added = Helper.Add(qboContextoAuth, statementCharge); + //Verify the added StatementCharge + QBOHelper.VerifyStatementCharge(statementCharge, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void StatementChargeFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + StatementChargeAddTestUsingoAuth(); + + //Retrieving the StatementCharge using FindAll + List statementCharges = Helper.FindAll(qboContextoAuth, new StatementCharge(), 1, 500); + Assert.IsNotNull(statementCharges); + Assert.IsTrue(statementCharges.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void StatementChargeFindbyIdTestUsingoAuth() + { + //Creating the StatementCharge for Adding + StatementCharge statementCharge = QBOHelper.CreateStatementCharge(qboContextoAuth); + //Adding the StatementCharge + StatementCharge added = Helper.Add(qboContextoAuth, statementCharge); + StatementCharge found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyStatementCharge(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void StatementChargeUpdateTestUsingoAuth() + { + //Creating the StatementCharge for Adding + StatementCharge statementCharge = QBOHelper.CreateStatementCharge(qboContextoAuth); + //Adding the StatementCharge + StatementCharge added = Helper.Add(qboContextoAuth, statementCharge); + //Change the data of added entity + StatementCharge changed = QBOHelper.UpdateStatementCharge(qboContextoAuth, added); + //Update the returned entity data + StatementCharge updated = Helper.Update(qboContextoAuth, changed);//Verify the updated StatementCharge + QBOHelper.VerifyStatementCharge(changed, updated); + } + + [TestMethod] + public void StatementChargeSparseUpdateTestUsingoAuth() + { + //Creating the StatementCharge for Adding + StatementCharge statementCharge = QBOHelper.CreateStatementCharge(qboContextoAuth); + //Adding the StatementCharge + StatementCharge added = Helper.Add(qboContextoAuth, statementCharge); + //Change the data of added entity + StatementCharge changed = QBOHelper.UpdateStatementChargeSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + StatementCharge updated = Helper.Update(qboContextoAuth, changed);//Verify the updated StatementCharge + QBOHelper.VerifyStatementChargeSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void StatementChargeDeleteTestUsingoAuth() + { + //Creating the StatementCharge for Adding + StatementCharge statementCharge = QBOHelper.CreateStatementCharge(qboContextoAuth); + //Adding the StatementCharge + StatementCharge added = Helper.Add(qboContextoAuth, statementCharge); + //Delete the returned entity + try + { + StatementCharge deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + public void StatementChargeVoidTestUsingoAuth() + { + //Creating the entity for Adding + StatementCharge entity = QBOHelper.CreateStatementCharge(qboContextoAuth); + //Adding the entity + StatementCharge added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + StatementCharge voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void StatementChargeCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + StatementChargeAddTestUsingoAuth(); + + //Retrieving the StatementCharge using CDC + List entities = Helper.CDC(qboContextoAuth, new StatementCharge(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void StatementChargeBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + StatementCharge existing = Helper.FindOrAdd(qboContextoAuth, new StatementCharge()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateStatementCharge(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateStatementCharge(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from StatementCharge"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as StatementCharge).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void StatementChargeQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + StatementCharge existing = Helper.FindOrAdd(qboContextoAuth, new StatementCharge()); + List entities = entityQuery.ExecuteIdsQuery("Select * from StatementCharge where Id =='"+ existing.Id+"'").ToList(); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void StatementChargeAddAsyncTestsUsingoAuth() + { + //Creating the StatementCharge for Add + StatementCharge entity = QBOHelper.CreateStatementCharge(qboContextoAuth); + + StatementCharge added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyStatementCharge(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void StatementChargeRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + StatementChargeAddTestUsingoAuth(); + + //Retrieving the StatementCharge using FindAll + Helper.FindAllAsync(qboContextoAuth, new StatementCharge()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void StatementChargeFindByIdAsyncTestsUsingoAuth() + { + //Creating the StatementCharge for Adding + StatementCharge entity = QBOHelper.CreateStatementCharge(qboContextoAuth); + //Adding the StatementCharge + StatementCharge added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void StatementChargeUpdatedAsyncTestsUsingoAuth() + { + //Creating the StatementCharge for Adding + StatementCharge entity = QBOHelper.CreateStatementCharge(qboContextoAuth); + //Adding the StatementCharge + StatementCharge added = Helper.Add(qboContextoAuth, entity); + + //Update the StatementCharge + StatementCharge updated = QBOHelper.UpdateStatementCharge(qboContextoAuth, added); + //Call the service + StatementCharge updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated StatementCharge + QBOHelper.VerifyStatementCharge(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void StatementChargeDeleteAsyncTestsUsingoAuth() + { + //Creating the StatementCharge for Adding + StatementCharge entity = QBOHelper.CreateStatementCharge(qboContextoAuth); + //Adding the StatementCharge + StatementCharge added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] + public void StatementChargeVoidAsyncTestsUsingoAuth() + { + //Creating the StatementCharge for Adding + StatementCharge entity = QBOHelper.CreateStatementCharge(qboContextoAuth); + //Adding the StatementCharge + StatementCharge added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Status.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Status.cs new file mode 100644 index 0000000..96dffda --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Status.cs @@ -0,0 +1,333 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class StatusTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void StatusAddTestUsingoAuth() + { + //Creating the Status for Add + Status status = QBOHelper.CreateStatus(qboContextoAuth); + //Adding the Status + Status added = Helper.Add(qboContextoAuth, status); + //Verify the added Status + QBOHelper.VerifyStatus(status, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void StatusFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + StatusAddTestUsingoAuth(); + + //Retrieving the Status using FindAll + List statuss = Helper.FindAll(qboContextoAuth, new Status(), 1, 500); + Assert.IsNotNull(statuss); + Assert.IsTrue(statuss.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void StatusFindbyIdTestUsingoAuth() + { + //Creating the Status for Adding + Status status = QBOHelper.CreateStatus(qboContextoAuth); + //Adding the Status + Status added = Helper.Add(qboContextoAuth, status); + Status found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyStatus(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void StatusUpdateTestUsingoAuth() + { + //Creating the Status for Adding + Status status = QBOHelper.CreateStatus(qboContextoAuth); + //Adding the Status + Status added = Helper.Add(qboContextoAuth, status); + //Change the data of added entity + Status changed = QBOHelper.UpdateStatus(qboContextoAuth, added); + //Update the returned entity data + Status updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Status + QBOHelper.VerifyStatus(changed, updated); + } + + [TestMethod] + public void StatusSparseUpdateTestUsingoAuth() + { + //Creating the Status for Adding + Status status = QBOHelper.CreateStatus(qboContextoAuth); + //Adding the Status + Status added = Helper.Add(qboContextoAuth, status); + //Change the data of added entity + Status changed = QBOHelper.UpdateStatusSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + Status updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Status + QBOHelper.VerifyStatusSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void StatusDeleteTestUsingoAuth() + { + //Creating the Status for Adding + Status status = QBOHelper.CreateStatus(qboContextoAuth); + //Adding the Status + Status added = Helper.Add(qboContextoAuth, status); + //Delete the returned entity + try + { + Status deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + public void StatusVoidTestUsingoAuth() + { + //Creating the entity for Adding + Status entity = QBOHelper.CreateStatus(qboContextoAuth); + //Adding the entity + Status added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + Status voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void StatusCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + StatusAddTestUsingoAuth(); + + //Retrieving the Status using CDC + List entities = Helper.CDC(qboContextoAuth, new Status(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void StatusBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + Status existing = Helper.FindOrAdd(qboContextoAuth, new Status()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateStatus(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateStatus(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from Status"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as Status).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void StatusQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + Status existing = Helper.FindOrAdd(qboContextoAuth, new Status()); + List entities = entityQuery.ExecuteIdsQuery("Select * from Customer where Id == '"+existing.Id+"'").ToList(); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void StatusAddAsyncTestsUsingoAuth() + { + //Creating the Status for Add + Status entity = QBOHelper.CreateStatus(qboContextoAuth); + + Status added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyStatus(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void StatusRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + StatusAddTestUsingoAuth(); + + //Retrieving the Status using FindAll + Helper.FindAllAsync(qboContextoAuth, new Status()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void StatusFindByIdAsyncTestsUsingoAuth() + { + //Creating the Status for Adding + Status entity = QBOHelper.CreateStatus(qboContextoAuth); + //Adding the Status + Status added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void StatusUpdatedAsyncTestsUsingoAuth() + { + //Creating the Status for Adding + Status entity = QBOHelper.CreateStatus(qboContextoAuth); + //Adding the Status + Status added = Helper.Add(qboContextoAuth, entity); + + //Update the Status + Status updated = QBOHelper.UpdateStatus(qboContextoAuth, added); + //Call the service + Status updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated Status + QBOHelper.VerifyStatus(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void StatusDeleteAsyncTestsUsingoAuth() + { + //Creating the Status for Adding + Status entity = QBOHelper.CreateStatus(qboContextoAuth); + //Adding the Status + Status added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] + public void StatusVoidAsyncTestsUsingoAuth() + { + //Creating the Status for Adding + Status entity = QBOHelper.CreateStatus(qboContextoAuth); + //Adding the Status + Status added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/StringTypeCustomFieldDefinition.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/StringTypeCustomFieldDefinition.cs new file mode 100644 index 0000000..a565d38 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/StringTypeCustomFieldDefinition.cs @@ -0,0 +1,115 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class StringTypeCustomFieldDefinitionTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void StringTypeCustomFieldDefinitionAddTestUsingoAuth() + { + //Creating the Bill for Add + StringTypeCustomFieldDefinition stringTypeCustomFieldDefinition = QBOHelper.CreateStringTypeCustomFieldDefinition(qboContextoAuth); + //Adding the StringTypeCustomFieldDefinition + StringTypeCustomFieldDefinition added = Helper.Add(qboContextoAuth, stringTypeCustomFieldDefinition); + //Verify the added StringTypeCustomFieldDefinition + QBOHelper.VerifyStringTypeCustomFieldDefinition(stringTypeCustomFieldDefinition, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void StringTypeCustomFieldDefinitionFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + StringTypeCustomFieldDefinitionAddTestUsingoAuth(); + + //Retrieving the Bill using FindAll + List stringTypeCustomFieldDefinitions = Helper.FindAll(qboContextoAuth, new StringTypeCustomFieldDefinition(), 1, 500); + Assert.IsNotNull(stringTypeCustomFieldDefinitions); + Assert.IsTrue(stringTypeCustomFieldDefinitions.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void StringTypeCustomFieldDefinitionFindbyIdTestUsingoAuth() + { + //Creating the StringTypeCustomFieldDefinition for Adding + StringTypeCustomFieldDefinition stringTypeCustomFieldDefinition = QBOHelper.CreateStringTypeCustomFieldDefinition(qboContextoAuth); + //Adding the StringTypeCustomFieldDefinition + StringTypeCustomFieldDefinition added = Helper.Add(qboContextoAuth, stringTypeCustomFieldDefinition); + StringTypeCustomFieldDefinition found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyStringTypeCustomFieldDefinition(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void StringTypeCustomFieldDefinitionUpdateTestUsingoAuth() + { + //Creating the StringTypeCustomFieldDefinition for Adding + StringTypeCustomFieldDefinition stringTypeCustomFieldDefinition = QBOHelper.CreateStringTypeCustomFieldDefinition(qboContextoAuth); + //Adding the StringTypeCustomFieldDefinition + StringTypeCustomFieldDefinition added = Helper.Add(qboContextoAuth, stringTypeCustomFieldDefinition); + //Change the data of added entity + QBOHelper.UpdateStringTypeCustomFieldDefinition(qboContextoAuth, added); + //Update the returned entity data + StringTypeCustomFieldDefinition updated = Helper.Update(qboContextoAuth, added);//Verify the updated StringTypeCustomFieldDefinition + QBOHelper.VerifyStringTypeCustomFieldDefinition(added, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void StringTypeCustomFieldDefinitionDeleteTestUsingoAuth() + { + //Creating the StringTypeCustomFieldDefinition for Adding + StringTypeCustomFieldDefinition stringTypeCustomFieldDefinition = QBOHelper.CreateStringTypeCustomFieldDefinition(qboContextoAuth); + //Adding the StringTypeCustomFieldDefinition + StringTypeCustomFieldDefinition added = Helper.Add(qboContextoAuth, stringTypeCustomFieldDefinition); + //Delete the returned entity + Helper.Delete(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/SyncActivity.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/SyncActivity.cs new file mode 100644 index 0000000..2b45f7b --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/SyncActivity.cs @@ -0,0 +1,333 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class SyncActivityTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void SyncActivityAddTestUsingoAuth() + { + //Creating the SyncActivity for Add + SyncActivity syncActivity = QBOHelper.CreateSyncActivity(qboContextoAuth); + //Adding the SyncActivity + SyncActivity added = Helper.Add(qboContextoAuth, syncActivity); + //Verify the added SyncActivity + QBOHelper.VerifySyncActivity(syncActivity, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void SyncActivityFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + SyncActivityAddTestUsingoAuth(); + + //Retrieving the SyncActivity using FindAll + List syncActivitys = Helper.FindAll(qboContextoAuth, new SyncActivity(), 1, 500); + Assert.IsNotNull(syncActivitys); + Assert.IsTrue(syncActivitys.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void SyncActivityFindbyIdTestUsingoAuth() + { + //Creating the SyncActivity for Adding + SyncActivity syncActivity = QBOHelper.CreateSyncActivity(qboContextoAuth); + //Adding the SyncActivity + SyncActivity added = Helper.Add(qboContextoAuth, syncActivity); + SyncActivity found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifySyncActivity(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void SyncActivityUpdateTestUsingoAuth() + { + //Creating the SyncActivity for Adding + SyncActivity syncActivity = QBOHelper.CreateSyncActivity(qboContextoAuth); + //Adding the SyncActivity + SyncActivity added = Helper.Add(qboContextoAuth, syncActivity); + //Change the data of added entity + SyncActivity changed = QBOHelper.UpdateSyncActivity(qboContextoAuth, added); + //Update the returned entity data + SyncActivity updated = Helper.Update(qboContextoAuth, changed);//Verify the updated SyncActivity + QBOHelper.VerifySyncActivity(changed, updated); + } + + [TestMethod] + public void SyncActivitySparseUpdateTestUsingoAuth() + { + //Creating the SyncActivity for Adding + SyncActivity syncActivity = QBOHelper.CreateSyncActivity(qboContextoAuth); + //Adding the SyncActivity + SyncActivity added = Helper.Add(qboContextoAuth, syncActivity); + //Change the data of added entity + SyncActivity changed = QBOHelper.UpdateSyncActivitySparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + SyncActivity updated = Helper.Update(qboContextoAuth, changed);//Verify the updated SyncActivity + QBOHelper.VerifySyncActivitySparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void SyncActivityDeleteTestUsingoAuth() + { + //Creating the SyncActivity for Adding + SyncActivity syncActivity = QBOHelper.CreateSyncActivity(qboContextoAuth); + //Adding the SyncActivity + SyncActivity added = Helper.Add(qboContextoAuth, syncActivity); + //Delete the returned entity + try + { + SyncActivity deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + public void SyncActivityVoidTestUsingoAuth() + { + //Creating the entity for Adding + SyncActivity entity = QBOHelper.CreateSyncActivity(qboContextoAuth); + //Adding the entity + SyncActivity added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + SyncActivity voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void SyncActivityCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + SyncActivityAddTestUsingoAuth(); + + //Retrieving the SyncActivity using CDC + List entities = Helper.CDC(qboContextoAuth, new SyncActivity(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void SyncActivityBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + SyncActivity existing = Helper.FindOrAdd(qboContextoAuth, new SyncActivity()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateSyncActivity(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateSyncActivity(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from SyncActivity"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as SyncActivity).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void SyncActivityQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + SyncActivity existing = Helper.FindOrAdd(qboContextoAuth, new SyncActivity()); + List entities = entityQuery.ExecuteIdsQuery("Select * from Customer where Id='"+ existing.Id+"'").ToList(); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void SyncActivityAddAsyncTestsUsingoAuth() + { + //Creating the SyncActivity for Add + SyncActivity entity = QBOHelper.CreateSyncActivity(qboContextoAuth); + + SyncActivity added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifySyncActivity(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void SyncActivityRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + SyncActivityAddTestUsingoAuth(); + + //Retrieving the SyncActivity using FindAll + Helper.FindAllAsync(qboContextoAuth, new SyncActivity()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void SyncActivityFindByIdAsyncTestsUsingoAuth() + { + //Creating the SyncActivity for Adding + SyncActivity entity = QBOHelper.CreateSyncActivity(qboContextoAuth); + //Adding the SyncActivity + SyncActivity added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void SyncActivityUpdatedAsyncTestsUsingoAuth() + { + //Creating the SyncActivity for Adding + SyncActivity entity = QBOHelper.CreateSyncActivity(qboContextoAuth); + //Adding the SyncActivity + SyncActivity added = Helper.Add(qboContextoAuth, entity); + + //Update the SyncActivity + SyncActivity updated = QBOHelper.UpdateSyncActivity(qboContextoAuth, added); + //Call the service + SyncActivity updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated SyncActivity + QBOHelper.VerifySyncActivity(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void SyncActivityDeleteAsyncTestsUsingoAuth() + { + //Creating the SyncActivity for Adding + SyncActivity entity = QBOHelper.CreateSyncActivity(qboContextoAuth); + //Adding the SyncActivity + SyncActivity added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] + public void SyncActivityVoidAsyncTestsUsingoAuth() + { + //Creating the SyncActivity for Adding + SyncActivity entity = QBOHelper.CreateSyncActivity(qboContextoAuth); + //Adding the SyncActivity + SyncActivity added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Task.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Task.cs new file mode 100644 index 0000000..bb6fc1f --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Task.cs @@ -0,0 +1,333 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class TaskTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void TaskAddTestUsingoAuth() + { + //Creating the Task for Add + Task task = QBOHelper.CreateTask(qboContextoAuth); + //Adding the Task + Task added = Helper.Add(qboContextoAuth, task); + //Verify the added Task + QBOHelper.VerifyTask(task, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void TaskFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + TaskAddTestUsingoAuth(); + + //Retrieving the Task using FindAll + List tasks = Helper.FindAll(qboContextoAuth, new Task(), 1, 500); + Assert.IsNotNull(tasks); + Assert.IsTrue(tasks.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void TaskFindbyIdTestUsingoAuth() + { + //Creating the Task for Adding + Task task = QBOHelper.CreateTask(qboContextoAuth); + //Adding the Task + Task added = Helper.Add(qboContextoAuth, task); + Task found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyTask(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void TaskUpdateTestUsingoAuth() + { + //Creating the Task for Adding + Task task = QBOHelper.CreateTask(qboContextoAuth); + //Adding the Task + Task added = Helper.Add(qboContextoAuth, task); + //Change the data of added entity + Task changed = QBOHelper.UpdateTask(qboContextoAuth, added); + //Update the returned entity data + Task updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Task + QBOHelper.VerifyTask(changed, updated); + } + + [TestMethod] + public void TaskSparseUpdateTestUsingoAuth() + { + //Creating the Task for Adding + Task task = QBOHelper.CreateTask(qboContextoAuth); + //Adding the Task + Task added = Helper.Add(qboContextoAuth, task); + //Change the data of added entity + Task changed = QBOHelper.UpdateTaskSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + Task updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Task + QBOHelper.VerifyTaskSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void TaskDeleteTestUsingoAuth() + { + //Creating the Task for Adding + Task task = QBOHelper.CreateTask(qboContextoAuth); + //Adding the Task + Task added = Helper.Add(qboContextoAuth, task); + //Delete the returned entity + try + { + Task deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + public void TaskVoidTestUsingoAuth() + { + //Creating the entity for Adding + Task entity = QBOHelper.CreateTask(qboContextoAuth); + //Adding the entity + Task added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + Task voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void TaskCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + TaskAddTestUsingoAuth(); + + //Retrieving the Task using CDC + List entities = Helper.CDC(qboContextoAuth, new Task(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void TaskBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + Task existing = Helper.FindOrAdd(qboContextoAuth, new Task()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateTask(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateTask(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from Task"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as Task).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void TaskQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + Task existing = Helper.FindOrAdd(qboContextoAuth, new Task()); + List entities = entityQuery.ExecuteIdsQuery("Select * from Customer where Id =='"+ existing.Id+"'").ToList(); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void TaskAddAsyncTestsUsingoAuth() + { + //Creating the Task for Add + Task entity = QBOHelper.CreateTask(qboContextoAuth); + + Task added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyTask(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void TaskRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + TaskAddTestUsingoAuth(); + + //Retrieving the Task using FindAll + Helper.FindAllAsync(qboContextoAuth, new Task()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void TaskFindByIdAsyncTestsUsingoAuth() + { + //Creating the Task for Adding + Task entity = QBOHelper.CreateTask(qboContextoAuth); + //Adding the Task + Task added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void TaskUpdatedAsyncTestsUsingoAuth() + { + //Creating the Task for Adding + Task entity = QBOHelper.CreateTask(qboContextoAuth); + //Adding the Task + Task added = Helper.Add(qboContextoAuth, entity); + + //Update the Task + Task updated = QBOHelper.UpdateTask(qboContextoAuth, added); + //Call the service + Task updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated Task + QBOHelper.VerifyTask(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void TaskDeleteAsyncTestsUsingoAuth() + { + //Creating the Task for Adding + Task entity = QBOHelper.CreateTask(qboContextoAuth); + //Adding the Task + Task added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] + public void TaskVoidAsyncTestsUsingoAuth() + { + //Creating the Task for Adding + Task entity = QBOHelper.CreateTask(qboContextoAuth); + //Adding the Task + Task added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/TaxAgency.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/TaxAgency.cs new file mode 100644 index 0000000..c738b70 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/TaxAgency.cs @@ -0,0 +1,159 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class TaxAgencyTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void TaxAgencyAddTestUsingoAuth() + { + //Creating the Bill for Add + TaxAgency taxAgency = QBOHelper.CreateTaxAgency(qboContextoAuth); + //Adding the TaxAgency + TaxAgency added = Helper.Add(qboContextoAuth, taxAgency); + //Verify the added TaxAgency + QBOHelper.VerifyTaxAgency(taxAgency, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void TaxAgencyFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + TaxAgencyAddTestUsingoAuth(); + + //Retrieving the Bill using FindAll + List taxAgencys = Helper.FindAll(qboContextoAuth, new TaxAgency(), 1, 500); + Assert.IsNotNull(taxAgencys); + Assert.IsTrue(taxAgencys.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void TaxAgencyFindbyIdTestUsingoAuth() + { + //Creating the TaxAgency for Adding + TaxAgency taxAgency = QBOHelper.CreateTaxAgency(qboContextoAuth); + //Adding the TaxAgency + TaxAgency added = Helper.Add(qboContextoAuth, taxAgency); + TaxAgency found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyTaxAgency(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod][Ignore] + public void TaxAgencyUpdateTestUsingoAuth() + { + //Creating the TaxAgency for Adding + TaxAgency taxAgency = QBOHelper.CreateTaxAgency(qboContextoAuth); + //Adding the TaxAgency + TaxAgency added = Helper.Add(qboContextoAuth, taxAgency); + //Change the data of added entity + TaxAgency changed = QBOHelper.UpdateTaxAgency(qboContextoAuth, added); + //Update the returned entity data + TaxAgency updated = Helper.Update(qboContextoAuth, changed);//Verify the updated TaxAgency + QBOHelper.VerifyTaxAgency(changed, updated); + } + + [TestMethod] + [Ignore] + public void TaxAgencySparseUpdateTestUsingoAuth() + { + //Creating the TaxAgency for Adding + TaxAgency taxAgency = QBOHelper.CreateTaxAgency(qboContextoAuth); + //Adding the TaxAgency + TaxAgency added = Helper.Add(qboContextoAuth, taxAgency); + //Change the data of added entity + TaxAgency changed = QBOHelper.UpdateTaxAgencySparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + TaxAgency updated = Helper.Update(qboContextoAuth, changed);//Verify the updated TaxAgency + QBOHelper.VerifyTaxAgencySparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + [Ignore] + public void TaxAgencyDeleteTestUsingoAuth() + { + //Creating the TaxAgency for Adding + TaxAgency taxAgency = QBOHelper.CreateTaxAgency(qboContextoAuth); + //Adding the TaxAgency + TaxAgency added = Helper.Add(qboContextoAuth, taxAgency); + //Delete the returned entity + try + { + TaxAgency deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + [Ignore] + public void TaxAgencyVoidTestUsingoAuth() + { + //Creating the entity for Adding + TaxAgency entity = QBOHelper.CreateTaxAgency(qboContextoAuth); + //Adding the entity + TaxAgency added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + TaxAgency voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/TaxClassification.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/TaxClassification.cs new file mode 100644 index 0000000..6f64c65 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/TaxClassification.cs @@ -0,0 +1,118 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; +using Intuit.Ipp.QueryFilter; + + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class TaxClassification + { + ServiceContext qboContextoAuth = null; + + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + #region Sync methods + [TestMethod] + public void TaxClassificationFindAllTestUsingOAuth() + { + try + { + List taxClassifications = Helper.FindAll(qboContextoAuth, new Intuit.Ipp.Data.TaxClassification()); + Assert.IsNotNull(taxClassifications); + Assert.IsTrue(taxClassifications.Count() > 0); + } + catch (System.Exception ex) + { + Assert.Fail(ex.ToString()); + } + } + + [TestMethod()] + public void TaxClassificationFindByLevelTestUsingOAuth() + { + List taxClassList = Helper.FindAll(qboContextoAuth, new Intuit.Ipp.Data.TaxClassification()); + try + { + Intuit.Ipp.Data.TaxClassification taxClassification = new Intuit.Ipp.Data.TaxClassification + { + Level = taxClassList[0].Level + }; + List< Intuit.Ipp.Data.TaxClassification> taxClassifications = Helper.FindByLevel(qboContextoAuth, taxClassification); + Assert.IsNotNull(taxClassifications); + Assert.IsTrue(taxClassifications.Count() > 0); + } + catch (System.Exception ex) + { + Assert.Fail(ex.ToString()); + } + } + + [TestMethod()] + public void TaxClassificationFindByParentIdTestUsingOAuth() + { + List taxClassList = Helper.FindAll(qboContextoAuth, new Intuit.Ipp.Data.TaxClassification()); + try + { + Intuit.Ipp.Data.TaxClassification taxClassification = new Intuit.Ipp.Data.TaxClassification + { + ParentRef = taxClassList[0].ParentRef + }; + List taxClassifications = Helper.FindByParentId(qboContextoAuth, taxClassification); + Assert.IsNotNull(taxClassifications); + Assert.IsTrue(taxClassifications.Count() > 0); + } + catch (System.Exception ex) + { + Assert.Fail(ex.ToString()); + } + } + #endregion + + #region Async Methods + [TestMethod] + public void TaxClassificationFindAllAsyncTestUsingOAuth() + { + Helper.FindAllAsync(qboContextoAuth, new Intuit.Ipp.Data.TaxClassification()); + } + + [TestMethod] + public void TaxClassificationFindByLevelAsyncTestUsingOAuth() + { + List taxClassList = Helper.FindAll(qboContextoAuth, new Intuit.Ipp.Data.TaxClassification()); + Intuit.Ipp.Data.TaxClassification taxClassification = new Intuit.Ipp.Data.TaxClassification + { + Level = taxClassList[0].Level + }; + Helper.FindByLevelAsync(qboContextoAuth, taxClassification); + } + + [TestMethod] + public void TaxClassificationFindByParentIdAsyncTestUsingOAuth() + { + List taxClassList = Helper.FindAll(qboContextoAuth, new Intuit.Ipp.Data.TaxClassification()); + Intuit.Ipp.Data.TaxClassification taxClassification = new Intuit.Ipp.Data.TaxClassification + { + ParentRef = taxClassList[0].ParentRef + }; + Helper.FindByParentIdAsync(qboContextoAuth, taxClassification); + } + #endregion + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/TaxCode.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/TaxCode.cs new file mode 100644 index 0000000..9a7a51b --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/TaxCode.cs @@ -0,0 +1,357 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; +using Intuit.Ipp.QueryFilter; + + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class TaxCodeTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + [Ignore] + public void TaxCodeAddTestUsingoAuth() + { + //Creating the TaxCode for Add + TaxCode taxCode = QBOHelper.CreateTaxCode(qboContextoAuth); + //Adding the TaxCode + TaxCode added = Helper.Add(qboContextoAuth, taxCode); + //Verify the added TaxCode + QBOHelper.VerifyTaxCode(taxCode, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void TaxCodeFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + //TaxCodeAddTestUsingoAuth(); + + //Retrieving the TaxCode using FindAll + List taxCodes = Helper.FindAll(qboContextoAuth, new TaxCode(), 1, 500); + Assert.IsNotNull(taxCodes); + Assert.IsTrue(taxCodes.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void TaxCodeFindbyIdTestUsingoAuth() + { + //Creating the TaxCode for Adding + //TaxCode taxCode = QBOHelper.CreateTaxCode(qboContextoAuth); + //Adding the TaxCode + TaxCode added = Helper.FindOrAdd(qboContextoAuth, new TaxCode()); + TaxCode taxCode = Helper.FindAll(qboContextoAuth, new TaxCode())[3]; + + TaxCode found = Helper.FindById(qboContextoAuth, taxCode); + QBOHelper.VerifyTaxCode(found, taxCode); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod][Ignore] + public void TaxCodeUpdateTestUsingoAuth() + { + //Creating the TaxCode for Adding + //TaxCode taxCode = QBOHelper.CreateTaxCode(qboContextoAuth); + + + //Adding the TaxCode + TaxCode added = Helper.FindOrAdd(qboContextoAuth, new TaxCode()); + if (added != null) + { + //Change the data of added entity + TaxCode changed = QBOHelper.UpdateTaxCode(qboContextoAuth, added); + //Update the returned entity data + TaxCode updated = Helper.Update(qboContextoAuth, changed);//Verify the updated TaxCode + QBOHelper.VerifyTaxCode(changed, updated); + } + } + + + [TestMethod][Ignore] + public void TaxCodeSparseUpdateTestUsingoAuth() + { + //Creating the TaxCode for Adding + //TaxCode taxCode = QBOHelper.CreateTaxCode(qboContextoAuth); + //Adding the TaxCode + TaxCode added = Helper.FindOrAdd(qboContextoAuth, new TaxCode()); + if (added != null) + { + //Change the data of added entity + TaxCode changed = QBOHelper.SparseUpdateTaxCode(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + TaxCode updated = Helper.Update(qboContextoAuth, changed);//Verify the updated TaxCode + QBOHelper.VerifyTaxCodeSparseUpdate(changed, updated); + } + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod][Ignore] + public void TaxCodeDeleteTestUsingoAuth() + { + //Creating the TaxCode for Adding + TaxCode taxCode = QBOHelper.CreateTaxCode(qboContextoAuth); + //Adding the TaxCode + TaxCode added = Helper.Add(qboContextoAuth, taxCode); + //Delete the returned entity + try + { + TaxCode deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + + [TestMethod][Ignore] + public void TaxCodeVoidTestUsingoAuth() + { + //Creating the TaxCode for Adding + TaxCode taxCode = QBOHelper.CreateTaxCode(qboContextoAuth); + //Adding the TaxCode + TaxCode added = Helper.Add(qboContextoAuth, taxCode); + //Void the returned entity + try + { + TaxCode voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] [Ignore] //IgnoreReason: CDC operations where Create is not supported removed for build + public void TaxCodeCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + //TaxCodeAddTestUsingoAuth(); + + //Retrieving the TaxCode using FindAll + List taxCodes = Helper.CDC(qboContextoAuth, new TaxCode(), DateTime.Today.AddDays(-100)); + if(taxCodes==null) + { + Assert.Inconclusive("No tax codes returned in CDC response"); + } + Assert.IsNotNull(taxCodes); + Assert.IsTrue(taxCodes.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void TaxCodeBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + //TaxCode existing = Helper.FindOrAdd(qboContextoAuth, new TaxCode()); + + //batchEntries.Add(OperationEnum.create, QBOHelper.CreateTaxCode(qboContextoAuth)); + + //batchEntries.Add(OperationEnum.update, QBOHelper.UpdateTaxCode(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from TaxCode"); + + //batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as TaxCode).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + + [TestMethod] + public void TaxCodeQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + TaxCode added = Helper.FindOrAdd(qboContextoAuth, new TaxCode()); + TaxCode taxCode = Helper.FindAll(qboContextoAuth, new TaxCode())[3]; + //List entities = entityQuery.Where(c => c.Id == taxCode.Id).ToList(); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM TaxCode").ToList(); + + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] [Ignore] + public void TaxCodeAddAsyncTestsUsingoAuth() + { + //Creating the TaxCode for Add + TaxCode entity = QBOHelper.CreateTaxCode(qboContextoAuth); + + TaxCode added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyTaxCode(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void TaxCodeRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + //TaxCodeAddTestUsingoAuth(); + + //Retrieving the TaxCode using FindAll + Helper.FindAllAsync(qboContextoAuth, new TaxCode()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void TaxCodeFindByIdAsyncTestsUsingoAuth() + { + //Creating the TaxCode for Adding + //TaxCode entity = QBOHelper.CreateTaxCode(qboContextoAuth); + //Adding the TaxCode + TaxCode added = Helper.FindOrAdd(qboContextoAuth, new TaxCode()); + TaxCode taxCode = Helper.FindAll(qboContextoAuth, new TaxCode())[3]; + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, taxCode); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod][Ignore] + public void TaxCodeUpdatedAsyncTestsUsingoAuth() + { + //Creating the TaxCode for Adding + //TaxCode entity = QBOHelper.CreateTaxCode(qboContextoAuth); + //Adding the TaxCode + TaxCode added = Helper.FindOrAdd(qboContextoAuth, new TaxCode()); + + if (added != null) + { + //Update the TaxCode + TaxCode updated = QBOHelper.UpdateTaxCode(qboContextoAuth, added); + //Call the service + TaxCode updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated TaxCode + QBOHelper.VerifyTaxCode(updated, updatedReturned); + } + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod][Ignore] + public void TaxCodeDeleteAsyncTestsUsingoAuth() + { + //Creating the TaxCode for Adding + //TaxCode entity = QBOHelper.CreateTaxCode(qboContextoAuth); + //Adding the TaxCode + TaxCode added = Helper.FindOrAdd(qboContextoAuth, new TaxCode()); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod][Ignore] + public void TaxCodeVoidAsyncTestsUsingoAuth() + { + //Creating the TaxCode for Adding + //TaxCode entity = QBOHelper.CreateTaxCode(qboContextoAuth); + //Adding the TaxCode + TaxCode added = Helper.FindOrAdd(qboContextoAuth, new TaxCode()); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/TaxRate.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/TaxRate.cs new file mode 100644 index 0000000..6749467 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/TaxRate.cs @@ -0,0 +1,341 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; +using Intuit.Ipp.QueryFilter; + + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class TaxRateTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] [Ignore] + public void TaxRateAddTestUsingoAuth() + { + //Creating the TaxRate for Add + TaxRate taxRate = QBOHelper.CreateTaxRate(qboContextoAuth); + //Adding the TaxRate + TaxRate added = Helper.Add(qboContextoAuth, taxRate); + //Verify the added TaxRate + QBOHelper.VerifyTaxRate(taxRate, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void TaxRateFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + //TaxRateAddTestUsingoAuth(); + + //Retrieving the TaxRate using FindAll + List taxRates = Helper.FindAll(qboContextoAuth, new TaxRate(), 1, 500); + Assert.IsNotNull(taxRates); + Assert.IsTrue(taxRates.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void TaxRateFindbyIdTestUsingoAuth() + { + //Creating the TaxRate for Adding + //TaxRate taxRate = QBOHelper.CreateTaxRate(qboContextoAuth); + //Adding the TaxRate + TaxRate added = Helper.FindOrAdd(qboContextoAuth, new TaxRate()); + TaxRate found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyTaxRate(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] [Ignore] + public void TaxRateUpdateTestUsingoAuth() + { + //Creating the TaxRate for Adding + //TaxRate taxRate = QBOHelper.CreateTaxRate(qboContextoAuth); + //Adding the TaxRate + TaxRate added = Helper.FindOrAdd(qboContextoAuth, new TaxRate()); + //Change the data of added entity + TaxRate changed = QBOHelper.UpdateTaxRate(qboContextoAuth, added); + //Update the returned entity data + TaxRate updated = Helper.Update(qboContextoAuth, changed);//Verify the updated TaxRate + QBOHelper.VerifyTaxRate(changed, updated); + } + + [TestMethod] [Ignore] + public void TaxRateSparseUpdateTestUsingoAuth() + { + //Creating the TaxRate for Adding + TaxRate taxRate = QBOHelper.CreateTaxRate(qboContextoAuth); + //Adding the TaxRate + TaxRate added = Helper.Add(qboContextoAuth, taxRate); + //Change the data of added entity + TaxRate changed = QBOHelper.SparseUpdateTaxRate(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + TaxRate updated = Helper.Update(qboContextoAuth, changed);//Verify the updated TaxRate + QBOHelper.VerifyTaxRateSparseUpdate(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] [Ignore] + public void TaxRateDeleteTestUsingoAuth() + { + //Creating the TaxRate for Adding + //TaxRate taxRate = QBOHelper.CreateTaxRate(qboContextoAuth); + //Adding the TaxRate + TaxRate added = Helper.FindOrAdd(qboContextoAuth, new TaxRate()); + //Delete the returned entity + try + { + TaxRate deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + + [TestMethod] [Ignore] + public void TaxRateVoidTestUsingoAuth() + { + //Creating the TaxRate for Adding + TaxRate taxRate = QBOHelper.CreateTaxRate(qboContextoAuth); + //Adding the TaxRate + TaxRate added = Helper.Add(qboContextoAuth, taxRate); + //Void the returned entity + try + { + TaxRate voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] [Ignore] //IgnoreReason: CDC operations where Create is not supported removed for build + public void TaxRateCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + //TaxRateAddTestUsingoAuth(); //TestComment: This must be added manually as create is not supported + + //Retrieving the TaxRate using FindAll + List taxRates = Helper.CDC(qboContextoAuth, new TaxRate(), DateTime.Today.AddDays(-100)); + if(taxRates==null) + { + Assert.Inconclusive("No tax rates returned in response"); + } + Assert.IsNotNull(taxRates); + Assert.IsTrue(taxRates.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void TaxRateBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + TaxRate existing = Helper.FindOrAdd(qboContextoAuth, new TaxRate()); + + // batchEntries.Add(OperationEnum.create, QBOHelper.CreateTaxRate(qboContextoAuth)); + + // batchEntries.Add(OperationEnum.update, QBOHelper.UpdateTaxRate(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from TaxRate"); + + // batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as TaxRate).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + + [TestMethod] + public void TaxRateQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + TaxRate existing = Helper.FindOrAdd(qboContextoAuth, new TaxRate()); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM TaxRate where Id='" + existing.Id + "'").ToList(); + + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] [Ignore] + public void TaxRateAddAsyncTestsUsingoAuth() + { + //Creating the TaxRate for Add + TaxRate entity = QBOHelper.CreateTaxRate(qboContextoAuth); + + TaxRate added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyTaxRate(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void TaxRateRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + //TaxRateAddTestUsingoAuth(); + + //Retrieving the TaxRate using FindAll + Helper.FindAllAsync(qboContextoAuth, new TaxRate()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void TaxRateFindByIdAsyncTestsUsingoAuth() + { + //Creating the TaxRate for Adding + //TaxRate entity = QBOHelper.CreateTaxRate(qboContextoAuth); + //Adding the TaxRate + TaxRate added = Helper.FindOrAdd(qboContextoAuth, new TaxRate()); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] [Ignore] + public void TaxRateUpdatedAsyncTestsUsingoAuth() + { + //Creating the TaxRate for Adding + //TaxRate entity = QBOHelper.CreateTaxRate(qboContextoAuth); + //Adding the TaxRate + TaxRate added = Helper.FindOrAdd(qboContextoAuth, new TaxRate()); + + //Update the TaxRate + TaxRate updated = QBOHelper.UpdateTaxRate(qboContextoAuth, added); + //Call the service + TaxRate updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated TaxRate + QBOHelper.VerifyTaxRate(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] [Ignore] + public void TaxRateDeleteAsyncTestsUsingoAuth() + { + //Creating the TaxRate for Adding + //TaxRate entity = QBOHelper.CreateTaxRate(qboContextoAuth); + //Adding the TaxRate + TaxRate added = Helper.FindOrAdd(qboContextoAuth, new TaxRate()); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] [Ignore] + public void TaxRateVoidAsyncTestsUsingoAuth() + { + //Creating the TaxRate for Adding + //TaxRate entity = QBOHelper.CreateTaxRate(qboContextoAuth); + //Adding the TaxRate + TaxRate added = Helper.FindOrAdd(qboContextoAuth, new TaxRate()); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/TemplateName.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/TemplateName.cs new file mode 100644 index 0000000..52a97ce --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/TemplateName.cs @@ -0,0 +1,334 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class TemplateNameTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void TemplateNameAddTestUsingoAuth() + { + //Creating the TemplateName for Add + TemplateName templateName = QBOHelper.CreateTemplateName(qboContextoAuth); + //Adding the TemplateName + TemplateName added = Helper.Add(qboContextoAuth, templateName); + //Verify the added TemplateName + QBOHelper.VerifyTemplateName(templateName, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void TemplateNameFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + TemplateNameAddTestUsingoAuth(); + + //Retrieving the TemplateName using FindAll + List templateNames = Helper.FindAll(qboContextoAuth, new TemplateName(), 1, 500); + Assert.IsNotNull(templateNames); + Assert.IsTrue(templateNames.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void TemplateNameFindbyIdTestUsingoAuth() + { + //Creating the TemplateName for Adding + TemplateName templateName = QBOHelper.CreateTemplateName(qboContextoAuth); + //Adding the TemplateName + TemplateName added = Helper.Add(qboContextoAuth, templateName); + TemplateName found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyTemplateName(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void TemplateNameUpdateTestUsingoAuth() + { + //Creating the TemplateName for Adding + TemplateName templateName = QBOHelper.CreateTemplateName(qboContextoAuth); + //Adding the TemplateName + TemplateName added = Helper.Add(qboContextoAuth, templateName); + //Change the data of added entity + TemplateName changed = QBOHelper.UpdateTemplateName(qboContextoAuth, added); + //Update the returned entity data + TemplateName updated = Helper.Update(qboContextoAuth, changed);//Verify the updated TemplateName + QBOHelper.VerifyTemplateName(changed, updated); + } + + [TestMethod] + public void TemplateNameSparseUpdateTestUsingoAuth() + { + //Creating the TemplateName for Adding + TemplateName templateName = QBOHelper.CreateTemplateName(qboContextoAuth); + //Adding the TemplateName + TemplateName added = Helper.Add(qboContextoAuth, templateName); + //Change the data of added entity + TemplateName changed = QBOHelper.UpdateTemplateNameSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + TemplateName updated = Helper.Update(qboContextoAuth, changed);//Verify the updated TemplateName + QBOHelper.VerifyTemplateNameSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void TemplateNameDeleteTestUsingoAuth() + { + //Creating the TemplateName for Adding + TemplateName templateName = QBOHelper.CreateTemplateName(qboContextoAuth); + //Adding the TemplateName + TemplateName added = Helper.Add(qboContextoAuth, templateName); + //Delete the returned entity + try + { + TemplateName deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + public void TemplateNameVoidTestUsingoAuth() + { + //Creating the entity for Adding + TemplateName entity = QBOHelper.CreateTemplateName(qboContextoAuth); + //Adding the entity + TemplateName added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + TemplateName voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void TemplateNameCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + TemplateNameAddTestUsingoAuth(); + + //Retrieving the TemplateName using CDC + List entities = Helper.CDC(qboContextoAuth, new TemplateName(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void TemplateNameBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + TemplateName existing = Helper.FindOrAdd(qboContextoAuth, new TemplateName()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateTemplateName(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateTemplateName(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from TemplateName"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as TemplateName).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void TemplateNameQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + TemplateName existing = Helper.FindOrAdd(qboContextoAuth, new TemplateName()); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + int count = entityQuery.ExecuteIdsQuery("Select * from TemplateName where Id='" + existing.Id + "'").Count; + Assert.IsTrue(count > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void TemplateNameAddAsyncTestsUsingoAuth() + { + //Creating the TemplateName for Add + TemplateName entity = QBOHelper.CreateTemplateName(qboContextoAuth); + + TemplateName added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyTemplateName(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void TemplateNameRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + TemplateNameAddTestUsingoAuth(); + + //Retrieving the TemplateName using FindAll + Helper.FindAllAsync(qboContextoAuth, new TemplateName()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void TemplateNameFindByIdAsyncTestsUsingoAuth() + { + //Creating the TemplateName for Adding + TemplateName entity = QBOHelper.CreateTemplateName(qboContextoAuth); + //Adding the TemplateName + TemplateName added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void TemplateNameUpdatedAsyncTestsUsingoAuth() + { + //Creating the TemplateName for Adding + TemplateName entity = QBOHelper.CreateTemplateName(qboContextoAuth); + //Adding the TemplateName + TemplateName added = Helper.Add(qboContextoAuth, entity); + + //Update the TemplateName + TemplateName updated = QBOHelper.UpdateTemplateName(qboContextoAuth, added); + //Call the service + TemplateName updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated TemplateName + QBOHelper.VerifyTemplateName(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void TemplateNameDeleteAsyncTestsUsingoAuth() + { + //Creating the TemplateName for Adding + TemplateName entity = QBOHelper.CreateTemplateName(qboContextoAuth); + //Adding the TemplateName + TemplateName added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] + public void TemplateNameVoidAsyncTestsUsingoAuth() + { + //Creating the TemplateName for Adding + TemplateName entity = QBOHelper.CreateTemplateName(qboContextoAuth); + //Adding the TemplateName + TemplateName added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Term.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Term.cs new file mode 100644 index 0000000..50a7865 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Term.cs @@ -0,0 +1,335 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class TermTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void TermAddTestUsingoAuth() + { + //Creating the Bill for Add + Term term = QBOHelper.CreateTerm(qboContextoAuth); + //Adding the Term + Term added = Helper.Add(qboContextoAuth, term); + //Verify the added Term + QBOHelper.VerifyTerm(term, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void TermFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + TermAddTestUsingoAuth(); + + //Retrieving the Term using FindAll + List terms = Helper.FindAll(qboContextoAuth, new Term(), 1, 500); + Assert.IsNotNull(terms); + Assert.IsTrue(terms.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void TermFindbyIdTestUsingoAuth() + { + //Creating the Term for Adding + Term term = QBOHelper.CreateTerm(qboContextoAuth); + //Adding the Term + Term added = Helper.Add(qboContextoAuth, term); + Term found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyTerm(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void TermUpdateTestUsingoAuth() + { + //Creating the Term for Adding + Term term = QBOHelper.CreateTerm(qboContextoAuth); + //Adding the Term + Term added = Helper.Add(qboContextoAuth, term); + //Change the data of added entity + Term changed = QBOHelper.UpdateTerm(qboContextoAuth, added); + //Update the returned entity data + Term updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Term + QBOHelper.VerifyTerm(changed, updated); + } + + [TestMethod] + public void TermSparseUpdateTestUsingoAuth() + { + //Creating the Term for Adding + Term term = QBOHelper.CreateTerm(qboContextoAuth); + //Adding the Term + Term added = Helper.Add(qboContextoAuth, term); + //Change the data of added entity + Term changed = QBOHelper.SparseUpdateTerm(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + Term updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Term + QBOHelper.VerifyTermSparseUpdate(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] [Ignore] //TestComment: Returns Operation Not Supported + public void TermDeleteTestUsingoAuth() + { + //Creating the Term for Adding + Term term = QBOHelper.CreateTerm(qboContextoAuth); + //Adding the Term + Term added = Helper.Add(qboContextoAuth, term); + //Delete the returned entity + try + { + Term deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + + [TestMethod] [Ignore] + public void TermVoidTestUsingoAuth() + { + //Creating the Term for Adding + Term term = QBOHelper.CreateTerm(qboContextoAuth); + //Adding the Term + Term added = Helper.Add(qboContextoAuth, term); + //Void the returned entity + try + { + Term voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void TermCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + TermAddTestUsingoAuth(); + + //Retrieving the Term using CDC + List entities = Helper.CDC(qboContextoAuth, new Term(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void TermBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + Term existing = Helper.FindOrAdd(qboContextoAuth, new Term()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateTerm(qboContextoAuth)); + + //batchEntries.Add(OperationEnum.update, QBOHelper.UpdateTerm(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from Term"); + + // batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as Term).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void TermQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + Term existing = Helper.FindOrAdd(qboContextoAuth, new Term()); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM Term where Id='" + existing.Id + "'").ToList(); + + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void TermAddAsyncTestsUsingoAuth() + { + //Creating the Term for Add + Term entity = QBOHelper.CreateTerm(qboContextoAuth); + + Term added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyTerm(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void TermRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + TermAddTestUsingoAuth(); + + //Retrieving the Term using FindAll + Helper.FindAllAsync(qboContextoAuth, new Term()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void TermFindByIdAsyncTestsUsingoAuth() + { + //Creating the Term for Adding + Term entity = QBOHelper.CreateTerm(qboContextoAuth); + //Adding the Term + Term added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void TermUpdatedAsyncTestsUsingoAuth() + { + //Creating the Term for Adding + Term entity = QBOHelper.CreateTerm(qboContextoAuth); + //Adding the Term + Term added = Helper.Add(qboContextoAuth, entity); + + //Update the Term + Term updated = QBOHelper.UpdateTerm(qboContextoAuth, added); + //Call the service + Term updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated Term + QBOHelper.VerifyTerm(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] [Ignore] //TestComment: Returns Operation Not Supported + public void TermDeleteAsyncTestsUsingoAuth() + { + //Creating the Term for Adding + Term entity = QBOHelper.CreateTerm(qboContextoAuth); + //Adding the Term + Term added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] [Ignore] + public void TermVoidAsyncTestsUsingoAuth() + { + //Creating the Term for Adding + Term entity = QBOHelper.CreateTerm(qboContextoAuth); + //Adding the Term + Term added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/TimeActivity.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/TimeActivity.cs new file mode 100644 index 0000000..8c2eb35 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/TimeActivity.cs @@ -0,0 +1,366 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class TimeActivityTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void TimeActivityAddTestUsingoAuth() + { + //Creating the TimeActivity for Add + TimeActivity timeActivity = QBOHelper.CreateTimeActivity(qboContextoAuth); + //Adding the TimeActivity + TimeActivity added = Helper.Add(qboContextoAuth, timeActivity); + //Verify the added TimeActivity + QBOHelper.VerifyTimeActivity(timeActivity, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void TimeActivityFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + TimeActivityAddTestUsingoAuth(); + + //Retrieving the TimeActivity using FindAll + List timeActivitys = Helper.FindAll(qboContextoAuth, new TimeActivity(), 1, 500); + Assert.IsNotNull(timeActivitys); + Assert.IsTrue(timeActivitys.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void TimeActivityFindbyIdTestUsingoAuth() + { + //Creating the TimeActivity for Adding + TimeActivity timeActivity = QBOHelper.CreateTimeActivity(qboContextoAuth); + //Adding the TimeActivity + TimeActivity added = Helper.FindOrAdd(qboContextoAuth, new TimeActivity()); + TimeActivity found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyTimeActivity(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void TimeActivityUpdateTestUsingoAuth() + { + /* + //Creating the TimeActivity for Adding + TimeActivity timeActivity = QBOHelper.CreateTimeActivity(qboContextoAuth); + //Adding the TimeActivity + TimeActivity added = Helper.Add(qboContextoAuth, timeActivity); + */ + + TimeActivity added = Helper.FindOrAdd(qboContextoAuth, new TimeActivity()); + //Change the data of added entity + TimeActivity changed = QBOHelper.UpdateTimeActivity(qboContextoAuth, added); + //Update the returned entity data + TimeActivity updated = Helper.Update(qboContextoAuth, changed);//Verify the updated TimeActivity + QBOHelper.VerifyTimeActivity(changed, updated); + } + + [TestMethod] + public void TimeActivitySparseUpdateTestUsingoAuth() + { + /* + //Creating the TimeActivity for Adding + TimeActivity timeActivity = QBOHelper.CreateTimeActivity(qboContextoAuth); + //Adding the TimeActivity + TimeActivity added = Helper.Add(qboContextoAuth, timeActivity); + */ + + TimeActivity added = Helper.FindOrAdd(qboContextoAuth, new TimeActivity()); + //Change the data of added entity + TimeActivity changed = QBOHelper.UpdateTimeActivitySparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + TimeActivity updated = Helper.Update(qboContextoAuth, changed);//Verify the updated TimeActivity + QBOHelper.VerifyTimeActivitySparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void TimeActivityDeleteTestUsingoAuth() + { + //Creating the TimeActivity for Adding + //TimeActivity timeActivity = QBOHelper.CreateTimeActivity(qboContextoAuth); + //Adding the TimeActivity + //TimeActivity added = Helper.Add(qboContextoAuth, timeActivity); + TimeActivity added = Helper.FindOrAdd(qboContextoAuth, new TimeActivity()); + + //Delete the returned entity + try + { + TimeActivity deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod][Ignore] + public void TimeActivityVoidTestUsingoAuth() + { + TimeActivity added = Helper.FindOrAdd(qboContextoAuth, new TimeActivity()); + + //Delete the returned entity + try + { + TimeActivity voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod][Ignore]//Jira- https://jira.intuit.com/browse/ipp-3295 + public void TimeActivityCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + //TimeActivityAddTestUsingoAuth(); + + //Retrieving the TimeActivity using CDC + List entities = Helper.CDC(qboContextoAuth, new TimeActivity(), DateTime.Today.AddDays(-100)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void TimeActivityBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + TimeActivity existing = Helper.FindOrAdd(qboContextoAuth, new TimeActivity()); + + // batchEntries.Add(OperationEnum.create, QBOHelper.CreateTimeActivity(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateTimeActivity(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from TimeActivity"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as TimeActivity).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void TimeActivityQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + TimeActivity existing = Helper.FindOrAdd(qboContextoAuth, new TimeActivity()); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM TimeActivity where Id='" + existing.Id + "'").ToList(); + + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void TimeActivityAddAsyncTestsUsingoAuth() + { + //Creating the TimeActivity for Add + TimeActivity entity = QBOHelper.CreateTimeActivity(qboContextoAuth); + + TimeActivity added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyTimeActivity(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void TimeActivityRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + //TimeActivityAddTestUsingoAuth(); + + //Retrieving the TimeActivity using FindAll + Helper.FindAllAsync(qboContextoAuth, new TimeActivity()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void TimeActivityFindByIdAsyncTestsUsingoAuth() + { + //Creating the TimeActivity for Adding + //TimeActivity entity = QBOHelper.CreateTimeActivity(qboContextoAuth); + //Adding the TimeActivity + //TimeActivity added = Helper.Add(qboContextoAuth, entity); + + TimeActivity added = Helper.FindOrAdd(qboContextoAuth, new TimeActivity()); + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void TimeActivityUpdatedAsyncTestsUsingoAuth() + { + //Creating the TimeActivity for Adding + //TimeActivity entity = QBOHelper.CreateTimeActivity(qboContextoAuth); + //Adding the TimeActivity + //TimeActivity added = Helper.Add(qboContextoAuth, entity); + + TimeActivity added = Helper.FindOrAdd(qboContextoAuth, new TimeActivity()); + //Update the TimeActivity + TimeActivity updated = QBOHelper.UpdateTimeActivity(qboContextoAuth, added); + //Call the service + TimeActivity updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated TimeActivity + QBOHelper.VerifyTimeActivity(updated, updatedReturned); + } + + [TestMethod] + public void TimeActivitySparseUpdatedAsyncTestsUsingoAuth() + { + //Creating the TimeActivity for Adding + //TimeActivity entity = QBOHelper.CreateTimeActivity(qboContextoAuth); + //Adding the TimeActivity + //TimeActivity added = Helper.Add(qboContextoAuth, entity); + + TimeActivity added = Helper.FindOrAdd(qboContextoAuth, new TimeActivity()); + //Update the TimeActivity + TimeActivity updated = QBOHelper.UpdateTimeActivitySparse(qboContextoAuth, added.Id, added.SyncToken); + //Call the service + TimeActivity updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated TimeActivity + QBOHelper.VerifyTimeActivitySparse(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void TimeActivityDeleteAsyncTestsUsingoAuth() + { + //Creating the TimeActivity for Adding + //TimeActivity entity = QBOHelper.CreateTimeActivity(qboContextoAuth); + //Adding the TimeActivity + //TimeActivity added = Helper.Add(qboContextoAuth, entity); + + TimeActivity added = Helper.FindOrAdd(qboContextoAuth, new TimeActivity()); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod][Ignore] + public void TimeActivityVoidAsyncTestsUsingoAuth() + { + //Creating the TimeActivity for Adding + //TimeActivity entity = QBOHelper.CreateTimeActivity(qboContextoAuth); + //Adding the TimeActivity + //TimeActivity added = Helper.Add(qboContextoAuth, entity); + + TimeActivity added = Helper.FindOrAdd(qboContextoAuth, new TimeActivity()); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Timeout.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Timeout.cs new file mode 100644 index 0000000..deb9c92 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Timeout.cs @@ -0,0 +1,114 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using Intuit.Ipp.DataService; +using System.Collections.ObjectModel; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class TimeoutTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for Timeout + + #region Sync Methods + + [TestMethod] + [Ignore] + [ExpectedException(typeof(IdsException))] + public void SyncTimeoutAdd() + { + qboContextoAuth.Timeout =500; + //Creating the Customer for Add + Customer customer = QBOHelper.CreateCustomer(qboContextoAuth); + //Adding the Customer + Customer added = Helper.Add(qboContextoAuth, customer); + } + + [TestMethod] + [Ignore] + [ExpectedException(typeof(IdsException))] + public void SyncTimeoutUpdate() + { + qboContextoAuth.Timeout = 100000; + //Creating the Customer for Adding + Customer customer = QBOHelper.CreateCustomer(qboContextoAuth); + //Adding the Customer + Customer added = Helper.Add(qboContextoAuth, customer); + QBOHelper.VerifyCustomer(customer, added); + //Change the data of added entity + qboContextoAuth.Timeout = 500; + Customer updated = QBOHelper.UpdateCustomer(qboContextoAuth, added); + //Update the returned entity data + Customer updatedreturned = Helper.Update(qboContextoAuth, updated); + } + + [TestMethod] + [Ignore] + [ExpectedException(typeof(IdsException))] + public void SyncTimeoutUpdateSparseUpdate() + { + qboContextoAuth.Timeout = 100000; + //Creating the Customer for Adding + Customer customer = QBOHelper.CreateCustomer(qboContextoAuth); + //Adding the Customer + Customer added = Helper.Add(qboContextoAuth, customer); + QBOHelper.VerifyCustomer(customer, added); + qboContextoAuth.Timeout = 50; + //Change the data of added entity + Customer updated = QBOHelper.SparseUpdateCustomer(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + Customer updatedreturned = Helper.Update(qboContextoAuth, updated); + } + + [TestMethod] + [Ignore] + [ExpectedException(typeof(IdsException))] + public void SyncTimeoutQuery() + { + qboContextoAuth.Timeout = 10; + //Retrieving the Customer using FindAll + List customers = Helper.FindAll(qboContextoAuth, new Customer(), 1, 2); + } + + + #endregion + + #region Async Methods + + [TestMethod] + public void AsyncNoTimeout() + { + qboContextoAuth.Timeout = 500; + //Creating the Customer for Add + Customer entity = QBOHelper.CreateCustomer(qboContextoAuth); + Customer added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyCustomer(entity, added); + } + + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Transaction.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Transaction.cs new file mode 100644 index 0000000..5befea5 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Transaction.cs @@ -0,0 +1,156 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class TransactionTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void TransactionAddTestUsingoAuth() + { + //Creating the Bill for Add + Transaction transaction = QBOHelper.CreateTransaction(qboContextoAuth); + //Adding the Transaction + Transaction added = Helper.Add(qboContextoAuth, transaction); + //Verify the added Transaction + QBOHelper.VerifyTransaction(transaction, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void TransactionFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + TransactionAddTestUsingoAuth(); + + //Retrieving the Bill using FindAll + List transactions = Helper.FindAll(qboContextoAuth, new Transaction(), 1, 500); + Assert.IsNotNull(transactions); + Assert.IsTrue(transactions.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void TransactionFindbyIdTestUsingoAuth() + { + //Creating the Transaction for Adding + Transaction transaction = QBOHelper.CreateTransaction(qboContextoAuth); + //Adding the Transaction + Transaction added = Helper.Add(qboContextoAuth, transaction); + Transaction found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyTransaction(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void TransactionUpdateTestUsingoAuth() + { + //Creating the Transaction for Adding + Transaction transaction = QBOHelper.CreateTransaction(qboContextoAuth); + //Adding the Transaction + Transaction added = Helper.Add(qboContextoAuth, transaction); + //Change the data of added entity + Transaction changed = QBOHelper.UpdateTransaction(qboContextoAuth, added); + //Update the returned entity data + Transaction updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Transaction + QBOHelper.VerifyTransaction(changed, updated); + } + + [TestMethod] + public void TransactionSparseUpdateTestUsingoAuth() + { + //Creating the Transaction for Adding + Transaction transaction = QBOHelper.CreateTransaction(qboContextoAuth); + //Adding the Transaction + Transaction added = Helper.Add(qboContextoAuth, transaction); + //Change the data of added entity + Transaction changed = QBOHelper.UpdateTransactionSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + Transaction updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Transaction + QBOHelper.VerifyTransactionSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void TransactionDeleteTestUsingoAuth() + { + //Creating the Transaction for Adding + Transaction transaction = QBOHelper.CreateTransaction(qboContextoAuth); + //Adding the Transaction + Transaction added = Helper.Add(qboContextoAuth, transaction); + //Delete the returned entity + try + { + Transaction deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + public void TransactionVoidTestUsingoAuth() + { + //Creating the entity for Adding + Transaction entity = QBOHelper.CreateTransaction(qboContextoAuth); + //Adding the entity + Transaction added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + Transaction voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Transfer.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Transfer.cs new file mode 100644 index 0000000..e487cbe --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Transfer.cs @@ -0,0 +1,347 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class TransferTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + [Ignore] + public void TransferAddTestUsingoAuth() + { + //Creating the Transfer for Add + Transfer transfer = QBOHelper.CreateTransfer(qboContextoAuth); + //Adding the Transfer + Transfer added = Helper.Add(qboContextoAuth, transfer); + //Verify the added Transfer + QBOHelper.VerifyTransfer(transfer, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void TransferFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + TransferAddTestUsingoAuth(); + + //Retrieving the Transfer using FindAll + List transfers = Helper.FindAll(qboContextoAuth, new Transfer(), 1, 500); + Assert.IsNotNull(transfers); + Assert.IsTrue(transfers.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void TransferFindbyIdTestUsingoAuth() + { + //Creating the Transfer for Adding + Transfer transfer = QBOHelper.CreateTransfer(qboContextoAuth); + //Adding the Transfer + Transfer added = Helper.Add(qboContextoAuth, transfer); + Transfer found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyTransfer(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + [Ignore] + public void TransferUpdateTestUsingoAuth() + { + //Creating the Transfer for Adding + Transfer transfer = QBOHelper.CreateTransfer(qboContextoAuth); + //Adding the Transfer + Transfer added = Helper.Add(qboContextoAuth, transfer); + //Change the data of added entity + Transfer changed = QBOHelper.UpdateTransfer(qboContextoAuth, added); + //Update the returned entity data + Transfer updated = Helper.Update(qboContextoAuth, changed); + QBOHelper.VerifyTransfer(changed, updated); + } + + + [TestMethod] + [Ignore] + public void TransferSparseUpdateTestUsingoAuth() + { + //Creating the Transfer for Adding + Transfer transfer = QBOHelper.CreateTransfer(qboContextoAuth); + //Adding the Transfer + Transfer added = Helper.Add(qboContextoAuth, transfer); + //Change the data of added entity + Transfer changed = QBOHelper.UpdateTransferSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + Transfer updated = Helper.Update(qboContextoAuth, changed); + QBOHelper.VerifyTransferSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + [Ignore] + public void TransferDeleteTestUsingoAuth() + { + //Creating the Transfer for Adding + Transfer transfer = QBOHelper.CreateTransfer(qboContextoAuth); + //Adding the Transfer + Transfer added = Helper.Add(qboContextoAuth, transfer); + //Delete the returned entity + try + { + Transfer deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + [Ignore] + public void TransferVoidTestUsingoAuth() + { + //Creating the entity for Adding + Transfer entity = QBOHelper.CreateTransfer(qboContextoAuth); + //Adding the entity + Transfer added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + Transfer voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + [Ignore] + public void TransferCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + TransferAddTestUsingoAuth(); + + //Retrieving the Transfer using CDC + List entities = Helper.CDC(qboContextoAuth, new Transfer(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + [Ignore] + public void TransferBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + Transfer existing = Helper.FindOrAdd(qboContextoAuth, new Transfer()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateTransfer(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateTransfer(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from Transfer"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as Transfer).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void TransferQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + Transfer existing = Helper.FindOrAdd(qboContextoAuth, new Transfer()); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM Transfer where Id='" + existing.Id + "'").ToList(); + + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + [Ignore] + public void TransferAddAsyncTestsUsingoAuth() + { + //Creating the Transfer for Add + Transfer entity = QBOHelper.CreateTransfer(qboContextoAuth); + + Transfer added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyTransfer(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void TransferRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + TransferAddTestUsingoAuth(); + + //Retrieving the Transfer using FindAll + Helper.FindAllAsync(qboContextoAuth, new Transfer()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void TransferFindByIdAsyncTestsUsingoAuth() + { + //Creating the Transfer for Adding + Transfer entity = QBOHelper.CreateTransfer(qboContextoAuth); + //Adding the Transfer + Transfer added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + [Ignore] + public void TransferUpdatedAsyncTestsUsingoAuth() + { + //Creating the Transfer for Adding + Transfer entity = QBOHelper.CreateTransfer(qboContextoAuth); + //Adding the Transfer + Transfer added = Helper.Add(qboContextoAuth, entity); + + //Update the Transfer + Transfer updated = QBOHelper.UpdateTransfer(qboContextoAuth, added); + //Call the service + Transfer updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated Transfer + QBOHelper.VerifyTransfer(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + [Ignore] + public void TransferDeleteAsyncTestsUsingoAuth() + { + //Creating the Transfer for Adding + Transfer entity = QBOHelper.CreateTransfer(qboContextoAuth); + //Adding the Transfer + Transfer added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] + [Ignore] + public void TransferVoidAsyncTestsUsingoAuth() + { + //Creating the Transfer for Adding + Transfer entity = QBOHelper.CreateTransfer(qboContextoAuth); + //Adding the Transfer + Transfer added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/UOM.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/UOM.cs new file mode 100644 index 0000000..d9eb8b2 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/UOM.cs @@ -0,0 +1,334 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class UOMTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void UOMAddTestUsingoAuth() + { + //Creating the UOM for Add + UOM uOM = QBOHelper.CreateUOM(qboContextoAuth); + //Adding the UOM + UOM added = Helper.Add(qboContextoAuth, uOM); + //Verify the added UOM + QBOHelper.VerifyUOM(uOM, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void UOMFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + UOMAddTestUsingoAuth(); + + //Retrieving the UOM using FindAll + List uOMs = Helper.FindAll(qboContextoAuth, new UOM(), 1, 500); + Assert.IsNotNull(uOMs); + Assert.IsTrue(uOMs.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void UOMFindbyIdTestUsingoAuth() + { + //Creating the UOM for Adding + UOM uOM = QBOHelper.CreateUOM(qboContextoAuth); + //Adding the UOM + UOM added = Helper.Add(qboContextoAuth, uOM); + UOM found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyUOM(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void UOMUpdateTestUsingoAuth() + { + //Creating the UOM for Adding + UOM uOM = QBOHelper.CreateUOM(qboContextoAuth); + //Adding the UOM + UOM added = Helper.Add(qboContextoAuth, uOM); + //Change the data of added entity + UOM changed = QBOHelper.UpdateUOM(qboContextoAuth, added); + //Update the returned entity data + UOM updated = Helper.Update(qboContextoAuth, changed);//Verify the updated UOM + QBOHelper.VerifyUOM(changed, updated); + } + + [TestMethod] + public void UOMSparseUpdateTestUsingoAuth() + { + //Creating the UOM for Adding + UOM uOM = QBOHelper.CreateUOM(qboContextoAuth); + //Adding the UOM + UOM added = Helper.Add(qboContextoAuth, uOM); + //Change the data of added entity + UOM changed = QBOHelper.UpdateUOMSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + UOM updated = Helper.Update(qboContextoAuth, changed);//Verify the updated UOM + QBOHelper.VerifyUOMSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void UOMDeleteTestUsingoAuth() + { + //Creating the UOM for Adding + UOM uOM = QBOHelper.CreateUOM(qboContextoAuth); + //Adding the UOM + UOM added = Helper.Add(qboContextoAuth, uOM); + //Delete the returned entity + try + { + UOM deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + public void UserVoidTestUsingoAuth() + { + //Creating the entity for Adding + User entity = QBOHelper.CreateUser(qboContextoAuth); + //Adding the entity + User added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + User voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void UOMCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + UOMAddTestUsingoAuth(); + + //Retrieving the UOM using CDC + List entities = Helper.CDC(qboContextoAuth, new UOM(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void UOMBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + UOM existing = Helper.FindOrAdd(qboContextoAuth, new UOM()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateUOM(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateUOM(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from UOM"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as UOM).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void UOMQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + UOM existing = Helper.FindOrAdd(qboContextoAuth, new UOM()); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + int count = entityQuery.ExecuteIdsQuery("Select * from UOM where Id='" + existing.Id + "'").Count; + Assert.IsTrue(count > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void UOMAddAsyncTestsUsingoAuth() + { + //Creating the UOM for Add + UOM entity = QBOHelper.CreateUOM(qboContextoAuth); + + UOM added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyUOM(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void UOMRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + UOMAddTestUsingoAuth(); + + //Retrieving the UOM using FindAll + Helper.FindAllAsync(qboContextoAuth, new UOM()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void UOMFindByIdAsyncTestsUsingoAuth() + { + //Creating the UOM for Adding + UOM entity = QBOHelper.CreateUOM(qboContextoAuth); + //Adding the UOM + UOM added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void UOMUpdatedAsyncTestsUsingoAuth() + { + //Creating the UOM for Adding + UOM entity = QBOHelper.CreateUOM(qboContextoAuth); + //Adding the UOM + UOM added = Helper.Add(qboContextoAuth, entity); + + //Update the UOM + UOM updated = QBOHelper.UpdateUOM(qboContextoAuth, added); + //Call the service + UOM updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated UOM + QBOHelper.VerifyUOM(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void UOMDeleteAsyncTestsUsingoAuth() + { + //Creating the UOM for Adding + UOM entity = QBOHelper.CreateUOM(qboContextoAuth); + //Adding the UOM + UOM added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] + public void UOMVoidAsyncTestsUsingoAuth() + { + //Creating the UOM for Adding + UOM entity = QBOHelper.CreateUOM(qboContextoAuth); + //Adding the UOM + UOM added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/User.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/User.cs new file mode 100644 index 0000000..ada7016 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/User.cs @@ -0,0 +1,334 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class UserTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void UserAddTestUsingoAuth() + { + //Creating the User for Add + User user = QBOHelper.CreateUser(qboContextoAuth); + //Adding the User + User added = Helper.Add(qboContextoAuth, user); + //Verify the added User + QBOHelper.VerifyUser(user, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void UserFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + UserAddTestUsingoAuth(); + + //Retrieving the User using FindAll + List users = Helper.FindAll(qboContextoAuth, new User(), 1, 500); + Assert.IsNotNull(users); + Assert.IsTrue(users.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void UserFindbyIdTestUsingoAuth() + { + //Creating the User for Adding + User user = QBOHelper.CreateUser(qboContextoAuth); + //Adding the User + User added = Helper.Add(qboContextoAuth, user); + User found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyUser(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void UserUpdateTestUsingoAuth() + { + //Creating the User for Adding + User user = QBOHelper.CreateUser(qboContextoAuth); + //Adding the User + User added = Helper.Add(qboContextoAuth, user); + //Change the data of added entity + User changed = QBOHelper.UpdateUser(qboContextoAuth, added); + //Update the returned entity data + User updated = Helper.Update(qboContextoAuth, changed);//Verify the updated User + QBOHelper.VerifyUser(changed, updated); + } + + [TestMethod] + public void UserSparseUpdateTestUsingoAuth() + { + //Creating the User for Adding + User user = QBOHelper.CreateUser(qboContextoAuth); + //Adding the User + User added = Helper.Add(qboContextoAuth, user); + //Change the data of added entity + User changed = QBOHelper.UpdateUserSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + User updated = Helper.Update(qboContextoAuth, changed);//Verify the updated User + QBOHelper.VerifyUserSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void UserDeleteTestUsingoAuth() + { + //Creating the User for Adding + User user = QBOHelper.CreateUser(qboContextoAuth); + //Adding the User + User added = Helper.Add(qboContextoAuth, user); + //Delete the returned entity + try + { + User deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + public void UserVoidTestUsingoAuth() + { + //Creating the User for Adding + User User = QBOHelper.CreateUser(qboContextoAuth); + //Adding the User + User added = Helper.Add(qboContextoAuth, User); + //Void the returned entity + try + { + User voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void UserCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + UserAddTestUsingoAuth(); + + //Retrieving the User using CDC + List entities = Helper.CDC(qboContextoAuth, new User(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void UserBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + User existing = Helper.FindOrAdd(qboContextoAuth, new User()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateUser(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateUser(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from User"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as User).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void UserQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + User existing = Helper.FindOrAdd(qboContextoAuth, new User()); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + int count= entityQuery.ExecuteIdsQuery("Select * from User where Id='" + existing.Id + "'").Count; + Assert.IsTrue(count > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void UserAddAsyncTestsUsingoAuth() + { + //Creating the User for Add + User entity = QBOHelper.CreateUser(qboContextoAuth); + + User added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyUser(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void UserRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + UserAddTestUsingoAuth(); + + //Retrieving the User using FindAll + Helper.FindAllAsync(qboContextoAuth, new User()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void UserFindByIdAsyncTestsUsingoAuth() + { + //Creating the User for Adding + User entity = QBOHelper.CreateUser(qboContextoAuth); + //Adding the User + User added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void UserUpdatedAsyncTestsUsingoAuth() + { + //Creating the User for Adding + User entity = QBOHelper.CreateUser(qboContextoAuth); + //Adding the User + User added = Helper.Add(qboContextoAuth, entity); + + //Update the User + User updated = QBOHelper.UpdateUser(qboContextoAuth, added); + //Call the service + User updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated User + QBOHelper.VerifyUser(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void UserDeleteAsyncTestsUsingoAuth() + { + //Creating the User for Adding + User entity = QBOHelper.CreateUser(qboContextoAuth); + //Adding the User + User added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] + public void UserVoidAsyncTestsUsingoAuth() + { + //Creating the User for Adding + User entity = QBOHelper.CreateUser(qboContextoAuth); + //Adding the User + User added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Vendor.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Vendor.cs new file mode 100644 index 0000000..50b6251 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/Vendor.cs @@ -0,0 +1,382 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; +using Intuit.Ipp.QueryFilter; + + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class VendorTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void VendorAddTestUsingoAuth() + { + //Creating the Vendor for Add + Vendor vendor = QBOHelper.CreateVendor(qboContextoAuth); + //Adding the Vendor + Vendor added = Helper.Add(qboContextoAuth, vendor); + //Verify the added Vendor + QBOHelper.VerifyVendor(vendor, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void VendorFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + VendorAddTestUsingoAuth(); + + //Retrieving the Vendor using FindAll + List vendors = Helper.FindAll(qboContextoAuth, new Vendor(), 1, 500); + Assert.IsNotNull(vendors); + Assert.IsTrue(vendors.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void VendorFindbyIdTestUsingoAuth() + { + //Creating the Vendor for Adding + Vendor vendor = QBOHelper.CreateVendor(qboContextoAuth); + //Adding the Vendor + Vendor added = Helper.Add(qboContextoAuth, vendor); + Vendor found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyVendor(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void VendorUpdateTestUsingoAuth() + { + //Creating the Vendor for Adding + Vendor vendor = QBOHelper.CreateVendor(qboContextoAuth); + //Adding the Vendor + Vendor added = Helper.Add(qboContextoAuth, vendor); + //Change the data of added entity + Vendor changed = QBOHelper.UpdateVendor(qboContextoAuth, added); + //Update the returned entity data + Vendor updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Vendor + QBOHelper.VerifyVendor(changed, updated); + } + + [TestMethod] + public void VendorSparseUpdateTestUsingoAuth() + { + //Creating the Vendor for Adding + Vendor vendor = QBOHelper.CreateVendor(qboContextoAuth); + //Adding the Vendor + Vendor added = Helper.Add(qboContextoAuth, vendor); + //Change the data of added entity + Vendor changed = QBOHelper.SparseUpdateVendor(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + Vendor updated = Helper.Update(qboContextoAuth, changed);//Verify the updated Vendor + QBOHelper.VerifyVendorSparseUpdate(changed, updated); + } + + #endregion + + + #region Test cases for Updateaccountontxns Operations + + [TestMethod] + public void VendorUpdateAccountOnTxnsTestUsingoAuthFrance() + { + + //Creating the Vendor for Adding + Vendor vendor = QBOHelper.CreateVendorFrance(qboContextoAuth); + //Adding the Vendor + Vendor added = Helper.Add(qboContextoAuth, vendor); + //Change the data of added entity + Vendor changed = QBOHelper.UpdateVendorFrance(qboContextoAuth, added); + //Update the returned entity data + Vendor updated = Helper.UpdateAccountOnTxnsFrance(qboContextoAuth, changed);//Verify the updated Vendor + QBOHelper.VerifyVendorFrance(changed, updated); + } + + + #endregion + + + #region Test cases for Delete Operations + + [TestMethod] [Ignore] //TestComment: Returns Operation Not Supported + public void VendorDeleteTestUsingoAuth() + { + //Creating the Vendor for Adding + Vendor vendor = QBOHelper.CreateVendor(qboContextoAuth); + //Adding the Vendor + Vendor added = Helper.Add(qboContextoAuth, vendor); + //Delete the returned entity + try + { + Vendor deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + + [TestMethod] [Ignore] + public void VendorVoidTestUsingoAuth() + { + //Creating the Vendor for Adding + Vendor vendor = QBOHelper.CreateVendor(qboContextoAuth); + //Adding the Vendor + Vendor added = Helper.Add(qboContextoAuth, vendor); + //Void the returned entity + try + { + Vendor voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void VendorCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + VendorAddTestUsingoAuth(); + + //Retrieving the Vendor using FindAll + List vendors = Helper.CDC(qboContextoAuth, new Vendor(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(vendors); + Assert.IsTrue(vendors.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void VendorBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + Vendor existing = Helper.FindOrAdd(qboContextoAuth, new Vendor()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateVendor(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateVendor(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from Vendor"); + + // batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as Vendor).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void VendorQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + Vendor existing = Helper.FindOrAdd(qboContextoAuth, new Vendor()); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM Vendor where Id='" + existing.Id + "'").ToList(); + + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void VendorAddAsyncTestsUsingoAuth() + { + //Creating the Vendor for Add + Vendor entity = QBOHelper.CreateVendor(qboContextoAuth); + + Vendor added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyVendor(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void VendorRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + VendorAddTestUsingoAuth(); + + //Retrieving the Vendor using FindAll + Helper.FindAllAsync(qboContextoAuth, new Vendor()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void VendorFindByIdAsyncTestsUsingoAuth() + { + //Creating the Vendor for Adding + Vendor entity = QBOHelper.CreateVendor(qboContextoAuth); + //Adding the Vendor + Vendor added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void VendorUpdatedAsyncTestsUsingoAuth() + { + //Creating the Vendor for Adding + Vendor entity = QBOHelper.CreateVendor(qboContextoAuth); + //Adding the Vendor + Vendor added = Helper.Add(qboContextoAuth, entity); + + //Update the Vendor + Vendor updated = QBOHelper.UpdateVendor(qboContextoAuth, added); + //Call the service + Vendor updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated Vendor + QBOHelper.VerifyVendor(updated, updatedReturned); + } + + #endregion + + + #region Test cases for Updateaccountontxns Operations + + [TestMethod] + public void VendorUpdateAccountOnTxnsAsyncTestUsingoAuthFrance() + { + + //Creating the Vendor for Adding + Vendor vendor = QBOHelper.CreateVendorFrance(qboContextoAuth); + //Adding the Vendor + Vendor added = Helper.Add(qboContextoAuth, vendor); + //Change the data of added entity + Vendor changed = QBOHelper.UpdateVendorFrance(qboContextoAuth, added); + //Update the returned entity data + + Vendor updated = Helper.UpdateAccountOnTxnsAsyncFrance(qboContextoAuth, changed);//Verify the updated Vendor + QBOHelper.VerifyVendorFrance(changed, updated); + } + + + #endregion + + + + #region Test Cases for Delete Operation + + [TestMethod] [Ignore] //TestComment: Returns Operation Not Supported + public void VendorDeleteAsyncTestsUsingoAuth() + { + //Creating the Vendor for Adding + Vendor entity = QBOHelper.CreateVendor(qboContextoAuth); + //Adding the Vendor + Vendor added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] [Ignore] + public void VendorVoidAsyncTestsUsingoAuth() + { + //Creating the Vendor for Adding + Vendor entity = QBOHelper.CreateVendor(qboContextoAuth); + //Adding the Vendor + Vendor added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/VendorCredit.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/VendorCredit.cs new file mode 100644 index 0000000..f9c68cc --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/VendorCredit.cs @@ -0,0 +1,334 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; + +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] + public class VendorCreditTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void VendorCreditAddTestUsingoAuth() + { + //Creating the VendorCredit for Add + VendorCredit vendorCredit = QBOHelper.CreateVendorCredit(qboContextoAuth); + //Adding the VendorCredit + VendorCredit added = Helper.Add(qboContextoAuth, vendorCredit); + //Verify the added VendorCredit + QBOHelper.VerifyVendorCredit(vendorCredit, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod]// [Ignore] //IgnoreReason: Not Supported + public void VendorCreditFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + VendorCreditAddTestUsingoAuth(); + + //Retrieving the VendorCredit using FindAll + List vendorCredits = Helper.FindAll(qboContextoAuth, new VendorCredit(), 1, 500); + Assert.IsNotNull(vendorCredits); + Assert.IsTrue(vendorCredits.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void VendorCreditFindbyIdTestUsingoAuth() + { + //Creating the VendorCredit for Adding + VendorCredit vendorCredit = QBOHelper.CreateVendorCredit(qboContextoAuth); + //Adding the VendorCredit + VendorCredit added = Helper.Add(qboContextoAuth, vendorCredit); + VendorCredit found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyVendorCredit(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void VendorCreditUpdateTestUsingoAuth() + { + //Creating the VendorCredit for Adding + VendorCredit vendorCredit = QBOHelper.CreateVendorCredit(qboContextoAuth); + //Adding the VendorCredit + VendorCredit added = Helper.Add(qboContextoAuth, vendorCredit); + //Change the data of added entity + VendorCredit changed = QBOHelper.UpdateVendorCredit(qboContextoAuth, added); + //Update the returned entity data + VendorCredit updated = Helper.Update(qboContextoAuth, changed);//Verify the updated VendorCredit + QBOHelper.VerifyVendorCredit(changed, updated); + } + + [TestMethod] + public void VendorCreditSparseUpdateTestUsingoAuth() + { + //Creating the VendorCredit for Adding + VendorCredit vendorCredit = QBOHelper.CreateVendorCredit(qboContextoAuth); + //Adding the VendorCredit + VendorCredit added = Helper.Add(qboContextoAuth, vendorCredit); + //Change the data of added entity + VendorCredit changed = QBOHelper.UpdateVendorCreditSparse(qboContextoAuth, added.Id, added.SyncToken, added.VendorRef); + //Update the returned entity data + VendorCredit updated = Helper.Update(qboContextoAuth, changed);//Verify the updated VendorCredit + QBOHelper.VerifyVendorCreditSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void VendorCreditDeleteTestUsingoAuth() + { + //Creating the VendorCredit for Adding + VendorCredit vendorCredit = QBOHelper.CreateVendorCredit(qboContextoAuth); + //Adding the VendorCredit + VendorCredit added = Helper.Add(qboContextoAuth, vendorCredit); + //Delete the returned entity + try + { + VendorCredit deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] [Ignore] //IgnoreReason: Not supported + public void VendorCreditVoidTestUsingoAuth() + { + //Creating the VendorCredit for Adding + VendorCredit vendorCredit = QBOHelper.CreateVendorCredit(qboContextoAuth); + //Adding the VendorCredit + VendorCredit added = Helper.Add(qboContextoAuth, vendorCredit); + try + { + VendorCredit voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void VendorCreditCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + VendorCreditAddTestUsingoAuth(); + + //Retrieving the VendorCredit using CDC + List entities = Helper.CDC(qboContextoAuth, new VendorCredit(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void VendorCreditBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + //VendorCredit existing = Helper.FindOrAdd(qboContextoAuth, new VendorCredit()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateVendorCredit(qboContextoAuth)); + + //batchEntries.Add(OperationEnum.update, QBOHelper.UpdateVendorCredit(qboContextoAuth, existing)); + + //batchEntries.Add(OperationEnum.query, "select * from VendorCredit"); + + //batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as VendorCredit).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] //[Ignore] //IgnoreReason: Not Supported + public void VendorCreditQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + VendorCredit existing = Helper.FindOrAdd(qboContextoAuth, new VendorCredit()); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM VendorCredit where Id='" + existing.Id + "'").ToList(); + + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void VendorCreditAddAsyncTestsUsingoAuth() + { + //Creating the VendorCredit for Add + VendorCredit entity = QBOHelper.CreateVendorCredit(qboContextoAuth); + + VendorCredit added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyVendorCredit(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] //[Ignore] //IgnoreReason: Not Supported + public void VendorCreditRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + VendorCreditAddTestUsingoAuth(); + + //Retrieving the VendorCredit using FindAll + Helper.FindAllAsync(qboContextoAuth, new VendorCredit()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void VendorCreditFindByIdAsyncTestsUsingoAuth() + { + //Creating the VendorCredit for Adding + VendorCredit entity = QBOHelper.CreateVendorCredit(qboContextoAuth); + //Adding the VendorCredit + VendorCredit added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void VendorCreditUpdatedAsyncTestsUsingoAuth() + { + //Creating the VendorCredit for Adding + VendorCredit entity = QBOHelper.CreateVendorCredit(qboContextoAuth); + //Adding the VendorCredit + VendorCredit added = Helper.Add(qboContextoAuth, entity); + + //Update the VendorCredit + VendorCredit updated = QBOHelper.UpdateVendorCredit(qboContextoAuth, added); + //Call the service + VendorCredit updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated VendorCredit + QBOHelper.VerifyVendorCredit(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void VendorCreditDeleteAsyncTestsUsingoAuth() + { + //Creating the VendorCredit for Adding + VendorCredit entity = QBOHelper.CreateVendorCredit(qboContextoAuth); + //Adding the VendorCredit + VendorCredit added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] [Ignore] //IgnoreReason: Not supported + public void VendorCreditVoidAsyncTestsUsingoAuth() + { + //Creating the VendorCredit for Adding + VendorCredit entity = QBOHelper.CreateVendorCredit(qboContextoAuth); + //Adding the VendorCredit + VendorCredit added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/VendorType.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/VendorType.cs new file mode 100644 index 0000000..27aac4e --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/VendorType.cs @@ -0,0 +1,335 @@ +using System; +using System.Text; +using System.Collections.Generic; +using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Intuit.Ipp.Core; +using Intuit.Ipp.Data; +using Intuit.Ipp.Security; +using Intuit.Ipp.Exception; +using System.Threading; +using Intuit.Ipp.QueryFilter; +// +using System.Collections.ObjectModel; +using Intuit.Ipp.DataService; + +namespace Intuit.Ipp.Test.Services.QBO +{ + [TestClass] [Ignore] + public class VendorTypeTest + { + ServiceContext qboContextoAuth = null; + [TestInitialize] + public void MyTestInitializer() + { + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); + //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; + //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + } + + + #region TestCases for QBOContextOAuth + + #region Sync Methods + + #region Test cases for Add Operations + + [TestMethod] + public void VendorTypeAddTestUsingoAuth() + { + //Creating the VendorType for Add + VendorType vendorType = QBOHelper.CreateVendorType(qboContextoAuth); + //Adding the VendorType + VendorType added = Helper.Add(qboContextoAuth, vendorType); + //Verify the added VendorType + QBOHelper.VerifyVendorType(vendorType, added); + } + + #endregion + + #region Test cases for FindAll Operations + + [TestMethod] + public void VendorTypeFindAllTestUsingoAuth() + { + //Making sure that at least one entity is already present + VendorTypeAddTestUsingoAuth(); + + //Retrieving the VendorType using FindAll + List vendorTypes = Helper.FindAll(qboContextoAuth, new VendorType(), 1, 500); + Assert.IsNotNull(vendorTypes); + Assert.IsTrue(vendorTypes.Count() > 0); + } + + #endregion + + #region Test cases for FindbyId Operations + + [TestMethod] + public void VendorTypeFindbyIdTestUsingoAuth() + { + //Creating the VendorType for Adding + VendorType vendorType = QBOHelper.CreateVendorType(qboContextoAuth); + //Adding the VendorType + VendorType added = Helper.Add(qboContextoAuth, vendorType); + VendorType found = Helper.FindById(qboContextoAuth, added); + QBOHelper.VerifyVendorType(found, added); + } + + #endregion + + #region Test cases for Update Operations + + [TestMethod] + public void VendorTypeUpdateTestUsingoAuth() + { + //Creating the VendorType for Adding + VendorType vendorType = QBOHelper.CreateVendorType(qboContextoAuth); + //Adding the VendorType + VendorType added = Helper.Add(qboContextoAuth, vendorType); + //Change the data of added entity + VendorType changed = QBOHelper.UpdateVendorType(qboContextoAuth, added); + //Update the returned entity data + VendorType updated = Helper.Update(qboContextoAuth, changed);//Verify the updated VendorType + QBOHelper.VerifyVendorType(changed, updated); + } + + + [TestMethod] + public void VendorTypeSparseUpdateTestUsingoAuth() + { + //Creating the VendorType for Adding + VendorType vendorType = QBOHelper.CreateVendorType(qboContextoAuth); + //Adding the VendorType + VendorType added = Helper.Add(qboContextoAuth, vendorType); + //Change the data of added entity + VendorType changed = QBOHelper.UpdateVendorTypeSparse(qboContextoAuth, added.Id, added.SyncToken); + //Update the returned entity data + VendorType updated = Helper.Update(qboContextoAuth, changed);//Verify the updated VendorType + QBOHelper.VerifyVendorTypeSparse(changed, updated); + } + + #endregion + + #region Test cases for Delete Operations + + [TestMethod] + public void VendorTypeDeleteTestUsingoAuth() + { + //Creating the VendorType for Adding + VendorType vendorType = QBOHelper.CreateVendorType(qboContextoAuth); + //Adding the VendorType + VendorType added = Helper.Add(qboContextoAuth, vendorType); + //Delete the returned entity + try + { + VendorType deleted = Helper.Delete(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + [TestMethod] + public void VendorTypeVoidTestUsingoAuth() + { + //Creating the entity for Adding + VendorType entity = QBOHelper.CreateVendorType(qboContextoAuth); + //Adding the entity + VendorType added = Helper.Add(qboContextoAuth, entity); + //Void the returned entity + try + { + VendorType voided = Helper.Void(qboContextoAuth, added); + Assert.AreEqual(EntityStatusEnum.Voided, voided.status); + } + catch (IdsException ex) + { + Assert.Fail(); + } + } + + #endregion + + #region Test cases for CDC Operations + + [TestMethod] + public void VendorTypeCDCTestUsingoAuth() + { + //Making sure that at least one entity is already present + VendorTypeAddTestUsingoAuth(); + + //Retrieving the VendorType using CDC + List entities = Helper.CDC(qboContextoAuth, new VendorType(), DateTime.Today.AddDays(-1)); + Assert.IsNotNull(entities); + Assert.IsTrue(entities.Count() > 0); + } + + #endregion + + #region Test cases for Batch + + [TestMethod] + public void VendorTypeBatchUsingoAuth() + { + Dictionary batchEntries = new Dictionary(); + + VendorType existing = Helper.FindOrAdd(qboContextoAuth, new VendorType()); + + batchEntries.Add(OperationEnum.create, QBOHelper.CreateVendorType(qboContextoAuth)); + + batchEntries.Add(OperationEnum.update, QBOHelper.UpdateVendorType(qboContextoAuth, existing)); + + batchEntries.Add(OperationEnum.query, "select * from VendorType"); + + batchEntries.Add(OperationEnum.delete, existing); + + ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); + + int position = 0; + foreach (IntuitBatchResponse resp in batchResponses) + { + + if (resp.ResponseType == ResponseType.Exception) + { + Assert.Fail(resp.Exception.ToString()); + } + + if (resp.ResponseType == ResponseType.Entity) + { + Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as VendorType).Id)); + } + else if (resp.ResponseType == ResponseType.Query) + { + Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); + } + else if (resp.ResponseType == ResponseType.CdcQuery) + { + Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); + } + + position++; + } + } + + #endregion + + #region Test cases for Query + [TestMethod] + public void VendorQueryUsingoAuth() + { + QueryService entityQuery = new QueryService(qboContextoAuth); + VendorType existing = Helper.FindOrAdd(qboContextoAuth, new VendorType()); + //List entities = entityQuery.Where(c => c.Id == existing.Id).ToList(); + int count=entityQuery.ExecuteIdsQuery("Select * from VendorType where Id='"+existing.Id+"'").Count; + Assert.IsTrue(count > 0); + } + + #endregion + + #endregion + + #region ASync Methods + + #region Test Cases for Add Operation + + [TestMethod] + public void VendorTypeAddAsyncTestsUsingoAuth() + { + //Creating the VendorType for Add + VendorType entity = QBOHelper.CreateVendorType(qboContextoAuth); + + VendorType added = Helper.AddAsync(qboContextoAuth, entity); + QBOHelper.VerifyVendorType(entity, added); + } + + #endregion + + #region Test Cases for FindAll Operation + + [TestMethod] + public void VendorTypeRetrieveAsyncTestsUsingoAuth() + { + //Making sure that at least one entity is already present + VendorTypeAddTestUsingoAuth(); + + //Retrieving the VendorType using FindAll + Helper.FindAllAsync(qboContextoAuth, new VendorType()); + } + + #endregion + + #region Test Cases for FindById Operation + + [TestMethod] + public void VendorTypeFindByIdAsyncTestsUsingoAuth() + { + //Creating the VendorType for Adding + VendorType entity = QBOHelper.CreateVendorType(qboContextoAuth); + //Adding the VendorType + VendorType added = Helper.Add(qboContextoAuth, entity); + + //FindById and verify + Helper.FindByIdAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Update Operation + + [TestMethod] + public void VendorTypeUpdatedAsyncTestsUsingoAuth() + { + //Creating the VendorType for Adding + VendorType entity = QBOHelper.CreateVendorType(qboContextoAuth); + //Adding the VendorType + VendorType added = Helper.Add(qboContextoAuth, entity); + + //Update the VendorType + VendorType updated = QBOHelper.UpdateVendorType(qboContextoAuth, added); + //Call the service + VendorType updatedReturned = Helper.UpdateAsync(qboContextoAuth, updated); + //Verify updated VendorType + QBOHelper.VerifyVendorType(updated, updatedReturned); + } + + #endregion + + #region Test Cases for Delete Operation + + [TestMethod] + public void VendorTypeDeleteAsyncTestsUsingoAuth() + { + //Creating the VendorType for Adding + VendorType entity = QBOHelper.CreateVendorType(qboContextoAuth); + //Adding the VendorType + VendorType added = Helper.Add(qboContextoAuth, entity); + + Helper.DeleteAsync(qboContextoAuth, added); + } + + #endregion + + #region Test Cases for Void Operation + + [TestMethod] + public void VendorTypeVoidAsyncTestsUsingoAuth() + { + //Creating the VendorType for Adding + VendorType entity = QBOHelper.CreateVendorType(qboContextoAuth); + //Adding the VendorType + VendorType added = Helper.Add(qboContextoAuth, entity); + + Helper.VoidAsync(qboContextoAuth, added); + } + + #endregion + + #endregion + + #endregion + + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/Resource/image.jpg b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/Resource/image.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ffb0f43d8605bcc7947527f9be47c25fe831516a GIT binary patch literal 2220 zcmbW22~bl>8pmGc0z(L94VzT^)_VuEAnefz!~^z~MA;SgfXw zrlyuQBCN(*T^;SUsPU7fG7qThVf3wBeAXBQ9>-c=Fm%0? zUy8HYSH>XX{Koru4zp=oSlYG!U{@37Hvle>o}Ve7W-yLOX&_w4oa4?Y+YN;!1+ z$jMWYr=y~&XA-_k{GOI{G5N~XYv~!8S=j|Y+`3(O=f}H0-7hPzsI2<6`auJ;k=4Zh z?NM_Z|7m+iXIJ;L*Mk0mLE+Hw$oRzM)Vuc|K2Fcb<`=#!%9p_96%`i>K>ri#53+yb z(nGk^kTX!ns<=>UG$hb^>KH4RHTph**y9%rtX(hR40q<2*7G!M+=8S=C*u1wjcwh> z?PMyne~|rmV3+?dvOmE7#WezGqfyA=q4fYFu&O|#S(^ zkIPBZmsRmnclk)|^Al@_K-xi&RvmEh&s!=NwAp>L^`&RkXb&3{c4>PdzF3;LBq1vz zAz|y<79&R6HU$xkgA7)`A0q%uiU-R#$hQvoI_t-hbfK+oDay>nm-lW(4#=Ssj1QV562@`CChAt}w%< zfutSjmRc6vvfws<)93oe(3hWNlgUv^<05&~;ArrpdaytUt?x_x?iCAfas*5WE#k>d zuAkJh7?~d_{%XrNeRN5@!BWmbyyNtXXT{>>>19rGdei$eJu8gDs{Td_Vbb|}njV-a zeaSFSy3+1#@k(hK8*4e${JFGxS8QcFS~Bbuz600h`Hp{%_r|54a#iUD1DAPey<%hT z=1MTnUlx@q;jXXQu_tCia`MTFJZC)0YJ^yHh})3OBkZm85N#D(9TI-^tfKtQJ>%J` z0}8Lz9bdeEy5DL;9OFbt<69oXfVu$8*X1+POLXoWmhF?|jgT|F!j4xDQ3r3Zbu4mp z8gKf@!Dm)Z332hq--tUKt5>2R97#bx0|RXAC(E(FP&%4Ra=0YfhS~j(T7`)@z3O7B zd59pjDSBY@oOh3L$+q1?oY?Xco}OQC8al)f2j4!D;t+RKJ|A8?_gc7rqIUJx^%SjUvAGXA4bZcxmp6@%@Crh z?s*s(cV>4M<#OaLFCQ<(cG4#;go{k%wwbRMD|acv(%KkCkSQ3ngCR=qxADal< z%kwPnkzLO||66|7`1!qdftkH(twzMLdtxb-EiqA8L81~(ZwK&BM+wHcQCAHt5FBb{ z3p`Tyhjo``@m-%bP(NPl`e@dllI+Njy(C9gp>*PVS59NOO0l){f4M=oIFjlLb_Sdj%Ce_FezW#8zF$ zb6o+yh?bh5MHt}uz`(a+G&1lbM%JyPZ<2i>p#28bdSg<~>=aQ6`BVHv4X?PJWNdn9 z!8O9MJLSPpmvUZ|OFaU1Y>5!5E{FdJv*JTD^M z=-6F6xrMpxRQ=Spi@cqq6O3lV)J@?%@B9CFmP5B1L;f&)7B-4`Q|OfbxJ!~Gg$Vu^o@D@&o#tMcOtX3 zIL2hy;g*|^SHsJE7ww@<*)Qs2-q(SI9!LuYYLRVRxeThbcf#X^oF#RNcsy!*_M1B! zbbiZ+VmRk7ZZWp2{A)_rm9)h>E1q~JrGt!CI#ZP{vPX*%S+wmvv&|31+3rLZNTZ0( zzRGoV!oBx%A2qbL&-)~}8!{<&6ES<MC-kK)?ZS&Kj> zSxU*AIX?ROV7UO+S?7?mreI+H7S+6L}x| zdA^`Iw4lkzF*qrNd~iICGHWlH8u;AOlfz7Qr?X)ITQlRi(kWp{lRv+Xu8lp%RkKfz z{?XMxH}!nTtsA&MUB)fe3CW;m9(3RbDFNcLbXT{Dg!xE0=)|$NMPhK1^R*U>8HN_u zZ+s4y#2;@ef&ttrtFqbQC?Qb5w#qe+4)U{3I{)s1LB;}Z$9eO|br4RX0O%2`Suk*# zoN){QD<&8kMG@C-ibttU-rD_fryGSEW-dl5LKb=rG2HUIWjEgVcA1*xFii)|o@^BG zLrdS5A#X#^MHUQH*j0sn*;n1M(Erev9c?S=n{Ow!6K``$&IOW;>@Sg2zrueGEIj;o Dw)Yuo literal 0 HcmV?d00001 diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/TokenStore.json b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/TokenStore.json new file mode 100644 index 0000000..04d74ef --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/TokenStore.json @@ -0,0 +1,6 @@ +{ + "Oauth2Keys": { + "AccessToken": "", + "RefreshToken": "" + } +} diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/TraceAndTestImpact.testsettings b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/TraceAndTestImpact.testsettings new file mode 100644 index 0000000..ce73dd6 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/TraceAndTestImpact.testsettings @@ -0,0 +1,9 @@ + + + These are test settings for Trace and Test Impact. + + + + + + \ No newline at end of file diff --git a/SampleApp_CRUD_.Net/SampleApp_CRUD_.Net/Entities/NameListEntities/Class.cs b/SampleApp_CRUD_.Net/SampleApp_CRUD_.Net/Entities/NameListEntities/Class.cs index c034359..6e2783d 100644 --- a/SampleApp_CRUD_.Net/SampleApp_CRUD_.Net/Entities/NameListEntities/Class.cs +++ b/SampleApp_CRUD_.Net/SampleApp_CRUD_.Net/Entities/NameListEntities/Class.cs @@ -115,7 +115,8 @@ public void ClassCDCTestUsingoAuth(ServiceContext qboContextoAuth) #region Batch - + + public void ClassBatchUsingoAuth(ServiceContext qboContextoAuth) { Dictionary batchEntries = new Dictionary(); diff --git a/SampleApp_CRUD_.Net/SampleApp_CRUD_.Net/Entities/NameListEntities/TaxService.cs b/SampleApp_CRUD_.Net/SampleApp_CRUD_.Net/Entities/NameListEntities/TaxService.cs index 6af318d..bc2d561 100644 --- a/SampleApp_CRUD_.Net/SampleApp_CRUD_.Net/Entities/NameListEntities/TaxService.cs +++ b/SampleApp_CRUD_.Net/SampleApp_CRUD_.Net/Entities/NameListEntities/TaxService.cs @@ -53,7 +53,7 @@ public void TaxCodeAddTestUsingoAuth(ServiceContext qboContextoAuth) taxCodetobeAdded.TaxRateDetails = lstTaxRate.ToArray(); - Intuit.Ipp.Data.TaxService taxCodeAdded = taxSvc.AddTaxCode(taxCodetobeAdded); + TaxService taxCodeAdded = taxSvc.AddTaxCode(taxCodetobeAdded); } diff --git a/SampleApp_CRUD_.Net/SampleApp_CRUD_.Net/Helper/QBOHelper.cs b/SampleApp_CRUD_.Net/SampleApp_CRUD_.Net/Helper/QBOHelper.cs index c1336da..a7d0db4 100644 --- a/SampleApp_CRUD_.Net/SampleApp_CRUD_.Net/Helper/QBOHelper.cs +++ b/SampleApp_CRUD_.Net/SampleApp_CRUD_.Net/Helper/QBOHelper.cs @@ -122,6 +122,7 @@ internal static Invoice CreateASTInvoice(ServiceContext context) lineList.Add(line1); invoice.Line = lineList.ToArray(); + invoice.TxnTaxDetail = new TxnTaxDetail() { //TotalTax = Convert.ToDecimal(10), @@ -130,11 +131,52 @@ internal static Invoice CreateASTInvoice(ServiceContext context) { Value = taxCode.Id} }; - - - - - return invoice; + // invoice.TxnTaxDetail = new TxnTaxDetail(); + + // var taxLine = new List(); + // Line l1 = new Line(); + // l1.Amount = 23; + // l1.AmountSpecified = true; + // l1.DetailType = LineDetailTypeEnum.TaxLineDetail; + // l1.DetailTypeSpecified = true; + // l1.AnyIntuitObject = new TaxLineDetail() + // { + // TaxRateRef = new ReferenceType { Value = "4" }, + // NetAmountTaxable = 23, + // NetAmountTaxableSpecified = true, + // TaxPercent = 5, + // TaxPercentSpecified = true, + // PercentBased = true, + // PercentBasedSpecified = true + + + // }; + // taxLine.Add(l1); + + // Line l2 = new Line(); + // l2.Amount = 23; + // l2.AmountSpecified = true; + // l2.DetailType = LineDetailTypeEnum.TaxLineDetail; + // l2.DetailTypeSpecified = true; + // l2.AnyIntuitObject = new TaxLineDetail() + // { + // TaxRateRef = new ReferenceType { Value = "4" }, + // NetAmountTaxable = 23, + // NetAmountTaxableSpecified = true, + // TaxPercent = 5, + // TaxPercentSpecified = true, + // PercentBased = true, + // PercentBasedSpecified = true + + + // }; + // taxLine.Add(l2); + + + + + // invoice.TxnTaxDetail.TaxLine = taxLine.ToArray(); + return invoice; } diff --git a/SampleApp_CRUD_.Net/SampleApp_CRUD_DotNet_Oauth2.sln b/SampleApp_CRUD_.Net/SampleApp_CRUD_DotNet_Oauth2.sln index f58a42b..5e5d49f 100644 --- a/SampleApp_CRUD_.Net/SampleApp_CRUD_DotNet_Oauth2.sln +++ b/SampleApp_CRUD_.Net/SampleApp_CRUD_DotNet_Oauth2.sln @@ -5,6 +5,10 @@ VisualStudioVersion = 15.0.26403.7 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleApp_CRUD_DotNet_Oauth2", "SampleApp_CRUD_.Net\SampleApp_CRUD_DotNet_Oauth2.csproj", "{CE90774B-9BA2-4FF6-A233-76AC769072AB}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{36EEE3B4-F4A8-4947-8F23-96740B16DD56}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Intuit.Ipp.Test", "Intuit.Ipp.Test\SDKV3Test\Intuit.Ipp.Test.csproj", "{68B71AFE-0121-4A63-B8CB-EA374D12E2CA}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,8 +19,19 @@ Global {CE90774B-9BA2-4FF6-A233-76AC769072AB}.Debug|Any CPU.Build.0 = Debug|Any CPU {CE90774B-9BA2-4FF6-A233-76AC769072AB}.Release|Any CPU.ActiveCfg = Release|Any CPU {CE90774B-9BA2-4FF6-A233-76AC769072AB}.Release|Any CPU.Build.0 = Release|Any CPU + {36EEE3B4-F4A8-4947-8F23-96740B16DD56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {36EEE3B4-F4A8-4947-8F23-96740B16DD56}.Debug|Any CPU.Build.0 = Debug|Any CPU + {36EEE3B4-F4A8-4947-8F23-96740B16DD56}.Release|Any CPU.ActiveCfg = Release|Any CPU + {36EEE3B4-F4A8-4947-8F23-96740B16DD56}.Release|Any CPU.Build.0 = Release|Any CPU + {68B71AFE-0121-4A63-B8CB-EA374D12E2CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {68B71AFE-0121-4A63-B8CB-EA374D12E2CA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {68B71AFE-0121-4A63-B8CB-EA374D12E2CA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {68B71AFE-0121-4A63-B8CB-EA374D12E2CA}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C5AC3614-7846-4BE9-ACA0-D7116426E7D7} + EndGlobalSection EndGlobal diff --git a/SampleApp_CRUD_.Net/Tests/Properties/AssemblyInfo.cs b/SampleApp_CRUD_.Net/Tests/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..b9a8c6c --- /dev/null +++ b/SampleApp_CRUD_.Net/Tests/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Tests")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Tests")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: ComVisible(false)] + +[assembly: Guid("36eee3b4-f4a8-4947-8f23-96740b16dd56")] + +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/SampleApp_CRUD_.Net/Tests/Tests.csproj b/SampleApp_CRUD_.Net/Tests/Tests.csproj new file mode 100644 index 0000000..73bddca --- /dev/null +++ b/SampleApp_CRUD_.Net/Tests/Tests.csproj @@ -0,0 +1,68 @@ + + + + + + Debug + AnyCPU + {36EEE3B4-F4A8-4947-8F23-96740B16DD56} + Library + Properties + Tests + Tests + v4.6.1 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 15.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages + False + UnitTest + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll + + + ..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/SampleApp_CRUD_.Net/Tests/UnitTest1.cs b/SampleApp_CRUD_.Net/Tests/UnitTest1.cs new file mode 100644 index 0000000..c5ddab2 --- /dev/null +++ b/SampleApp_CRUD_.Net/Tests/UnitTest1.cs @@ -0,0 +1,14 @@ +using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace Tests +{ + [TestClass] + public class UnitTest1 + { + [TestMethod] + public void TestMethod1() + { + } + } +} diff --git a/SampleApp_CRUD_.Net/Tests/packages.config b/SampleApp_CRUD_.Net/Tests/packages.config new file mode 100644 index 0000000..102a45c --- /dev/null +++ b/SampleApp_CRUD_.Net/Tests/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file From 6f5d70ac8b2a670952fde1395435fe3e7f64d46d Mon Sep 17 00:00:00 2001 From: nimish84 Date: Sat, 31 Aug 2019 01:46:36 -0700 Subject: [PATCH 02/18] Corrected --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 035791c..88542fb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ dotnet: 2.0.0 solution: Intuit.Ipp.Test.sln script: -- cd SampleApp_CRUD_.Net\Intuit.Ipp.Test +- cd SampleApp_CRUD_.Net/Intuit.Ipp.Test - dotnet restore - dotnet build From c3d52d9319e2170a5bd725b4765f8cdebb37c253 Mon Sep 17 00:00:00 2001 From: nimish84 Date: Sat, 31 Aug 2019 02:31:59 -0700 Subject: [PATCH 03/18] test serilog --- .../SDKV3Test/Services/QBO/CompanyInfo.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CompanyInfo.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CompanyInfo.cs index edf69ce..0b454d6 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CompanyInfo.cs +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CompanyInfo.cs @@ -9,6 +9,10 @@ using Intuit.Ipp.Exception; using System.Threading; using Intuit.Ipp.QueryFilter; +using Serilog; +using Serilog.Sinks; +using Serilog.Core; +using Serilog.Events; using System.Collections.ObjectModel; using Intuit.Ipp.DataService; @@ -19,12 +23,18 @@ namespace Intuit.Ipp.Test.Services.QBO public class CompanyInfoTest { ServiceContext qboContextoAuth = null; + Logger log; [TestInitialize] public void MyTestInitializer() { + log = new LoggerConfiguration() + .WriteTo.Trace() + .CreateLogger(); qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; + log.Write(LogEventLevel.Information, qboContextoAuth.BaseUrl); + } @@ -37,6 +47,7 @@ public void MyTestInitializer() [TestMethod] [Ignore] public void CompanyInfoAddTestUsingoAuth() { + //Creating the Bill for Add CompanyInfo companyInfo = QBOHelper.CreateCompanyInfo(qboContextoAuth); //Adding the CompanyInfo From c989bf4083fa3ac6d2f87a67554f846dff131c19 Mon Sep 17 00:00:00 2001 From: nimish84 Date: Sat, 31 Aug 2019 02:36:42 -0700 Subject: [PATCH 04/18] updated --- .../SDKV3Test/Intuit.Ipp.Test.csproj | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj index e60a1ff..73193cb 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj @@ -28,6 +28,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -39,6 +111,10 @@ + + + + From 900c2209a69dbe559e904db17153aa038b6775c8 Mon Sep 17 00:00:00 2001 From: nimish84 Date: Fri, 6 Sep 2019 14:40:03 -0700 Subject: [PATCH 05/18] Adding Serilogger --- .../SDKV3Test/Common/Helper.cs | 4 +- .../SDKV3Test/Common/Initializer.cs | 23 ++++++++++- .../SDKV3Test/Common/SeriLogger.cs | 41 +++++++++++++++++++ .../SDKV3Test/Intuit.Ipp.Test.csproj | 2 + .../SDKV3Test/Services/QBO/CompanyInfo.cs | 13 ++---- .../SampleApp_CRUD_DotNet_Oauth2.sln | 6 --- 6 files changed, 71 insertions(+), 18 deletions(-) create mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/SeriLogger.cs diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Helper.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Helper.cs index be7f14f..42a3951 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Helper.cs +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Helper.cs @@ -21,13 +21,14 @@ using Newtonsoft.Json.Linq; using System.IO; + namespace Intuit.Ipp.Test { public class Helper { internal static ServiceContext GetNewTokens_ServiceContext() { - + FileInfo fileinfo = new FileInfo(AuthorizationKeysQBO.tokenFilePath); string jsonFile = File.ReadAllText(fileinfo.FullName); @@ -56,6 +57,7 @@ internal static ServiceContext GetNewTokens_ServiceContext() } + string output = JsonConvert.SerializeObject(jObj, Formatting.Indented); File.WriteAllText(fileinfo.FullName, output); //tokenDict.Clear(); diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs index fc7d195..5aa680f 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs @@ -16,12 +16,15 @@ using Intuit.Ipp.Core.Configuration; using Newtonsoft.Json.Linq; using Newtonsoft.Json; +using Serilog.Events; namespace Intuit.Ipp.Test { public class Initializer { + + static OAuth2Client oauthClient = null; public static Dictionary tokenDict = new Dictionary(); public static string pathFile = ""; @@ -30,6 +33,7 @@ public class Initializer static IConfigurationRoot builder; public Initializer(string path) { + ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; //AuthorizationKeysQBO.tokenFilePath = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()))), "TokenStore.json"); @@ -82,17 +86,28 @@ private static void Initialize() internal static ServiceContext InitializeQBOServiceContextUsingoAuth() { - if (counter==0) + + + if (counter == 0) + { //if(tokenDict.Count == 0) Initialize(); + SeriLogger.log.Write(Serilog.Events.LogEventLevel.Verbose, "Inside1"); + SeriLogger.log.Information("Inside1usingInfolog"); + } + else { + SeriLogger.log.Write(Serilog.Events.LogEventLevel.Verbose, "Inside2"); //Load the second json file FileInfo fileinfo = new FileInfo(AuthorizationKeysQBO.tokenFilePath); string jsonFile = File.ReadAllText(fileinfo.FullName); var jObj = JObject.Parse(jsonFile); - AuthorizationKeysQBO.accessTokenQBO= jObj["Oauth2Keys"]["AccessToken"].ToString(); + AuthorizationKeysQBO.accessTokenQBO = jObj["Oauth2Keys"]["AccessToken"].ToString(); AuthorizationKeysQBO.refreshTokenQBO = jObj["Oauth2Keys"]["RefreshToken"].ToString(); + SeriLogger.log.Write(Serilog.Events.LogEventLevel.Verbose, "AuthorizationKeysQBO.accessTokenQBO"+ AuthorizationKeysQBO.accessTokenQBO); + SeriLogger.log.Write(Serilog.Events.LogEventLevel.Verbose, "AuthorizationKeysQBO.refreshTokenQBO" + AuthorizationKeysQBO.refreshTokenQBO); + } ServiceContext context = null; @@ -102,6 +117,7 @@ internal static ServiceContext InitializeQBOServiceContextUsingoAuth() reqValidator = new OAuth2RequestValidator(AuthorizationKeysQBO.accessTokenQBO); context = new ServiceContext(AuthorizationKeysQBO.realmIdIAQBO, IntuitServicesType.QBO, reqValidator); + SeriLogger.log.Write(LogEventLevel.Verbose, context.BaseUrl); context.IppConfiguration.MinorVersion.Qbo = "37"; DataService.DataService service = new DataService.DataService(context); var compinfo= service.FindAll(new CompanyInfo()); @@ -112,6 +128,9 @@ internal static ServiceContext InitializeQBOServiceContextUsingoAuth() } catch (IdsException ex) { + SeriLogger.log.Write(LogEventLevel.Verbose, ex.InnerException.ToString()); + SeriLogger.log.Write(LogEventLevel.Verbose, ex.ErrorCode); + SeriLogger.log.Write(LogEventLevel.Verbose, ex.InnerExceptions[0].ToString()); if (ex.Message == "Unauthorized-401") { //oauthClient = new OAuth2Client(AuthorizationKeysQBO.clientIdQBO, AuthorizationKeysQBO.clientSecretQBO, AuthorizationKeysQBO.redirectUrl, AuthorizationKeysQBO.appEnvironment); diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/SeriLogger.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/SeriLogger.cs new file mode 100644 index 0000000..e2eaa36 --- /dev/null +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/SeriLogger.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using Serilog; +using Serilog.Sinks; +using Serilog.Core; +using Serilog.Events; + +namespace Intuit.Ipp.Test +{ + public static class SeriLogger + { + //public string applog { get; set; } + public static Logger log { get; set; } + static SeriLogger() + { + log = new LoggerConfiguration() + .MinimumLevel.Verbose() + .Enrich.FromLogContext() + .WriteTo.Trace() + .WriteTo.Debug() + .WriteTo.Console() + .CreateLogger(); + + + log.Information("Logger is initialized"); + } + + + + + //public static void LogSeriLogMessage() + //{ + // log = new LoggerConfiguration() + // .WriteTo.Trace() + // .CreateLogger(); + // log.Write(LogEventLevel.Verbose, applog); + //} + } +} \ No newline at end of file diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj index 73193cb..2502aea 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj @@ -113,6 +113,8 @@ + + diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CompanyInfo.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CompanyInfo.cs index 0b454d6..d928b06 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CompanyInfo.cs +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CompanyInfo.cs @@ -9,10 +9,7 @@ using Intuit.Ipp.Exception; using System.Threading; using Intuit.Ipp.QueryFilter; -using Serilog; -using Serilog.Sinks; -using Serilog.Core; -using Serilog.Events; + using System.Collections.ObjectModel; using Intuit.Ipp.DataService; @@ -23,17 +20,15 @@ namespace Intuit.Ipp.Test.Services.QBO public class CompanyInfoTest { ServiceContext qboContextoAuth = null; - Logger log; + [TestInitialize] public void MyTestInitializer() { - log = new LoggerConfiguration() - .WriteTo.Trace() - .CreateLogger(); + qboContextoAuth = Initializer.InitializeQBOServiceContextUsingoAuth(); //qboContextoAuth.IppConfiguration.Logger.RequestLog.EnableRequestResponseLogging = true; //qboContextoAuth.IppConfiguration.Logger.RequestLog.ServiceRequestLoggingLocation = @"C:\IdsLogs"; - log.Write(LogEventLevel.Information, qboContextoAuth.BaseUrl); + } diff --git a/SampleApp_CRUD_.Net/SampleApp_CRUD_DotNet_Oauth2.sln b/SampleApp_CRUD_.Net/SampleApp_CRUD_DotNet_Oauth2.sln index 5e5d49f..ada28d5 100644 --- a/SampleApp_CRUD_.Net/SampleApp_CRUD_DotNet_Oauth2.sln +++ b/SampleApp_CRUD_.Net/SampleApp_CRUD_DotNet_Oauth2.sln @@ -5,8 +5,6 @@ VisualStudioVersion = 15.0.26403.7 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleApp_CRUD_DotNet_Oauth2", "SampleApp_CRUD_.Net\SampleApp_CRUD_DotNet_Oauth2.csproj", "{CE90774B-9BA2-4FF6-A233-76AC769072AB}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "Tests\Tests.csproj", "{36EEE3B4-F4A8-4947-8F23-96740B16DD56}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Intuit.Ipp.Test", "Intuit.Ipp.Test\SDKV3Test\Intuit.Ipp.Test.csproj", "{68B71AFE-0121-4A63-B8CB-EA374D12E2CA}" EndProject Global @@ -19,10 +17,6 @@ Global {CE90774B-9BA2-4FF6-A233-76AC769072AB}.Debug|Any CPU.Build.0 = Debug|Any CPU {CE90774B-9BA2-4FF6-A233-76AC769072AB}.Release|Any CPU.ActiveCfg = Release|Any CPU {CE90774B-9BA2-4FF6-A233-76AC769072AB}.Release|Any CPU.Build.0 = Release|Any CPU - {36EEE3B4-F4A8-4947-8F23-96740B16DD56}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {36EEE3B4-F4A8-4947-8F23-96740B16DD56}.Debug|Any CPU.Build.0 = Debug|Any CPU - {36EEE3B4-F4A8-4947-8F23-96740B16DD56}.Release|Any CPU.ActiveCfg = Release|Any CPU - {36EEE3B4-F4A8-4947-8F23-96740B16DD56}.Release|Any CPU.Build.0 = Release|Any CPU {68B71AFE-0121-4A63-B8CB-EA374D12E2CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {68B71AFE-0121-4A63-B8CB-EA374D12E2CA}.Debug|Any CPU.Build.0 = Debug|Any CPU {68B71AFE-0121-4A63-B8CB-EA374D12E2CA}.Release|Any CPU.ActiveCfg = Release|Any CPU From 183c8ebe6aaf1ee371f5a713b8e4e8e5cc65f1de Mon Sep 17 00:00:00 2001 From: nimish84 Date: Fri, 6 Sep 2019 15:19:19 -0700 Subject: [PATCH 06/18] Updated test --- .../SDKV3Test/Appsettings.json | 4 +- .../SDKV3Test/Common/Initializer.cs | 11 +- .../SDKV3Test/Common/SeriLogger.cs | 34 +- .../SDKV3Test/Intuit.Ipp.Test.csproj | 1 + .../SDKV3Test/Services/QBO/CompanyInfo.cs | 304 +----------------- 5 files changed, 38 insertions(+), 316 deletions(-) diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json index 2d86825..2d92d1a 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json @@ -1,7 +1,7 @@ { "Oauth2Keys": { - "AccessToken": "eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..6eGoUSu4w5p_DM7GoxLSZg._qbb3fFXlVbVMTQ2eGd86hq87GGYPFuYXI7zNveJsevp0J8rt8geR3qDBlf9y-uD4osiFlCfiW7vh7uwnS5HJDEioPHYb82yVosVy3zVEoksg8rKPWkYO561MABv-TSpVTjlYWuzczTBt1GST30e5S0kEYbXtuj4PkbCKSGQKKT-yzaxn2hA72rzCvB9fCj2lZvDBS17xTzjT7j0sD1hBdbnoMr161qSxUTXfg3tDSE874FhYBVVc0rHJ0lqNwKpujnyMWFHGl_6Oh7YpeV0lngjmE2jrKHNxUaa-vJHisOGUN008Isv_ikjXUtQI1OpDflLWcHV9KD9CSxTXYcYnPkokf-kyeWNhC6wDDTJm58LhLHQ4W9L3Jv-M57cxYk3F4qCP-0861wDPXGcJMzsS-1wWYY3Gdpp1c2cDWXpTxlIxBERfnC3seh9bO0NoijMAXfz8rmXtUguBGjrf_n5TwLJmQAKpBTvijdJPwRmJzIvUm9azCIuLYBiA1XGukiEJ74oJbwE-51qANAsPHsUrQBeyinWkeXV9M1UmnWw_6zG5fsIv9IknmsGelsKXsWF7HrABYpgCA8IgenjtUq6w8TL_mjHnRsCJsdwJ1ddtEX9JZFL-kxVPlfew3p3HKfPv27QT0Vo9tW-bK-fCPPrflgFsO4V1udmM_Zfm7F90xc.ZYF0h8c8bJohLsu0Cc0q-g", - "RefreshToken": "AB1157596503335r71V6cslgBLIhIm8SbmGpIe96CpjMX76xvC", + "AccessToken": "eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..lZFeWeWcTyff9lmwUt-qpw.z_bqkq98A2sUdFCnrT9cilFggnRx43RgVjKeG90N7qGdxCoQB5706quio4G7_f7x3MkAv9HFve1hAjCAx8WZjzjdO-5iKzbl8BP43XLMJixQAxeecccr5ed0KYO-49tTnRsdnVxcb2RbRe6JE5XKb6F7PV5KuOv9To0F1KSO1dIiYzy2h53vTiOKLPhaCKjHcmjfH9QPkW_eZBWAjwhsnOlFnnnYAiW0s4XyWxDpLd23m1XPhQ0QBuOfD6RBdGaPv-bzjqKR3x-iN_sZaV68Y8P6AwHW2nAOSJKv83IW7emlxWwyDlQVZ_0Wv2vU-fV25y4AlYI0LYGqlIzZv9z-K0B_ocBRqvEqUi-6_P2m2owpaUsZJcNmBtg_XKXDp6HiowMpHUmvbYszf9fybwo0xV1Ce8Q2iiE5WOJhVzjP8azUKs99_E0oB03hu04kNp2bBkaGT5rFOoyD6f3BwCzKry_GcENj9GG0TBXwpz7maFnIFj5wNaBc8g05e1HfMKUCy1F9zK4d8pVHeYIeqrNeuFSU6UO9ierihBa3GFabNW8gte3DJ6gE4AVYJFD1NmIety2toDomIVqryqvL8OG9BgWmC78J4-O6b6vs6AMins5zD48aBQT3eqOuWSdASMXCqavQ9Y0KW5H1Kn6WlDIqTSLoRmE77VdSaAX3njOg_wM.4IaJvE7pUgUl2wMAq-J3ew", + "RefreshToken": "AB11576534461b5To7cKUMwD7c9J0arypgkbcMx6sv1nVX1mjk", "RealmId": "123146090856284", "ClientId": "Q0joY7aqSROhDAspO4JLoH6ChEtpBvYalZIUwQOg3u5cwbVEaL", "ClientSecret": "aHPShUDVCEg332ggf7pM3ffAkx6LyzcZIBh5muF5", diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs index 5aa680f..f7b8191 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs @@ -33,12 +33,13 @@ public class Initializer static IConfigurationRoot builder; public Initializer(string path) { + SeriLogger.log.Write(Serilog.Events.LogEventLevel.Verbose, "InsideInitializer"); + - ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; //AuthorizationKeysQBO.tokenFilePath = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()))), "TokenStore.json"); AuthorizationKeysQBO.tokenFilePath = Path.Combine(System.IO.Directory.GetCurrentDirectory(), "TokenStore.json"); - + SeriLogger.log.Write(Serilog.Events.LogEventLevel.Verbose, " AuthorizationKeysQBO.tokenFilePath- {}", AuthorizationKeysQBO.tokenFilePath); var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile(path, optional: true, reloadOnChange: true) @@ -47,13 +48,17 @@ public Initializer(string path) AuthorizationKeysQBO.accessTokenQBO= builder.GetSection("Oauth2Keys")["AccessToken"]; + SeriLogger.log.Write(Serilog.Events.LogEventLevel.Verbose, " AuthorizationKeysQBO.accessTokenQBO- {accessToken}", AuthorizationKeysQBO.accessTokenQBO); AuthorizationKeysQBO.refreshTokenQBO = builder.GetSection("Oauth2Keys")["RefreshToken"]; AuthorizationKeysQBO.clientIdQBO = builder.GetSection("Oauth2Keys")["ClientId"]; AuthorizationKeysQBO.clientSecretQBO = builder.GetSection("Oauth2Keys")["ClientSecret"]; AuthorizationKeysQBO.realmIdIAQBO = builder.GetSection("Oauth2Keys")["RealmId"]; AuthorizationKeysQBO.redirectUrl = builder.GetSection("Oauth2Keys")["RedirectUrl"]; + AuthorizationKeysQBO.qboBaseUrl = builder.GetSection("Oauth2Keys")["QBOBaseUrl"]; + SeriLogger.log.Write(Serilog.Events.LogEventLevel.Verbose, " AuthorizationKeysQBO.qboBaseUrl- {qboBaseUrl}", AuthorizationKeysQBO.qboBaseUrl); + AuthorizationKeysQBO.appEnvironment = builder.GetSection("Oauth2Keys")["Environment"]; FileInfo fileinfo = new FileInfo(AuthorizationKeysQBO.tokenFilePath); string jsonFile = File.ReadAllText(fileinfo.FullName); @@ -117,7 +122,7 @@ internal static ServiceContext InitializeQBOServiceContextUsingoAuth() reqValidator = new OAuth2RequestValidator(AuthorizationKeysQBO.accessTokenQBO); context = new ServiceContext(AuthorizationKeysQBO.realmIdIAQBO, IntuitServicesType.QBO, reqValidator); - SeriLogger.log.Write(LogEventLevel.Verbose, context.BaseUrl); + SeriLogger.log.Write(LogEventLevel.Verbose, "Base url from Context"+context.BaseUrl); context.IppConfiguration.MinorVersion.Qbo = "37"; DataService.DataService service = new DataService.DataService(context); var compinfo= service.FindAll(new CompanyInfo()); diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/SeriLogger.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/SeriLogger.cs index e2eaa36..16e34cd 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/SeriLogger.cs +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/SeriLogger.cs @@ -6,6 +6,8 @@ using Serilog.Sinks; using Serilog.Core; using Serilog.Events; +using System.IO; +using System.Diagnostics; namespace Intuit.Ipp.Test { @@ -21,21 +23,35 @@ static SeriLogger() .WriteTo.Trace() .WriteTo.Debug() .WriteTo.Console() + .WriteTo.RollingFile(@"C:\Documents\Serilog_log\Log-{Date}.txt") .CreateLogger(); log.Information("Logger is initialized"); } + private static Stream AddListener(string path) + { + string filename = path + "TraceLog-" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; + Stream myFile = null; + if (File.Exists(filename)) + myFile = new FileStream(filename, FileMode.Append); + else + myFile = new FileStream(filename, FileMode.Create); + TextWriterTraceListener myTextListener = new TextWriterTraceListener(myFile); + Trace.Listeners.Add(myTextListener); + Trace.AutoFlush = true; + return myFile; + } + - - //public static void LogSeriLogMessage() - //{ - // log = new LoggerConfiguration() - // .WriteTo.Trace() - // .CreateLogger(); - // log.Write(LogEventLevel.Verbose, applog); - //} - } + //public static void LogSeriLogMessage() + //{ + // log = new LoggerConfiguration() + // .WriteTo.Trace() + // .CreateLogger(); + // log.Write(LogEventLevel.Verbose, applog); + //} + } } \ No newline at end of file diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj index 2502aea..73558a8 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj @@ -116,6 +116,7 @@ + diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CompanyInfo.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CompanyInfo.cs index d928b06..2c490aa 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CompanyInfo.cs +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CompanyInfo.cs @@ -32,26 +32,7 @@ public void MyTestInitializer() } - - #region TestCases for QBOContextOAuth - - #region Sync Methods - - #region Test cases for Add Operations - - [TestMethod] [Ignore] - public void CompanyInfoAddTestUsingoAuth() - { - - //Creating the Bill for Add - CompanyInfo companyInfo = QBOHelper.CreateCompanyInfo(qboContextoAuth); - //Adding the CompanyInfo - CompanyInfo added = Helper.Add(qboContextoAuth, companyInfo); - //Verify the added CompanyInfo - QBOHelper.VerifyCompanyInfo(companyInfo, added); - } - - #endregion + #region Test cases for FindAll Operations @@ -69,288 +50,7 @@ public void CompanyInfoFindAllTestUsingoAuth() #endregion - #region Test cases for FindbyId Operations - - [TestMethod] - public void CompanyInfoFindbyIdTestUsingoAuth() - { - //Creating the CompanyInfo for Adding - // CompanyInfo companyInfo = QBOHelper.CreateCompanyInfo(qboContextoAuth); - //Adding the CompanyInfo - // CompanyInfo added = Helper.Add(qboContextoAuth, companyInfo); - CompanyInfo added = new CompanyInfo(); - added.Id = "1"; - CompanyInfo found = Helper.FindById(qboContextoAuth, added); - Assert.AreEqual(added.Id, found.Id); - } - - #endregion - - #region Test cases for Update Operations - - [TestMethod][Ignore] - public void CompanyInfoUpdateTestUsingoAuth() - { - ////Creating the CompanyInfo for Adding - //CompanyInfo companyInfo = QBOHelper.CreateCompanyInfo(qboContextoAuth); - ////Adding the CompanyInfo - //CompanyInfo added = Helper.Add(qboContextoAuth, companyInfo); - - List found = Helper.FindAll(qboContextoAuth, new CompanyInfo()); - - //Change the data of added entity - CompanyInfo changed = QBOHelper.UpdateCompanyInfo(qboContextoAuth, found[0]); - - //Update the returned entity data - CompanyInfo updated = Helper.Update(qboContextoAuth, changed);//Verify the updated CompanyInfo - QBOHelper.VerifyCompanyInfo(changed, updated); - } - - [TestMethod] [Ignore] - public void CompanyInfoSparseUpdateTestUsingoAuth() - { - ////Creating the CompanyInfo for Adding - //CompanyInfo companyInfo = QBOHelper.CreateCompanyInfo(qboContextoAuth); - ////Adding the CompanyInfo - //CompanyInfo added = Helper.Add(qboContextoAuth, companyInfo); - - List found = Helper.FindAll(qboContextoAuth, new CompanyInfo()); - - //Change the data of added entity - CompanyInfo changed = QBOHelper.SparseUpdateCompanyInfo(qboContextoAuth, found[0].Id, found[0].SyncToken, found[0].CompanyName); - //Update the returned entity data - CompanyInfo updated = Helper.Update(qboContextoAuth, changed);//Verify the updated CompanyInfo - QBOHelper.VerifyCompanyInfoSparseUpdate(changed, updated); - } - - #endregion - - #region Test cases for Delete Operations - - [TestMethod] [Ignore] - public void CompanyInfoDeleteTestUsingoAuth() - { - //Creating the CompanyInfo for Adding - CompanyInfo companyInfo = QBOHelper.CreateCompanyInfo(qboContextoAuth); - //Adding the CompanyInfo - CompanyInfo added = Helper.Add(qboContextoAuth, companyInfo); - //Delete the returned entity - try - { - CompanyInfo deleted = Helper.Delete(qboContextoAuth, added); - Assert.AreEqual(EntityStatusEnum.Deleted, deleted.status); - } - catch (IdsException ex) - { - Assert.Fail(); - } - } - - [TestMethod] [Ignore] //IgnoreReason: Not Supported - public void CompanyInfoVoidTestUsingoAuth() - { - //Creating the entity for Adding - CompanyInfo entity = QBOHelper.CreateCompanyInfo(qboContextoAuth); - //Adding the entity - CompanyInfo added = Helper.Add(qboContextoAuth, entity); - //Void the returned entity - try - { - CompanyInfo voided = Helper.Void(qboContextoAuth, added); - Assert.AreEqual(EntityStatusEnum.Voided, voided.status); - } - catch (IdsException ex) - { - Assert.Fail(); - } - } - - #endregion - - #region Test cases for CDC Operations - - [TestMethod] - public void CompanyInfoCDCTestUsingoAuth() - { - //Making sure that at least one entity is already present - //CompanyInfoAddTestUsingoAuth(); - - //Retrieving the Bill using FindAll - List companyInfos = Helper.CDC(qboContextoAuth, new CompanyInfo(), DateTime.Today.AddDays(-1)); - Assert.IsNotNull(companyInfos); - Assert.IsTrue(companyInfos.Count() > 0); - } - - #endregion - - #region Test cases for Batch - - [TestMethod] - public void CompanyInfoBatchUsingoAuth() - { - Dictionary batchEntries = new Dictionary(); - - List existing = Helper.FindAll(qboContextoAuth, new CompanyInfo()); - - - - Assert.IsNotNull(existing); - - - batchEntries.Add(OperationEnum.update, QBOHelper.UpdateCompanyInfo(qboContextoAuth, existing[0])); - - batchEntries.Add(OperationEnum.query, "select * from CompanyInfo"); - - - ReadOnlyCollection batchResponses = Helper.BatchTest(qboContextoAuth, batchEntries); - - int position = 0; - foreach (IntuitBatchResponse resp in batchResponses) - { - - if (resp.ResponseType == ResponseType.Exception) - { - Assert.Fail(resp.Exception.ToString()); - } - - if (resp.ResponseType == ResponseType.Entity) - { - Assert.IsFalse(string.IsNullOrEmpty((resp.Entity as CompanyInfo).Id)); - } - else if (resp.ResponseType == ResponseType.Query) - { - Assert.IsTrue(resp.Entities != null && resp.Entities.Count > 0); - } - else if (resp.ResponseType == ResponseType.CdcQuery) - { - Assert.IsTrue(resp.CDCResponse != null && resp.CDCResponse.entities != null && resp.CDCResponse.entities.Count > 0); - } - - position++; - } - } - - #endregion - - #region Test cases for Query - [TestMethod] - public void CompanyInfoQueryUsingoAuth() - { - QueryService entityQuery = new QueryService(qboContextoAuth); - CompanyInfo existing = Helper.FindOrAdd(qboContextoAuth, new CompanyInfo()); - //List entities = entityQuery.Where(c => c.MetaData.CreateTime == existing.MetaData.CreateTime).ToList(); - List entities = entityQuery.ExecuteIdsQuery("SELECT * FROM CompanyInfo").ToList(); - - Assert.IsTrue(entities.Count() > 0); - } - - #endregion - - #endregion - - #region ASync Methods - - #region Test Cases for Add Operation - - [TestMethod] [Ignore] - public void CompanyInfoAddAsyncTestsUsingoAuth() - { - //Creating the CompanyInfo for Add - CompanyInfo entity = QBOHelper.CreateCompanyInfo(qboContextoAuth); - - CompanyInfo added = Helper.AddAsync(qboContextoAuth, entity); - QBOHelper.VerifyCompanyInfo(entity, added); - } - - #endregion - - #region Test Cases for FindAll Operation - - [TestMethod] - public void CompanyInfoRetrieveAsyncTestsUsingoAuth() - { - //Making sure that at least one entity is already present - //CompanyInfoAddTestUsingoAuth(); - - //Retrieving the CompanyInfo using FindAll - Helper.FindAllAsync(qboContextoAuth, new CompanyInfo()); - } - - #endregion - - #region Test Cases for FindById Operation - - [TestMethod] - public void CompanyInfoFindByIdAsyncTestsUsingoAuth() - { - ////Creating the CompanyInfo for Adding - //CompanyInfo entity = QBOHelper.CreateCompanyInfo(qboContextoAuth); - ////Adding the CompanyInfo - //CompanyInfo added = Helper.Add(qboContextoAuth, entity); - - CompanyInfo added = new CompanyInfo(); - added.Id = "1"; - //FindById and verify - Helper.FindByIdAsync(qboContextoAuth, added); - } - - #endregion - - #region Test Cases for Update Operation - - [TestMethod] - public void CompanyInfoUpdatedAsyncTestsUsingoAuth() - { - ////Creating the CompanyInfo for Adding - //CompanyInfo companyInfo = QBOHelper.CreateCompanyInfo(qboContextoAuth); - ////Adding the CompanyInfo - //CompanyInfo added = Helper.Add(qboContextoAuth, companyInfo); - - List found = Helper.FindAll(qboContextoAuth, new CompanyInfo()); - - //Change the data of added entity - CompanyInfo changed = QBOHelper.UpdateCompanyInfo(qboContextoAuth, found[0]); - - //Update the returned entity data - CompanyInfo updated = Helper.UpdateAsync(qboContextoAuth, changed);//Verify the updated CompanyInfo - QBOHelper.VerifyCompanyInfo(changed, updated); - } - - #endregion - - #region Test Cases for Delete Operation - - [TestMethod] [Ignore] - public void CompanyInfoDeleteAsyncTestsUsingoAuth() - { - //Creating the CompanyInfo for Adding - CompanyInfo entity = QBOHelper.CreateCompanyInfo(qboContextoAuth); - //Adding the CompanyInfo - CompanyInfo added = Helper.Add(qboContextoAuth, entity); - - Helper.DeleteAsync(qboContextoAuth, added); - } - - #endregion - - #region Test Cases for Void Operation - - [TestMethod] [Ignore] - public void CompanyInfoVoidAsyncTestsUsingoAuth() - { - //Creating the CompanyInfo for Adding - CompanyInfo entity = QBOHelper.CreateCompanyInfo(qboContextoAuth); - //Adding the CompanyInfo - CompanyInfo added = Helper.Add(qboContextoAuth, entity); - - Helper.VoidAsync(qboContextoAuth, added); - } - - #endregion - - #endregion - - #endregion + } } From 2d51f9c2e261211dede864b3f55bcff636c0af06 Mon Sep 17 00:00:00 2001 From: nimish84 Date: Fri, 6 Sep 2019 16:42:07 -0700 Subject: [PATCH 07/18] Updated test --- .../SDKV3Test/Appsettings.json | 1 + .../SDKV3Test/Common/Initializer.cs | 8 ++-- .../SDKV3Test/Intuit.Ipp.Test.csproj | 45 ++++++++++++++++++- 3 files changed, 49 insertions(+), 5 deletions(-) diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json index 2d92d1a..a4ced2b 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json @@ -14,6 +14,7 @@ "RequestLog": { "EnableLogs": "true", "LogDirectory": "C://IdsLogs//" + } }, //not supported -added for backward compatibility diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs index f7b8191..22e0f48 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs @@ -39,7 +39,7 @@ public Initializer(string path) //AuthorizationKeysQBO.tokenFilePath = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()))), "TokenStore.json"); AuthorizationKeysQBO.tokenFilePath = Path.Combine(System.IO.Directory.GetCurrentDirectory(), "TokenStore.json"); - SeriLogger.log.Write(Serilog.Events.LogEventLevel.Verbose, " AuthorizationKeysQBO.tokenFilePath- {}", AuthorizationKeysQBO.tokenFilePath); + SeriLogger.log.Write(Serilog.Events.LogEventLevel.Verbose, " AuthorizationKeysQBO.tokenFilePath- {tokenFilePath}", AuthorizationKeysQBO.tokenFilePath); var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddJsonFile(path, optional: true, reloadOnChange: true) @@ -133,9 +133,9 @@ internal static ServiceContext InitializeQBOServiceContextUsingoAuth() } catch (IdsException ex) { - SeriLogger.log.Write(LogEventLevel.Verbose, ex.InnerException.ToString()); - SeriLogger.log.Write(LogEventLevel.Verbose, ex.ErrorCode); - SeriLogger.log.Write(LogEventLevel.Verbose, ex.InnerExceptions[0].ToString()); + SeriLogger.log.Write(LogEventLevel.Verbose, ex.Message); + //SeriLogger.log.Write(LogEventLevel.Verbose, ex.ErrorCode); + //SeriLogger.log.Write(LogEventLevel.Verbose, ex.InnerExceptions[0].ToString()); if (ex.Message == "Unauthorized-401") { //oauthClient = new OAuth2Client(AuthorizationKeysQBO.clientIdQBO, AuthorizationKeysQBO.clientSecretQBO, AuthorizationKeysQBO.redirectUrl, AuthorizationKeysQBO.appEnvironment); diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj index 73558a8..889b7d0 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj @@ -101,7 +101,6 @@ - @@ -123,6 +122,50 @@ + + + ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netstandard2.0\Intuit.Ipp.Core.dll + + + ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netstandard2.0\Intuit.Ipp.Data.dll + + + ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netstandard2.0\Intuit.Ipp.DataService.dll + + + ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netstandard2.0\Intuit.Ipp.Diagnostics.dll + + + ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netstandard2.0\Intuit.Ipp.EntitlementService.dll + + + ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netstandard2.0\Intuit.Ipp.Exception.dll + + + ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netstandard2.0\Intuit.Ipp.GlobalTaxService.dll + + + ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netcoreapp2.0\Intuit.Ipp.OAuth2PlatformClient.dll + + + ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netstandard2.0\Intuit.Ipp.QueryFilter.dll + + + ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netstandard2.0\Intuit.Ipp.ReportService.dll + + + ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netstandard2.0\Intuit.Ipp.Retry.dll + + + ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netstandard2.0\Intuit.Ipp.Security.dll + + + ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netstandard2.0\Intuit.Ipp.Utility.dll + + + ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netstandard2.0\Intuit.Ipp.WebHooksService.dll + + PreserveNewest From 4205cbcd806388226fe8d95426a456dcc5e6d508 Mon Sep 17 00:00:00 2001 From: nimish84 Date: Fri, 6 Sep 2019 17:02:58 -0700 Subject: [PATCH 08/18] Updated package --- .../SDKV3Test/Intuit.Ipp.Test.csproj | 45 +------------------ 1 file changed, 1 insertion(+), 44 deletions(-) diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj index 889b7d0..bc21161 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Intuit.Ipp.Test.csproj @@ -101,6 +101,7 @@ + @@ -122,50 +123,6 @@ - - - ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netstandard2.0\Intuit.Ipp.Core.dll - - - ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netstandard2.0\Intuit.Ipp.Data.dll - - - ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netstandard2.0\Intuit.Ipp.DataService.dll - - - ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netstandard2.0\Intuit.Ipp.Diagnostics.dll - - - ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netstandard2.0\Intuit.Ipp.EntitlementService.dll - - - ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netstandard2.0\Intuit.Ipp.Exception.dll - - - ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netstandard2.0\Intuit.Ipp.GlobalTaxService.dll - - - ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netcoreapp2.0\Intuit.Ipp.OAuth2PlatformClient.dll - - - ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netstandard2.0\Intuit.Ipp.QueryFilter.dll - - - ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netstandard2.0\Intuit.Ipp.ReportService.dll - - - ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netstandard2.0\Intuit.Ipp.Retry.dll - - - ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netstandard2.0\Intuit.Ipp.Security.dll - - - ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netstandard2.0\Intuit.Ipp.Utility.dll - - - ..\..\..\..\QuickBooks-V3-DotNET-SDK\IPPDotNetDevKitCSV3\Code\artifacts\bin\netstandard2.0\Intuit.Ipp.WebHooksService.dll - - PreserveNewest From df96b3529b692f57ac8644d08775f9eca700d596 Mon Sep 17 00:00:00 2001 From: nimish84 Date: Fri, 6 Sep 2019 17:15:20 -0700 Subject: [PATCH 09/18] Updated test --- .../Intuit.Ipp.Test/SDKV3Test/Appsettings.json | 16 ++++++++-------- .../SDKV3Test/Common/Initializer.cs | 3 ++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json index a4ced2b..b869eb8 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json @@ -1,13 +1,13 @@ { "Oauth2Keys": { - "AccessToken": "eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..lZFeWeWcTyff9lmwUt-qpw.z_bqkq98A2sUdFCnrT9cilFggnRx43RgVjKeG90N7qGdxCoQB5706quio4G7_f7x3MkAv9HFve1hAjCAx8WZjzjdO-5iKzbl8BP43XLMJixQAxeecccr5ed0KYO-49tTnRsdnVxcb2RbRe6JE5XKb6F7PV5KuOv9To0F1KSO1dIiYzy2h53vTiOKLPhaCKjHcmjfH9QPkW_eZBWAjwhsnOlFnnnYAiW0s4XyWxDpLd23m1XPhQ0QBuOfD6RBdGaPv-bzjqKR3x-iN_sZaV68Y8P6AwHW2nAOSJKv83IW7emlxWwyDlQVZ_0Wv2vU-fV25y4AlYI0LYGqlIzZv9z-K0B_ocBRqvEqUi-6_P2m2owpaUsZJcNmBtg_XKXDp6HiowMpHUmvbYszf9fybwo0xV1Ce8Q2iiE5WOJhVzjP8azUKs99_E0oB03hu04kNp2bBkaGT5rFOoyD6f3BwCzKry_GcENj9GG0TBXwpz7maFnIFj5wNaBc8g05e1HfMKUCy1F9zK4d8pVHeYIeqrNeuFSU6UO9ierihBa3GFabNW8gte3DJ6gE4AVYJFD1NmIety2toDomIVqryqvL8OG9BgWmC78J4-O6b6vs6AMins5zD48aBQT3eqOuWSdASMXCqavQ9Y0KW5H1Kn6WlDIqTSLoRmE77VdSaAX3njOg_wM.4IaJvE7pUgUl2wMAq-J3ew", - "RefreshToken": "AB11576534461b5To7cKUMwD7c9J0arypgkbcMx6sv1nVX1mjk", - "RealmId": "123146090856284", - "ClientId": "Q0joY7aqSROhDAspO4JLoH6ChEtpBvYalZIUwQOg3u5cwbVEaL", - "ClientSecret": "aHPShUDVCEg332ggf7pM3ffAkx6LyzcZIBh5muF5", + "AccessToken": "eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..oCvH1lWn5N3z0yLFmnqhtA.UrhxLbVyRqOp5nMWCbJW0MHL-cag_waJIk3mGHS9W5Fx-zyFZm71bP-WSr-n1R_LduNn-HZjvsgdL7jTm6g8mc4VxL2XHXMJVkEqTEmbAUpfMM64M70_1M5xVyi9ex6Q27voAlbQpZXwOvMllzSEAsJZ2w9nwDV14SrHbYz--QERHM_nXWz0xSSRq2bctW7BEjpXBgedb-KwvyfkqYY5untFvtPoNgLGrWmDkfrCJHqHcHF-UokZm2m_-TUS_iFRIPRlpwZ4JmuPfRUa9gqDs3csoL7B84SdFMh5O0ne8m4IXHOeuyK4QFhCLWje0Pb5OamA9u5p-NYgIcUvEkhx3mO_zopOLZb4loA2hmVyby3Ipt1QkVvsQ9mSpVQHV5JsNLdLEu5t7ZwndPKHKAPQFVuG_58k_P1xy1mZNcQ-QpZkJ4CuZKsiyGCUIZ42efloI_1mKYqy0ByoQLr2qLSoiTjv5jDp2jMeo3FghjceDSF47YJazIfD24PlrPcHMYWSLeLi6jlhNX7RP0GoEA-DqVY1h_hu6kRQYps3dTZPUHgak-0E5YRsIr9Crxnaweszlc-HkczJZZZ650FHapl_nsqn-BCwz9wUIqOpAFAU-Bzki0PgV9SzuDrff1Rc4khQBktRqSdxtOPgfE1cghDvYqwJv4LP1H2JnR4qXvMvXPNMW6bN95sJT26gOmq4DmIq.RBXr7kBcGcEkIUOP01FvkA", + "RefreshToken": "AB11576541513yXQj0RvgHGVk9gljNZUsDznC9KycwGbLLRXr9", + "RealmId": "9130346976440766", + "ClientId": "Q0sjtFXKsgWmzaiG20m8UBjUXxDGAtsJsiE3iURLwQTOTN6Uv7", + "ClientSecret": "6snKNjIfexDM3aSnZtHQUJ23KGSvHfV8jK59jLX3", "RedirectUrl": "https://developer.intuit.com/v2/OAuth2Playground/RedirectUrl", - "QBOBaseUrl": "https://sandbox-quickbooks.api.intuit.com/", - "Environment": "sandbox" + "QBOBaseUrl": "https://quickbooks.api.intuit.com/", + "Environment": "production" }, "Logger": { @@ -52,7 +52,7 @@ }, "Service": { "BaseUrl": { - "Qbo": "https://sandbox-quickbooks.api.intuit.com/", //not supported- added for backward compatibility + "Qbo": "https://quickbooks.api.intuit.com/", //not supported- added for backward compatibility "Ips": "", //not supported-added for backward compatibility "OAuthAccessTokenUrl": "", //not supported-added for backward compatibility "UserNameAuthentication": "" diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs index 22e0f48..3896d15 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs @@ -122,7 +122,8 @@ internal static ServiceContext InitializeQBOServiceContextUsingoAuth() reqValidator = new OAuth2RequestValidator(AuthorizationKeysQBO.accessTokenQBO); context = new ServiceContext(AuthorizationKeysQBO.realmIdIAQBO, IntuitServicesType.QBO, reqValidator); - SeriLogger.log.Write(LogEventLevel.Verbose, "Base url from Context"+context.BaseUrl); + + SeriLogger.log.Write(LogEventLevel.Verbose, "Base url from Context" + context.IppConfiguration.BaseUrl.Qbo); context.IppConfiguration.MinorVersion.Qbo = "37"; DataService.DataService service = new DataService.DataService(context); var compinfo= service.FindAll(new CompanyInfo()); From 5b748cba209372a8d069d16be6cc1e8b61b05e9e Mon Sep 17 00:00:00 2001 From: nimish84 Date: Sat, 7 Sep 2019 00:44:41 -0700 Subject: [PATCH 10/18] testing for env variables get --- .../SDKV3Test/Common/Initializer.cs | 40 +++++++++++-------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs index 3896d15..20cec9e 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs @@ -38,7 +38,7 @@ public Initializer(string path) //AuthorizationKeysQBO.tokenFilePath = Path.Combine(Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()))), "TokenStore.json"); - AuthorizationKeysQBO.tokenFilePath = Path.Combine(System.IO.Directory.GetCurrentDirectory(), "TokenStore.json"); + //AuthorizationKeysQBO.tokenFilePath = Path.Combine(System.IO.Directory.GetCurrentDirectory(), "TokenStore.json"); SeriLogger.log.Write(Serilog.Events.LogEventLevel.Verbose, " AuthorizationKeysQBO.tokenFilePath- {tokenFilePath}", AuthorizationKeysQBO.tokenFilePath); var builder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) @@ -46,28 +46,36 @@ public Initializer(string path) .AddEnvironmentVariables() .Build(); - - AuthorizationKeysQBO.accessTokenQBO= builder.GetSection("Oauth2Keys")["AccessToken"]; + + AuthorizationKeysQBO.accessTokenQBO = Environment.GetEnvironmentVariable("INTUIT_ACCESSTOKEN"); + //AuthorizationKeysQBO.accessTokenQBO= builder.GetSection("Oauth2Keys")["AccessToken"]; SeriLogger.log.Write(Serilog.Events.LogEventLevel.Verbose, " AuthorizationKeysQBO.accessTokenQBO- {accessToken}", AuthorizationKeysQBO.accessTokenQBO); + AuthorizationKeysQBO.refreshTokenQBO = Environment.GetEnvironmentVariable("INTUIT_REFRESHTOKEN"); + AuthorizationKeysQBO.clientIdQBO = Environment.GetEnvironmentVariable("INTUIT_CLIENTID"); + AuthorizationKeysQBO.clientSecretQBO = Environment.GetEnvironmentVariable("INTUIT_CLIENTSECRET"); + AuthorizationKeysQBO.realmIdIAQBO = Environment.GetEnvironmentVariable("INTUIT_REALMID"); + AuthorizationKeysQBO.redirectUrl = Environment.GetEnvironmentVariable("REDIRECTURL"); + + - AuthorizationKeysQBO.refreshTokenQBO = builder.GetSection("Oauth2Keys")["RefreshToken"]; - AuthorizationKeysQBO.clientIdQBO = builder.GetSection("Oauth2Keys")["ClientId"]; - AuthorizationKeysQBO.clientSecretQBO = builder.GetSection("Oauth2Keys")["ClientSecret"]; - AuthorizationKeysQBO.realmIdIAQBO = builder.GetSection("Oauth2Keys")["RealmId"]; - AuthorizationKeysQBO.redirectUrl = builder.GetSection("Oauth2Keys")["RedirectUrl"]; + //AuthorizationKeysQBO.refreshTokenQBO = builder.GetSection("Oauth2Keys")["RefreshToken"]; + //AuthorizationKeysQBO.clientIdQBO = builder.GetSection("Oauth2Keys")["ClientId"]; + //AuthorizationKeysQBO.clientSecretQBO = builder.GetSection("Oauth2Keys")["ClientSecret"]; + //AuthorizationKeysQBO.realmIdIAQBO = builder.GetSection("Oauth2Keys")["RealmId"]; + //AuthorizationKeysQBO.redirectUrl = builder.GetSection("Oauth2Keys")["RedirectUrl"]; AuthorizationKeysQBO.qboBaseUrl = builder.GetSection("Oauth2Keys")["QBOBaseUrl"]; SeriLogger.log.Write(Serilog.Events.LogEventLevel.Verbose, " AuthorizationKeysQBO.qboBaseUrl- {qboBaseUrl}", AuthorizationKeysQBO.qboBaseUrl); AuthorizationKeysQBO.appEnvironment = builder.GetSection("Oauth2Keys")["Environment"]; - FileInfo fileinfo = new FileInfo(AuthorizationKeysQBO.tokenFilePath); - string jsonFile = File.ReadAllText(fileinfo.FullName); - var jObj = JObject.Parse(jsonFile); - jObj["Oauth2Keys"]["AccessToken"] = AuthorizationKeysQBO.accessTokenQBO; - jObj["Oauth2Keys"]["RefreshToken"] = AuthorizationKeysQBO.refreshTokenQBO; - - string output = JsonConvert.SerializeObject(jObj, Formatting.Indented); - File.WriteAllText(fileinfo.FullName, output); + //FileInfo fileinfo = new FileInfo(AuthorizationKeysQBO.tokenFilePath); + //string jsonFile = File.ReadAllText(fileinfo.FullName); + //var jObj = JObject.Parse(jsonFile); + //jObj["Oauth2Keys"]["AccessToken"] = AuthorizationKeysQBO.accessTokenQBO; + //jObj["Oauth2Keys"]["RefreshToken"] = AuthorizationKeysQBO.refreshTokenQBO; + + //string output = JsonConvert.SerializeObject(jObj, Formatting.Indented); + //File.WriteAllText(fileinfo.FullName, output); counter++; From 65fc50cb40ae117955564fac5548f44c85e1a6b2 Mon Sep 17 00:00:00 2001 From: nimish84 Date: Sat, 7 Sep 2019 00:56:59 -0700 Subject: [PATCH 11/18] Testing reading env from config- checking serilog statement --- SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json | 2 +- .../Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json index b869eb8..5565887 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json @@ -1,6 +1,6 @@ { "Oauth2Keys": { - "AccessToken": "eyJlbmMiOiJBMTI4Q0JDLUhTMjU2IiwiYWxnIjoiZGlyIn0..oCvH1lWn5N3z0yLFmnqhtA.UrhxLbVyRqOp5nMWCbJW0MHL-cag_waJIk3mGHS9W5Fx-zyFZm71bP-WSr-n1R_LduNn-HZjvsgdL7jTm6g8mc4VxL2XHXMJVkEqTEmbAUpfMM64M70_1M5xVyi9ex6Q27voAlbQpZXwOvMllzSEAsJZ2w9nwDV14SrHbYz--QERHM_nXWz0xSSRq2bctW7BEjpXBgedb-KwvyfkqYY5untFvtPoNgLGrWmDkfrCJHqHcHF-UokZm2m_-TUS_iFRIPRlpwZ4JmuPfRUa9gqDs3csoL7B84SdFMh5O0ne8m4IXHOeuyK4QFhCLWje0Pb5OamA9u5p-NYgIcUvEkhx3mO_zopOLZb4loA2hmVyby3Ipt1QkVvsQ9mSpVQHV5JsNLdLEu5t7ZwndPKHKAPQFVuG_58k_P1xy1mZNcQ-QpZkJ4CuZKsiyGCUIZ42efloI_1mKYqy0ByoQLr2qLSoiTjv5jDp2jMeo3FghjceDSF47YJazIfD24PlrPcHMYWSLeLi6jlhNX7RP0GoEA-DqVY1h_hu6kRQYps3dTZPUHgak-0E5YRsIr9Crxnaweszlc-HkczJZZZ650FHapl_nsqn-BCwz9wUIqOpAFAU-Bzki0PgV9SzuDrff1Rc4khQBktRqSdxtOPgfE1cghDvYqwJv4LP1H2JnR4qXvMvXPNMW6bN95sJT26gOmq4DmIq.RBXr7kBcGcEkIUOP01FvkA", + "AccessToken": "{ACCESSTOKEN}", "RefreshToken": "AB11576541513yXQj0RvgHGVk9gljNZUsDznC9KycwGbLLRXr9", "RealmId": "9130346976440766", "ClientId": "Q0sjtFXKsgWmzaiG20m8UBjUXxDGAtsJsiE3iURLwQTOTN6Uv7", diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs index 20cec9e..81ad91f 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs @@ -46,6 +46,7 @@ public Initializer(string path) .AddEnvironmentVariables() .Build(); + SeriLogger.log.Write(Serilog.Events.LogEventLevel.Verbose, " Read access token from config- {accessToken}", builder.GetSection("Oauth2Keys")["AccessToken"]); AuthorizationKeysQBO.accessTokenQBO = Environment.GetEnvironmentVariable("INTUIT_ACCESSTOKEN"); //AuthorizationKeysQBO.accessTokenQBO= builder.GetSection("Oauth2Keys")["AccessToken"]; From 71d578d57f2db03fa09a9ea501204be4545a1ce4 Mon Sep 17 00:00:00 2001 From: nimish84 Date: Sat, 7 Sep 2019 01:05:20 -0700 Subject: [PATCH 12/18] Removed platform --- .../Services/Platform/PlatformApi.cs | 238 ------------------ 1 file changed, 238 deletions(-) delete mode 100644 SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/Platform/PlatformApi.cs diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/Platform/PlatformApi.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/Platform/PlatformApi.cs deleted file mode 100644 index bd1d8ad..0000000 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/Platform/PlatformApi.cs +++ /dev/null @@ -1,238 +0,0 @@ -using System; -using System.Text; -using System.Collections.Generic; -using System.Linq; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Intuit.Ipp.Core; -using Intuit.Ipp.Data; -using Intuit.Ipp.Security; -using Intuit.Ipp.Exception; -using System.Threading; -using Intuit.Ipp.QueryFilter; - -using System.Collections.ObjectModel; -using Intuit.Ipp.DataService; - -namespace Intuit.Ipp.Test.Services.Platform -{ - [TestClass][Ignore] - public class PlatformApi - { - ServiceContext qboContextOAuth = null; - string ValidAccessToken = "qyprdjjV5yb5YlzBGBo3fOesZ8WG3POL83PFg77UFkrVRat6"; - string ValidAccessTokenSecret = "BhL29aQD7k1HyJyFXWP8HrDzBNnVa8YtuZsxtX4l"; - string ValidConsumerKey = "qyprd68jMGebyWgiNFT411r4KnhmB9"; - string ValidConsumerSecret = "j2QGgFRv5yYMXB5lVXUI0NBPlHAmz0drjANG1KeX"; - - string InvalidAccessToken = "lvprdS0vcMp3lHlNirwpsWrsHnmjh0pLbDpK6WCXGtySTx61"; - string InvalidAccessTokenSecret = "wAhzfEhOCjtWBoza2xAPG2Ey1BV599lLd1y92ytl"; - - string realmIAQBO = "123145693359857"; - - - [TestInitialize] - public void MyTestInitializer() - { - // OAuthRequestValidator oAuthRequestValidatorQbo = new OAuthRequestValidator(ValidAccessToken, ValidAccessTokenSecret,ValidConsumerKey, ValidConsumerSecret); - OAuth2RequestValidator oAuthRequestValidatorQbo = new OAuth2RequestValidator(ValidAccessToken); - qboContextOAuth = new ServiceContext(realmIAQBO, IntuitServicesType.QBO, oAuthRequestValidatorQbo); - } - - - - - #region PlatformDisconnect - - public void PlatformDisconnectValidOauth(String oauthtoken,String oauthtokensecret) - { - //try - //{ - // PlatformService.PlatformService.Disconnect(ValidConsumerKey, ValidConsumerSecret, - // oauthtoken, oauthtokensecret); - //} - //catch (PlatformException pex) - //{ - // Console.WriteLine("PlatformDisconnect throw PlatformException errCode:" + pex.ErrorCode + " errMsg:" + pex.ErrorMessage + " serverTime:" + pex.ServerTime); - // Assert.Fail(); - //} - - //OAuthRequestValidator ioAuthRequestValidatorQbo = new OAuthRequestValidator(oauthtoken, oauthtokensecret, ValidConsumerKey, ValidConsumerSecret); - OAuth2RequestValidator ioAuthRequestValidatorQbo = new OAuth2RequestValidator(ValidAccessToken); - ServiceContext iqboContextOAuth = new ServiceContext(realmIAQBO, IntuitServicesType.QBO, ioAuthRequestValidatorQbo); - Customer customer = QBOHelper.CreateCustomer(iqboContextOAuth); - try - { - Customer added = Helper.Add(iqboContextOAuth, customer); - } - catch (InvalidTokenException e) - { - Assert.AreEqual("Unauthorized-401", e.Message); - return; - } - Assert.Fail(); - } - - - [TestMethod] - public void PlatformDisconnectInvalidOauth() - { - //try - //{ - // PlatformService.PlatformService.Disconnect(ValidConsumerKey, ValidConsumerSecret, - // InvalidAccessToken, InvalidAccessTokenSecret); - //} - //catch (PlatformException pex) - //{ - // Assert.AreEqual("270", pex.ErrorCode); - // Assert.AreEqual("OAuth Token rejected", pex.ErrorMessage); - // Assert.IsNotNull(pex.ServerTime); - // return; - //} - Assert.Fail(); - } - - #endregion - - #region Reconnect - - //Steps to enable this test - // 1. Go to https://appcenter.intuit.com/Playground/OAuth/IA/ generate Access token which expiration date without 30 dats from current date - // 2. Remove Ignore - [TestMethod] - [Ignore] - public void PlatformReconnectValidOauth() - { - //try - //{ - // String oauthtoken = null; ; - // String oauthtokensecret = null; - - // Dictionary oauthTokens = PlatformService.PlatformService.Reconnect(ValidConsumerKey, ValidConsumerSecret, - // "lvprdkyvvpOSwdI8ufHlYb1IpWp8RpjAv8lZ7KK0H9jiVsFo", "gQBx9lR3F4Iwm42ir3n3zxIM75KxI7wuiC5o7oKr"); - // if (oauthTokens.ContainsKey("OAuthToken")) - // { - // oauthtoken = oauthTokens["OAuthToken"]; - // Assert.IsNotNull(oauthtoken); - // } - - // // See whether Dictionary contains this string. - // if (oauthTokens.ContainsKey("OAuthTokenSecret")) - // { - // oauthtokensecret = oauthTokens["OAuthTokenSecret"]; - // Assert.IsNotNull(oauthtokensecret); - // } - // PlatformDisconnectValidOauth(oauthtoken,oauthtokensecret); - //} - //catch (PlatformException pex) - //{ - // Console.WriteLine("PlatformReconnect throw exception. Error Code" +pex.ErrorCode + ", Error Message:"+pex.ErrorMessage); - // Assert.Fail(); - //} - - } - - //Steps To enable this test - // 1. Generate a New Access Token which expiration date more than 30 days from current date - // 2. Remove Ignore - [TestMethod] - [Ignore] - public void PlatformReconnectValidOauth212() - { - //try - //{ - - // Dictionary oauthTokens = PlatformService.PlatformService.Reconnect(ValidConsumerKey, ValidConsumerSecret, - // "lvprdYXHs7Xc95g70D5UFX9mWSShDhepkCWvr95tb19SUIPD", "zdy5xPim4viFTNuBTu0c2IqJCRhJUSXTuNr3fXoR"); - //} - //catch (PlatformException pex) - //{ - // Assert.AreEqual("212", pex.ErrorCode); - // Assert.AreEqual("Token Refresh Window Out of Bounds", pex.ErrorMessage); - // Assert.IsNotNull(pex.ServerTime); - // return; - //} - Assert.Fail(); - - } - - [TestMethod] - public void PlatformReconnectInvalidOauth270() - { - //try - //{ - // PlatformService.PlatformService.Reconnect(ValidConsumerKey, ValidConsumerSecret, - // InvalidAccessToken, InvalidAccessTokenSecret); - //} - //catch (PlatformException pex) - //{ - // Assert.AreEqual("270", pex.ErrorCode); - // Assert.AreEqual("OAuth Token rejected", pex.ErrorMessage); - // Assert.IsNotNull(pex.ServerTime); - // return; - //} - Assert.Fail(); - } - - - #endregion - - #region getCurrentUser - - [TestMethod] - [Ignore] - public void PlatformGetCurrentUserWithValidOauth() - { - //Intuit.Ipp.PlatformService.User myuser=PlatformService.PlatformService.GetCurrentUser(ValidConsumerKey, ValidConsumerSecret, - // ValidAccessToken,ValidAccessTokenSecret); - //Assert.AreEqual("yelena", myuser.FirstName); - //Assert.AreEqual("gartsman", myuser.LastName); - //Assert.AreEqual("yelenastage@intuit.com", myuser.EmailAddress); - //Assert.IsTrue(myuser.IsVerified); - } - - [TestMethod] - public void PlatformGetCurrentUserWithInvalidOauth() - { - //try - //{ - // Intuit.Ipp.PlatformService.User myuser = PlatformService.PlatformService.GetCurrentUser(ValidConsumerKey, ValidConsumerSecret, - // InvalidAccessToken, InvalidAccessTokenSecret); - //} - //catch (PlatformException pex) - //{ - // Assert.AreEqual("22", pex.ErrorCode); - // Assert.AreEqual("This API requires Authorization.", pex.ErrorMessage); - // Assert.IsNotNull(pex.ServerTime); - // return; - //} - Assert.Fail(); - } - - //Change Intuit.Ipp.PlatformService.PlatformConfig.currentUserUrl URL and run this test - [Ignore] - [TestMethod] - public void PlatformGetCurrentUserWithConenctionError() - { - //try - //{ - // Intuit.Ipp.PlatformService.User myuser = PlatformService.PlatformService.GetCurrentUser(ValidConsumerKey, ValidConsumerSecret, - // ValidAccessToken, ValidAccessTokenSecret); - //} - //catch (PlatformException pex) - //{ - // Console.Write(pex.ErrorCode + pex.ErrorMessage); - // Assert.AreEqual("ConnectFailure", pex.ErrorCode); - // Assert.AreEqual("Unable to connect to the remote server", pex.ErrorMessage); - // return; - //} - Assert.Fail(); - } - - - - #endregion - - - - } -} From 80bab89f3272359ad918f0430e3e41bbf953e512 Mon Sep 17 00:00:00 2001 From: nimish84 Date: Sat, 7 Sep 2019 01:07:22 -0700 Subject: [PATCH 13/18] updated log in companyinfo test --- .../Intuit.Ipp.Test/SDKV3Test/Services/QBO/CompanyInfo.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CompanyInfo.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CompanyInfo.cs index 2c490aa..9dfdde7 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CompanyInfo.cs +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Services/QBO/CompanyInfo.cs @@ -39,8 +39,10 @@ public void MyTestInitializer() [TestMethod] public void CompanyInfoFindAllTestUsingoAuth() { + SeriLogger.log.Write(Serilog.Events.LogEventLevel.Verbose, "COmpanyInfo FindAll test started"); + //Making sure that at least one entity is already present - // CompanyInfoAddTestUsingoAuth(); + // CompanyInfoAddTestUsingoAuth(); //Retrieving the Bill using FindAll List companyInfos = Helper.FindAll(qboContextoAuth, new CompanyInfo(), 1, 500); From e0aa6b948f56a03ccede61905a4f6ff37d92ca07 Mon Sep 17 00:00:00 2001 From: nimish84 Date: Sat, 7 Sep 2019 01:13:29 -0700 Subject: [PATCH 14/18] Testing failure --- .../Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs index 81ad91f..22ce067 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs @@ -131,7 +131,7 @@ internal static ServiceContext InitializeQBOServiceContextUsingoAuth() reqValidator = new OAuth2RequestValidator(AuthorizationKeysQBO.accessTokenQBO); context = new ServiceContext(AuthorizationKeysQBO.realmIdIAQBO, IntuitServicesType.QBO, reqValidator); - + context.IppConfiguration.BaseUrl = @"https://sandbox-quickbooks.api.intuit.com/"; SeriLogger.log.Write(LogEventLevel.Verbose, "Base url from Context" + context.IppConfiguration.BaseUrl.Qbo); context.IppConfiguration.MinorVersion.Qbo = "37"; DataService.DataService service = new DataService.DataService(context); From 20afc6f4f41c2a1a559596119b7defae8767f989 Mon Sep 17 00:00:00 2001 From: nimish84 Date: Sat, 7 Sep 2019 01:16:33 -0700 Subject: [PATCH 15/18] updated --- .../Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs index 22ce067..9e7c9ae 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs @@ -131,7 +131,7 @@ internal static ServiceContext InitializeQBOServiceContextUsingoAuth() reqValidator = new OAuth2RequestValidator(AuthorizationKeysQBO.accessTokenQBO); context = new ServiceContext(AuthorizationKeysQBO.realmIdIAQBO, IntuitServicesType.QBO, reqValidator); - context.IppConfiguration.BaseUrl = @"https://sandbox-quickbooks.api.intuit.com/"; + context.IppConfiguration.BaseUrl.Qbo = @"https://sandbox-quickbooks.api.intuit.com/"; SeriLogger.log.Write(LogEventLevel.Verbose, "Base url from Context" + context.IppConfiguration.BaseUrl.Qbo); context.IppConfiguration.MinorVersion.Qbo = "37"; DataService.DataService service = new DataService.DataService(context); From 1813c90edb5af48e8023c8e334fb6442863cfe83 Mon Sep 17 00:00:00 2001 From: nimish84 Date: Sat, 7 Sep 2019 01:20:06 -0700 Subject: [PATCH 16/18] updated --- SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json index 5565887..6c99f9b 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json @@ -1,6 +1,6 @@ { "Oauth2Keys": { - "AccessToken": "{ACCESSTOKEN}", + "AccessToken": "{INTUIT_ACCESSTOKEN}", "RefreshToken": "AB11576541513yXQj0RvgHGVk9gljNZUsDznC9KycwGbLLRXr9", "RealmId": "9130346976440766", "ClientId": "Q0sjtFXKsgWmzaiG20m8UBjUXxDGAtsJsiE3iURLwQTOTN6Uv7", From 7ad2df9f9dcc27e241f505599a722384ec10f909 Mon Sep 17 00:00:00 2001 From: nimish84 Date: Sat, 7 Sep 2019 02:04:46 -0700 Subject: [PATCH 17/18] changes to setenvironmentvar --- .../SDKV3Test/Appsettings.json | 2 +- .../SDKV3Test/Common/Helper.cs | 25 +++++-------------- .../SDKV3Test/Common/Initializer.cs | 24 ++++-------------- 3 files changed, 12 insertions(+), 39 deletions(-) diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json index 6c99f9b..ba00b9c 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Appsettings.json @@ -1,6 +1,6 @@ { "Oauth2Keys": { - "AccessToken": "{INTUIT_ACCESSTOKEN}", + "AccessToken": "", "RefreshToken": "AB11576541513yXQj0RvgHGVk9gljNZUsDznC9KycwGbLLRXr9", "RealmId": "9130346976440766", "ClientId": "Q0sjtFXKsgWmzaiG20m8UBjUXxDGAtsJsiE3iURLwQTOTN6Uv7", diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Helper.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Helper.cs index 42a3951..e4d55c7 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Helper.cs +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Helper.cs @@ -30,37 +30,24 @@ internal static ServiceContext GetNewTokens_ServiceContext() { - FileInfo fileinfo = new FileInfo(AuthorizationKeysQBO.tokenFilePath); - string jsonFile = File.ReadAllText(fileinfo.FullName); - var jObj = JObject.Parse(jsonFile); + var oauth2Client = new OAuth2Client(AuthorizationKeysQBO.clientIdQBO, AuthorizationKeysQBO.clientSecretQBO, AuthorizationKeysQBO.redirectUrl, AuthorizationKeysQBO.appEnvironment); try { var tokenResp = oauth2Client.RefreshTokenAsync(AuthorizationKeysQBO.refreshTokenQBO).Result; - jObj["Oauth2Keys"]["AccessToken"] = tokenResp.AccessToken; - jObj["Oauth2Keys"]["RefreshToken"] = tokenResp.RefreshToken; + Environment.SetEnvironmentVariable("INTUIT_ACCESSTOKEN",tokenResp.AccessToken); + Environment.SetEnvironmentVariable("INTUIT_REFRESHTOKEN", tokenResp.RefreshToken); } catch (IdsException ex) { - if (jObj["Oauth2Keys"]["RefreshToken"] != null) - { - var tokenResp = oauth2Client.RefreshTokenAsync(jObj["Oauth2Keys"]["RefreshToken"].ToString()).Result; - jObj["Oauth2Keys"]["AccessToken"] = tokenResp.AccessToken; - jObj["Oauth2Keys"]["RefreshToken"] = tokenResp.RefreshToken; - } - else - { + throw ex; - } + } - - - string output = JsonConvert.SerializeObject(jObj, Formatting.Indented); - File.WriteAllText(fileinfo.FullName, output); - //tokenDict.Clear(); + var serviceContext = Initializer.InitializeQBOServiceContextUsingoAuth(); return serviceContext; diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs index 9e7c9ae..2c96fa2 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs @@ -48,6 +48,7 @@ public Initializer(string path) SeriLogger.log.Write(Serilog.Events.LogEventLevel.Verbose, " Read access token from config- {accessToken}", builder.GetSection("Oauth2Keys")["AccessToken"]); + //check builder value from appsettings named readenv=true, only then assign environment var AuthorizationKeysQBO.accessTokenQBO = Environment.GetEnvironmentVariable("INTUIT_ACCESSTOKEN"); //AuthorizationKeysQBO.accessTokenQBO= builder.GetSection("Oauth2Keys")["AccessToken"]; SeriLogger.log.Write(Serilog.Events.LogEventLevel.Verbose, " AuthorizationKeysQBO.accessTokenQBO- {accessToken}", AuthorizationKeysQBO.accessTokenQBO); @@ -69,6 +70,7 @@ public Initializer(string path) SeriLogger.log.Write(Serilog.Events.LogEventLevel.Verbose, " AuthorizationKeysQBO.qboBaseUrl- {qboBaseUrl}", AuthorizationKeysQBO.qboBaseUrl); AuthorizationKeysQBO.appEnvironment = builder.GetSection("Oauth2Keys")["Environment"]; + //assign a qbobaseurlprod nn qbobaseurl sandbox in travis env var //FileInfo fileinfo = new FileInfo(AuthorizationKeysQBO.tokenFilePath); //string jsonFile = File.ReadAllText(fileinfo.FullName); //var jObj = JObject.Parse(jsonFile); @@ -102,28 +104,12 @@ internal static ServiceContext InitializeQBOServiceContextUsingoAuth() { - if (counter == 0) - { + //if(tokenDict.Count == 0) Initialize(); SeriLogger.log.Write(Serilog.Events.LogEventLevel.Verbose, "Inside1"); SeriLogger.log.Information("Inside1usingInfolog"); - } - - else - { - SeriLogger.log.Write(Serilog.Events.LogEventLevel.Verbose, "Inside2"); - //Load the second json file - FileInfo fileinfo = new FileInfo(AuthorizationKeysQBO.tokenFilePath); - string jsonFile = File.ReadAllText(fileinfo.FullName); - var jObj = JObject.Parse(jsonFile); - AuthorizationKeysQBO.accessTokenQBO = jObj["Oauth2Keys"]["AccessToken"].ToString(); - AuthorizationKeysQBO.refreshTokenQBO = jObj["Oauth2Keys"]["RefreshToken"].ToString(); - SeriLogger.log.Write(Serilog.Events.LogEventLevel.Verbose, "AuthorizationKeysQBO.accessTokenQBO"+ AuthorizationKeysQBO.accessTokenQBO); - SeriLogger.log.Write(Serilog.Events.LogEventLevel.Verbose, "AuthorizationKeysQBO.refreshTokenQBO" + AuthorizationKeysQBO.refreshTokenQBO); - - } - + ServiceContext context = null; OAuth2RequestValidator reqValidator = null; try @@ -131,7 +117,7 @@ internal static ServiceContext InitializeQBOServiceContextUsingoAuth() reqValidator = new OAuth2RequestValidator(AuthorizationKeysQBO.accessTokenQBO); context = new ServiceContext(AuthorizationKeysQBO.realmIdIAQBO, IntuitServicesType.QBO, reqValidator); - context.IppConfiguration.BaseUrl.Qbo = @"https://sandbox-quickbooks.api.intuit.com/"; + //context.IppConfiguration.BaseUrl.Qbo = @"https://sandbox-quickbooks.api.intuit.com/"; SeriLogger.log.Write(LogEventLevel.Verbose, "Base url from Context" + context.IppConfiguration.BaseUrl.Qbo); context.IppConfiguration.MinorVersion.Qbo = "37"; DataService.DataService service = new DataService.DataService(context); From 854f86d45bf2ba107dfb9b9300f251755c90c2f7 Mon Sep 17 00:00:00 2001 From: nimish84 Date: Sat, 7 Sep 2019 02:09:48 -0700 Subject: [PATCH 18/18] updated redirect url --- .../Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs index 2c96fa2..fca20d4 100644 --- a/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs +++ b/SampleApp_CRUD_.Net/Intuit.Ipp.Test/SDKV3Test/Common/Initializer.cs @@ -56,7 +56,7 @@ public Initializer(string path) AuthorizationKeysQBO.clientIdQBO = Environment.GetEnvironmentVariable("INTUIT_CLIENTID"); AuthorizationKeysQBO.clientSecretQBO = Environment.GetEnvironmentVariable("INTUIT_CLIENTSECRET"); AuthorizationKeysQBO.realmIdIAQBO = Environment.GetEnvironmentVariable("INTUIT_REALMID"); - AuthorizationKeysQBO.redirectUrl = Environment.GetEnvironmentVariable("REDIRECTURL"); + AuthorizationKeysQBO.redirectUrl = Environment.GetEnvironmentVariable("INTUIT_REDIRECTURL");