diff --git a/.gitignore b/.gitignore
index 91df373..dd4699b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,7 +15,10 @@ dotnet/Xrm.Tools.SeverCommonTest/obj
dotnet/Xrm.Tools.WebAPI.NuGet/bin/
dotnet/Xrm.Tools.WebAPI.NuGet/obj
dotnet/Xrm.Tools.WebAPI.NuGet/obj/Debug/**
-dotnet/Xrm.Tools.WebAPI.Core/obj/
+dotnet/Xrm.Tools.WebAPI.Core/obj
+dotnet/Xrm.Tools.WebAPI.Core/bin
+dotnet/Xrm.Tools.WebAPI.Core.Test/obj
+dotnet/Xrm.Tools.WebAPI.Core.Test/bin
.vs
.nuget
diff --git a/dotnet/Xrm.Tools.WebAPI.Core.Test/Xrm.Tools.WebAPI.Core.Test.csproj b/dotnet/Xrm.Tools.WebAPI.Core.Test/Xrm.Tools.WebAPI.Core.Test.csproj
new file mode 100644
index 0000000..611151c
--- /dev/null
+++ b/dotnet/Xrm.Tools.WebAPI.Core.Test/Xrm.Tools.WebAPI.Core.Test.csproj
@@ -0,0 +1,28 @@
+
+
+
+ netcoreapp2.1
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dotnet/Xrm.Tools.WebAPI.Core/Xrm.Tools.WebAPI.Core.csproj b/dotnet/Xrm.Tools.WebAPI.Core/Xrm.Tools.WebAPI.Core.csproj
index cf53318..1f1fcaa 100644
--- a/dotnet/Xrm.Tools.WebAPI.Core/Xrm.Tools.WebAPI.Core.csproj
+++ b/dotnet/Xrm.Tools.WebAPI.Core/Xrm.Tools.WebAPI.Core.csproj
@@ -1,7 +1,7 @@
- netcoreapp1.0
+ netcoreapp2.1
true
xt.snk
Xrm.Tools.WebAPI
@@ -26,7 +26,8 @@
-
+
+
\ No newline at end of file
diff --git a/dotnet/Xrm.Tools.WebAPI.Core/bin/Debug/netcoreapp1.0/Xrm.Tools.WebAPI.deps.json b/dotnet/Xrm.Tools.WebAPI.Core/bin/Debug/netcoreapp1.0/Xrm.Tools.WebAPI.deps.json
index 447c9c8..9d0f868 100644
--- a/dotnet/Xrm.Tools.WebAPI.Core/bin/Debug/netcoreapp1.0/Xrm.Tools.WebAPI.deps.json
+++ b/dotnet/Xrm.Tools.WebAPI.Core/bin/Debug/netcoreapp1.0/Xrm.Tools.WebAPI.deps.json
@@ -51,7 +51,7 @@
"System.Runtime.Serialization.Primitives/4.1.1": {
"type": "package",
"serviceable": true,
- "sha512": "sha512-HZ6Du5QrTG8MNJbf4e4qMO3JRAkIboGT5Fk804uZtg3Gq516S7hAqTm2UZKUHa7/6HUGdVy3AqMQKbns06G/cg==",
+ "sha512": "sha512-uoLAgxKA0qYYdleZTUYCiVykz6S875iBgz0D0Q+OF2Z49MJh6zbKiJ3GZ6nXygdbMLgAuD1Zs0dHWMSRLDrVfA==",
"path": "system.runtime.serialization.primitives/4.1.1",
"hashPath": "system.runtime.serialization.primitives.4.1.1.nupkg.sha512"
}
diff --git a/dotnet/Xrm.Tools.WebAPI.NuGet/NuGet.exe b/dotnet/Xrm.Tools.WebAPI.NuGet/NuGet.exe
index feb104d..4cbab24 100644
Binary files a/dotnet/Xrm.Tools.WebAPI.NuGet/NuGet.exe and b/dotnet/Xrm.Tools.WebAPI.NuGet/NuGet.exe differ
diff --git a/dotnet/Xrm.Tools.WebAPI.NuGet/NuGet.log b/dotnet/Xrm.Tools.WebAPI.NuGet/NuGet.log
index b53d5d1..8fc545c 100644
Binary files a/dotnet/Xrm.Tools.WebAPI.NuGet/NuGet.log and b/dotnet/Xrm.Tools.WebAPI.NuGet/NuGet.log differ
diff --git a/dotnet/Xrm.Tools.WebAPI.NuGet/Package.nuspec b/dotnet/Xrm.Tools.WebAPI.NuGet/Package.nuspec
index 2472f28..c6ba3ae 100644
--- a/dotnet/Xrm.Tools.WebAPI.NuGet/Package.nuspec
+++ b/dotnet/Xrm.Tools.WebAPI.NuGet/Package.nuspec
@@ -51,14 +51,16 @@
-
-
-
+
+
+
+
-
+
+
@@ -66,8 +68,8 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/dotnet/Xrm.Tools.WebAPI.NuGet/Xrm.Tools.CRMWebAPI.1.0.24.nupkg b/dotnet/Xrm.Tools.WebAPI.NuGet/Xrm.Tools.CRMWebAPI.1.0.24.nupkg
index d501cfb..ac13e73 100644
Binary files a/dotnet/Xrm.Tools.WebAPI.NuGet/Xrm.Tools.CRMWebAPI.1.0.24.nupkg and b/dotnet/Xrm.Tools.WebAPI.NuGet/Xrm.Tools.CRMWebAPI.1.0.24.nupkg differ
diff --git a/dotnet/Xrm.Tools.WebAPI.Standard/Xrm.Tools.WebAPI.Standard.csproj b/dotnet/Xrm.Tools.WebAPI.Standard/Xrm.Tools.WebAPI.Standard.csproj
index fc7a072..1f47bb4 100644
--- a/dotnet/Xrm.Tools.WebAPI.Standard/Xrm.Tools.WebAPI.Standard.csproj
+++ b/dotnet/Xrm.Tools.WebAPI.Standard/Xrm.Tools.WebAPI.Standard.csproj
@@ -1,7 +1,7 @@
- netstandard1.4;netstandard2.0
+ netstandard2.0
true
xt.snk
Xrm.Tools.WebAPI
@@ -31,4 +31,10 @@
+
+
+ 5.2.7
+
+
+
\ No newline at end of file
diff --git a/dotnet/Xrm.Tools.WebAPI.Test/ActionTests.cs b/dotnet/Xrm.Tools.WebAPI.Test/ActionTests.cs
index e0defc3..bf5057a 100644
--- a/dotnet/Xrm.Tools.WebAPI.Test/ActionTests.cs
+++ b/dotnet/Xrm.Tools.WebAPI.Test/ActionTests.cs
@@ -10,103 +10,88 @@ namespace Xrm.Tools.WebAPI.Test
public class ActionTests : UnitTestBaseClass
{
[TestMethod]
- public void TestWinOpportunity()
+ public async Task TestWinOpportunity()
{
+ var api = GetAPI();
+
+ dynamic account = new ExpandoObject();
+ account.name = "test " + DateTime.Now.ToString();
+ Guid accountID = await api.Create("accounts", account);
+
+ dynamic contact = new ExpandoObject();
+ contact.firstname = "test " + DateTime.Now.ToString();
+ contact.lastname = "test " + DateTime.Now.ToString();
+ Guid contactID = await api.Create("contacts", contact);
+
+ dynamic opportunity = new ExpandoObject();
+ var oppIndexer = opportunity as IDictionary;
+ opportunity.name = "Test opportunity " + DateTime.Now.ToString();
+ oppIndexer["customerid_account@odata.bind"] = "/accounts(" + accountID.ToString() + ")";
+ oppIndexer["parentcontactid@odata.bind"] = "/contacts(" + contactID.ToString() + ")";
+ Guid oppID = await api.Create("opportunities", opportunity);
+
+ dynamic opportClose = new ExpandoObject();
+ var opportCloseIndexer = opportClose as IDictionary;
+ opportClose.subject = "Won Opportunity";
+ opportCloseIndexer["opportunityid@odata.bind"] = "/opportunities(" + oppID.ToString() + ")";
+ dynamic lostOpportParams = new ExpandoObject();
+ lostOpportParams.Status = 3;
+ lostOpportParams.OpportunityClose = opportClose;
+ await api.ExecuteAction("WinOpportunity", lostOpportParams);
+
+ System.Diagnostics.Trace.WriteLine("finished");
- Task.Run(async () =>
- {
- var api = GetAPI();
-
- dynamic account = new ExpandoObject();
- account.name = "test " + DateTime.Now.ToString();
- Guid accountID = await api.Create("accounts", account);
+ }
+ [TestMethod]
+ public async Task TestLostOpportunity()
+ {
- dynamic contact = new ExpandoObject();
- contact.firstname = "test " + DateTime.Now.ToString();
- contact.lastname = "test " + DateTime.Now.ToString();
- Guid contactID = await api.Create("contacts", contact);
+ var api = GetAPI();
- dynamic opportunity = new ExpandoObject();
- var oppIndexer = opportunity as IDictionary;
- opportunity.name = "Test opportunity " + DateTime.Now.ToString();
- oppIndexer["customerid_account@odata.bind"] = "/accounts(" + accountID.ToString() + ")";
- oppIndexer["parentcontactid@odata.bind"] = "/contacts(" + contactID.ToString() + ")";
- Guid oppID = await api.Create("opportunities", opportunity);
+ dynamic account = new ExpandoObject();
+ account.name = "test " + DateTime.Now.ToString();
+ Guid accountID = await api.Create("accounts", account);
- dynamic opportClose = new ExpandoObject();
- var opportCloseIndexer = opportClose as IDictionary;
- opportClose.subject = "Won Opportunity";
- opportCloseIndexer["opportunityid@odata.bind"] = "/opportunities(" + oppID.ToString() + ")";
- dynamic lostOpportParams = new ExpandoObject();
- lostOpportParams.Status = 3;
- lostOpportParams.OpportunityClose = opportClose;
- await api.ExecuteAction("WinOpportunity", lostOpportParams);
+ dynamic contact = new ExpandoObject();
+ contact.firstname = "test " + DateTime.Now.ToString();
+ contact.lastname = "test " + DateTime.Now.ToString();
+ Guid contactID = await api.Create("contacts", contact);
- System.Diagnostics.Trace.WriteLine("finished");
+ dynamic opportunity = new ExpandoObject();
+ var oppIndexer = opportunity as IDictionary;
+ opportunity.name = "Test opportunity " + DateTime.Now.ToString();
+ oppIndexer["customerid_account@odata.bind"] = "/accounts(" + accountID.ToString() + ")";
+ oppIndexer["parentcontactid@odata.bind"] = "/contacts(" + contactID.ToString() + ")";
+ Guid oppID = await api.Create("opportunities", opportunity);
+ dynamic opportClose = new ExpandoObject();
+ var opportCloseIndexer = opportClose as IDictionary;
+ opportClose.subject = "Lost Opportunity";
+ opportCloseIndexer["opportunityid@odata.bind"] = "/opportunities(" + oppID.ToString() + ")";
+ dynamic lostOpportParams = new ExpandoObject();
+ lostOpportParams.Status = 4;
+ lostOpportParams.OpportunityClose = opportClose;
+ await api.ExecuteAction("LoseOpportunity", lostOpportParams);
- }).Wait();
- }
- [TestMethod]
- public void TestLostOpportunity()
- {
+ System.Diagnostics.Trace.WriteLine("finished");
- Task.Run(async () =>
- {
- var api = GetAPI();
-
- dynamic account = new ExpandoObject();
- account.name = "test " + DateTime.Now.ToString();
- Guid accountID = await api.Create("accounts", account);
-
- dynamic contact = new ExpandoObject();
- contact.firstname = "test " + DateTime.Now.ToString();
- contact.lastname = "test " + DateTime.Now.ToString();
- Guid contactID = await api.Create("contacts", contact);
-
- dynamic opportunity = new ExpandoObject();
- var oppIndexer = opportunity as IDictionary;
- opportunity.name = "Test opportunity " + DateTime.Now.ToString();
- oppIndexer["customerid_account@odata.bind"] = "/accounts(" + accountID.ToString() + ")";
- oppIndexer["parentcontactid@odata.bind"] = "/contacts(" + contactID.ToString() + ")";
- Guid oppID = await api.Create("opportunities", opportunity);
-
- dynamic opportClose = new ExpandoObject();
- var opportCloseIndexer = opportClose as IDictionary;
- opportClose.subject = "Lost Opportunity";
- opportCloseIndexer["opportunityid@odata.bind"] = "/opportunities(" + oppID.ToString() +")";
- dynamic lostOpportParams = new ExpandoObject();
- lostOpportParams.Status = 4;
- lostOpportParams.OpportunityClose = opportClose;
- await api.ExecuteAction("LoseOpportunity", lostOpportParams);
-
- System.Diagnostics.Trace.WriteLine("finished");
-
-
- }).Wait();
}
[TestMethod]
- public void TestCalculateRollup()
+ public async Task TestCalculateRollup()
{
+ var api = GetAPI();
- Task.Run(async () =>
- {
- var api = GetAPI();
-
- dynamic voteCountUpdate = new ExpandoObject();
- voteCountUpdate.Target = new ExpandoObject();
- var ivote = voteCountUpdate.Target as IDictionary;
-
- ivote["@odata.id"] = "ctccrm_ideas(19dc848b-1c5e-e711-8112-e0071b66aea1)";
- voteCountUpdate.FieldName = "ctccrm_votes";
- await api.ExecuteFunction("CalculateRollupField", voteCountUpdate);
-
+ dynamic voteCountUpdate = new ExpandoObject();
+ voteCountUpdate.Target = new ExpandoObject();
+ var ivote = voteCountUpdate.Target as IDictionary;
- System.Diagnostics.Trace.WriteLine("finished");
+ ivote["@odata.id"] = "ctccrm_ideas(19dc848b-1c5e-e711-8112-e0071b66aea1)";
+ voteCountUpdate.FieldName = "ctccrm_votes";
+ await api.ExecuteFunction("CalculateRollupField", voteCountUpdate);
- }).Wait();
+ System.Diagnostics.Trace.WriteLine("finished");
}
}
}
diff --git a/dotnet/Xrm.Tools.WebAPI.Test/BasicCRUDTests.cs b/dotnet/Xrm.Tools.WebAPI.Test/BasicCRUDTests.cs
index 65280ed..e289863 100644
--- a/dotnet/Xrm.Tools.WebAPI.Test/BasicCRUDTests.cs
+++ b/dotnet/Xrm.Tools.WebAPI.Test/BasicCRUDTests.cs
@@ -1,214 +1,173 @@
-using System;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+using System.Collections.Generic;
using System.Dynamic;
+using System.IO;
using System.Threading.Tasks;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using System.Collections.Generic;
using Xrm.Tools.WebAPI.Requests;
-using System.IO;
namespace Xrm.Tools.WebAPI.Test
{
[TestClass]
public class BasicCRUDTests : UnitTestBaseClass
{
-
+
[TestMethod]
- public void TestMethod1()
+ public async Task TestMethod1()
{
+ var api = GetAPI();
- Task.Run(async () =>
- {
- var api = GetAPI();
+ dynamic data = new ExpandoObject();
+ data.name = "test " + DateTime.Now.ToString();
- dynamic data = new ExpandoObject();
- data.name = "test " + DateTime.Now.ToString();
+ Guid createdID = await api.Create("accounts", data);
- Guid createdID = await api.Create("accounts", data);
+ var retrievedObject = await api.Get("accounts", createdID, new CRMGetListOptions() { FormattedValues = true });
- var retrievedObject = await api.Get("accounts", createdID, new CRMGetListOptions() { FormattedValues = true });
+ var retrievedObjectEx = await api.Get("accounts", createdID);
- var retrievedObjectEx = await api.Get("accounts", createdID);
+ dynamic updateObject = new ExpandoObject();
+ updateObject.name = "updated name " + DateTime.Now.ToString();
- dynamic updateObject = new ExpandoObject();
- updateObject.name = "updated name " + DateTime.Now.ToString();
+ var updateResult = await api.Update("accounts", createdID, updateObject);
+ //update with an upsert
+ var upsertResult = await api.Update("accounts", Guid.NewGuid(), updateObject, Upsert: true);
- var updateResult = await api.Update("accounts", createdID, updateObject);
- //update with an upsert
- var upsertResult = await api.Update("accounts", Guid.NewGuid(), updateObject, Upsert: true);
+ await api.Delete("accounts", upsertResult.EntityID);
- await api.Delete("accounts", upsertResult.EntityID);
+ var results = await api.GetList("accounts", new Requests.CRMGetListOptions() { Top = 5, FormattedValues = true });
- var results = await api.GetList("accounts", new Requests.CRMGetListOptions() { Top = 5, FormattedValues=true });
+ string fetchXml = "";
- string fetchXml = "";
+ var fetchResults = await api.GetList("accounts", QueryOptions: new CRMGetListOptions() { FetchXml = fetchXml });
- var fetchResults = await api.GetList("accounts", QueryOptions: new CRMGetListOptions() { FetchXml = fetchXml });
+ var count = await api.GetCount("accounts");
- var count = await api.GetCount("accounts");
-
- List