From 855a12090b5f3d1e56e58e81a6f80da0ddd41a7c Mon Sep 17 00:00:00 2001 From: Shubham Tiwari Date: Thu, 9 May 2024 13:52:49 +0530 Subject: [PATCH 01/21] fix: adding TaskRouter Grant --- src/Twilio/JWT/AccessToken/TaskRouterGrant.cs | 67 +++++++++++++++++++ .../Jwt/AccessToken/AccessTokenTest.cs | 35 ++++++++++ 2 files changed, 102 insertions(+) create mode 100644 src/Twilio/JWT/AccessToken/TaskRouterGrant.cs diff --git a/src/Twilio/JWT/AccessToken/TaskRouterGrant.cs b/src/Twilio/JWT/AccessToken/TaskRouterGrant.cs new file mode 100644 index 000000000..fc9376996 --- /dev/null +++ b/src/Twilio/JWT/AccessToken/TaskRouterGrant.cs @@ -0,0 +1,67 @@ +using System.Collections.Generic; + +namespace Twilio.Jwt.AccessToken +{ + /// + /// Grant to use for Twilio TaskRouter + /// + public class TaskRouterGrant : IGrant + { + /// + /// Workspace SID + /// + public string WorkspaceSid { get; set; } + + /// + /// Worker ID + /// + public string WorkerSid { get; set; } + + /// + /// Role SID + /// + public string Role { get; set; } + + /// + /// Get the grant name + /// + /// + /// name of the grant + public string Key + { + get + { + return "task_router"; + } + } + + /// + /// Get the grant payload + /// + /// + /// payload of the grant + public object Payload + { + get + { + var payload = new Dictionary(); + + if (WorkspaceSid != null) + { + payload.Add("workspace_sid", WorkspaceSid); + } + if (WorkerSid != null) + { + payload.Add("worker_sid", WorkerSid); + } + if (Role != null) + { + payload.Add("role", Role); + } + + return payload; + } + } + + } +} diff --git a/test/Twilio.Test/Jwt/AccessToken/AccessTokenTest.cs b/test/Twilio.Test/Jwt/AccessToken/AccessTokenTest.cs index 1311dd5db..43c21d1c4 100644 --- a/test/Twilio.Test/Jwt/AccessToken/AccessTokenTest.cs +++ b/test/Twilio.Test/Jwt/AccessToken/AccessTokenTest.cs @@ -193,6 +193,41 @@ public void TestCreateVoiceGrant() var decodedParams = ToDict(outgoing)["params"]; Assert.AreEqual("bar", ToDict(decodedParams)["foo"]); } + + [Test] + public void TestCreateTaskRouterGrant() + { + var grants = new HashSet + { + { + new TaskRouterGrant + { + WorkspaceSid = "WSxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + WorkerSid = "WKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + Role = "worker" + } + } + }; + var token = new TestToken("AC456", "SK123", Secret, grants: grants).ToJwt(); + Assert.IsNotNull(token); + Assert.IsNotEmpty(token); + + var decoded = new DecodedJwt(token, Secret); + var payload = decoded.Payload; + Assert.IsNotNull(payload); + + Assert.AreEqual("SK123", payload["iss"]); + Assert.AreEqual("AC456", payload["sub"]); + Assert.Greater(Convert.ToInt64(payload["exp"]), BaseJwt.ConvertToUnixTimestamp(DateTime.UtcNow)); + + var decodedGrants = ToDict(payload["grants"]); + Assert.AreEqual(1, decodedGrants.Count); + + var decodedCg = ToDict(decodedGrants["task_router"]); + Assert.AreEqual("WSxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", decodedCg["workspace_sid"]); + Assert.AreEqual("WKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", decodedCg["worker_sid"]); + Assert.AreEqual("worker", decodedCg["role"]); + } [Test] public void TestCreateChatGrant() From ccfef99918684d27da8c8191c8dbe08217b5ac64 Mon Sep 17 00:00:00 2001 From: Shubham Tiwari Date: Thu, 9 May 2024 13:56:30 +0530 Subject: [PATCH 02/21] docs: corrected param name --- src/Twilio/JWT/AccessToken/TaskRouterGrant.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Twilio/JWT/AccessToken/TaskRouterGrant.cs b/src/Twilio/JWT/AccessToken/TaskRouterGrant.cs index fc9376996..95dc55751 100644 --- a/src/Twilio/JWT/AccessToken/TaskRouterGrant.cs +++ b/src/Twilio/JWT/AccessToken/TaskRouterGrant.cs @@ -13,12 +13,12 @@ public class TaskRouterGrant : IGrant public string WorkspaceSid { get; set; } /// - /// Worker ID + /// Worker SID /// public string WorkerSid { get; set; } /// - /// Role SID + /// Role /// public string Role { get; set; } From 3df6eb4f111129503163eb81eb92e2ee893929be Mon Sep 17 00:00:00 2001 From: Shubham Tiwari Date: Thu, 9 May 2024 21:00:40 +0530 Subject: [PATCH 03/21] chore: added test coverage for taskRouter object --- .../Jwt/AccessToken/AccessTokenTest.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/test/Twilio.Test/Jwt/AccessToken/AccessTokenTest.cs b/test/Twilio.Test/Jwt/AccessToken/AccessTokenTest.cs index 43c21d1c4..7df4cb14c 100644 --- a/test/Twilio.Test/Jwt/AccessToken/AccessTokenTest.cs +++ b/test/Twilio.Test/Jwt/AccessToken/AccessTokenTest.cs @@ -194,6 +194,25 @@ public void TestCreateVoiceGrant() Assert.AreEqual("bar", ToDict(decodedParams)["foo"]); } + [Test] + public void TestCheckTaskRouter() + { + var taskRouterGrant = new TaskRouterGrant + { + WorkspaceSid = "WSxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + WorkerSid = "WKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + Role = "worker" + }; + + Assert.IsNotNull(taskRouterGrant); + Assert.AreEqual("task_router", taskRouterGrant.Key); + var taskRouterPayload = (Dictionary)(taskRouterGrant.Payload); + Assert.AreEqual(3, taskRouterPayload.Count); + Assert.AreEqual("WSxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", taskRouterPayload["workspace_sid"]); + Assert.AreEqual("WKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", taskRouterPayload["worker_sid"]); + Assert.AreEqual("worker", taskRouterPayload["role"]); + } + [Test] public void TestCreateTaskRouterGrant() { From 57da1024315e2098ca48cd276de0118ba390adf8 Mon Sep 17 00:00:00 2001 From: Shubham Tiwari Date: Mon, 13 May 2024 17:29:17 +0530 Subject: [PATCH 04/21] chore: replacing sonar.login with sonar.token --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 264a0510a..08bd131f8 100644 --- a/Makefile +++ b/Makefile @@ -37,11 +37,11 @@ docker-push: docker push twilio/twilio-csharp:${CURRENT_TAG} cover: - dotnet sonarscanner begin /k:"$(PROJECT_NAME)" /o:"twilio" /d:sonar.host.url=https://sonarcloud.io /d:sonar.login="${SONAR_TOKEN}" /d:sonar.language="cs" $(SONAR_SOURCES) /d:sonar.cs.opencover.reportsPaths="test/lcov.net451.opencover.xml" + dotnet sonarscanner begin /k:"$(PROJECT_NAME)" /o:"twilio" /d:sonar.host.url=https://sonarcloud.io /d:sonar.token="${SONAR_TOKEN}" /d:sonar.language="cs" $(SONAR_SOURCES) /d:sonar.cs.opencover.reportsPaths="test/lcov.net451.opencover.xml" # Write to a log file since the logs for build with sonar analyzer are pretty beefy and travis has a limit on the number of log lines dotnet build Twilio.sln > buildsonar.log dotnet test test/Twilio.Test/Twilio.Test.csproj --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=../lcov - dotnet sonarscanner end /d:sonar.login="${SONAR_TOKEN}" + dotnet sonarscanner end /d:sonar.token="${SONAR_TOKEN}" cache: directories: From 8f7d67e9e04f5a74a27cc8f6f1d738abf1a56758 Mon Sep 17 00:00:00 2001 From: Shubham Tiwari Date: Tue, 14 May 2024 09:42:10 +0530 Subject: [PATCH 05/21] chore: adding coverlet package --- .github/workflows/test-and-deploy.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml index 9e7fe8114..1a8167840 100644 --- a/.github/workflows/test-and-deploy.yml +++ b/.github/workflows/test-and-deploy.yml @@ -52,6 +52,9 @@ jobs: TWILIO_TO_NUMBER: ${{ secrets.TWILIO_TO_NUMBER }} run: | dotnet tool install --global dotnet-sonarscanner + cd test/Twilio.Test + dotnet add package coverlet.msbuild --version 6.0.2 + cd ../.. make cover deploy: From 5d9f5a2308ecb2bd3fab6366e3552a9e71843008 Mon Sep 17 00:00:00 2001 From: Shubham Tiwari Date: Thu, 16 May 2024 13:02:57 +0530 Subject: [PATCH 06/21] chore: adding msbuild in Test file --- .github/workflows/test-and-deploy.yml | 3 --- test/Twilio.Test/Twilio.Test.csproj | 7 ++++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml index 1a8167840..9e7fe8114 100644 --- a/.github/workflows/test-and-deploy.yml +++ b/.github/workflows/test-and-deploy.yml @@ -52,9 +52,6 @@ jobs: TWILIO_TO_NUMBER: ${{ secrets.TWILIO_TO_NUMBER }} run: | dotnet tool install --global dotnet-sonarscanner - cd test/Twilio.Test - dotnet add package coverlet.msbuild --version 6.0.2 - cd ../.. make cover deploy: diff --git a/test/Twilio.Test/Twilio.Test.csproj b/test/Twilio.Test/Twilio.Test.csproj index 45587db74..f36f9927a 100644 --- a/test/Twilio.Test/Twilio.Test.csproj +++ b/test/Twilio.Test/Twilio.Test.csproj @@ -15,10 +15,15 @@ + + + all + runtime; build; native; contentfiles; analyzers + - + \ No newline at end of file From 146288d9de68391a8cefc220e074afccc3821421 Mon Sep 17 00:00:00 2001 From: Shubham Tiwari Date: Tue, 21 May 2024 19:58:11 +0530 Subject: [PATCH 07/21] chore: corrected reportsPath in sonar --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 08bd131f8..5d1beed7c 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ docker-push: docker push twilio/twilio-csharp:${CURRENT_TAG} cover: - dotnet sonarscanner begin /k:"$(PROJECT_NAME)" /o:"twilio" /d:sonar.host.url=https://sonarcloud.io /d:sonar.token="${SONAR_TOKEN}" /d:sonar.language="cs" $(SONAR_SOURCES) /d:sonar.cs.opencover.reportsPaths="test/lcov.net451.opencover.xml" + dotnet sonarscanner begin /k:"$(PROJECT_NAME)" /o:"twilio" /d:sonar.host.url=https://sonarcloud.io /d:sonar.token="${SONAR_TOKEN}" /d:sonar.language="cs" $(SONAR_SOURCES) /d:sonar.cs.opencover.reportsPaths="test/lcov.opencover.xml" # Write to a log file since the logs for build with sonar analyzer are pretty beefy and travis has a limit on the number of log lines dotnet build Twilio.sln > buildsonar.log dotnet test test/Twilio.Test/Twilio.Test.csproj --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=../lcov From ff14df697701505a90efb023e3b195fe30b46844 Mon Sep 17 00:00:00 2001 From: Shubham Tiwari Date: Tue, 21 May 2024 20:09:31 +0530 Subject: [PATCH 08/21] chore: corrected reportsPath to net462 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5d1beed7c..45e82224e 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ docker-push: docker push twilio/twilio-csharp:${CURRENT_TAG} cover: - dotnet sonarscanner begin /k:"$(PROJECT_NAME)" /o:"twilio" /d:sonar.host.url=https://sonarcloud.io /d:sonar.token="${SONAR_TOKEN}" /d:sonar.language="cs" $(SONAR_SOURCES) /d:sonar.cs.opencover.reportsPaths="test/lcov.opencover.xml" + dotnet sonarscanner begin /k:"$(PROJECT_NAME)" /o:"twilio" /d:sonar.host.url=https://sonarcloud.io /d:sonar.token="${SONAR_TOKEN}" /d:sonar.language="cs" $(SONAR_SOURCES) /d:sonar.cs.opencover.reportsPaths="test/lcov.462.opencover.xml" # Write to a log file since the logs for build with sonar analyzer are pretty beefy and travis has a limit on the number of log lines dotnet build Twilio.sln > buildsonar.log dotnet test test/Twilio.Test/Twilio.Test.csproj --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=../lcov From a28edcc50023a20598de1a6760ed8f2901a203e8 Mon Sep 17 00:00:00 2001 From: Shubham Date: Tue, 21 May 2024 20:14:51 +0530 Subject: [PATCH 09/21] chore: correcting net462 --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 45e82224e..17e823aad 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ docker-push: docker push twilio/twilio-csharp:${CURRENT_TAG} cover: - dotnet sonarscanner begin /k:"$(PROJECT_NAME)" /o:"twilio" /d:sonar.host.url=https://sonarcloud.io /d:sonar.token="${SONAR_TOKEN}" /d:sonar.language="cs" $(SONAR_SOURCES) /d:sonar.cs.opencover.reportsPaths="test/lcov.462.opencover.xml" + dotnet sonarscanner begin /k:"$(PROJECT_NAME)" /o:"twilio" /d:sonar.host.url=https://sonarcloud.io /d:sonar.token="${SONAR_TOKEN}" /d:sonar.language="cs" $(SONAR_SOURCES) /d:sonar.cs.opencover.reportsPaths="test/lcov.net462.opencover.xml" # Write to a log file since the logs for build with sonar analyzer are pretty beefy and travis has a limit on the number of log lines dotnet build Twilio.sln > buildsonar.log dotnet test test/Twilio.Test/Twilio.Test.csproj --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=../lcov From 147875ee104d530e474f3828bd6c4eb844f59087 Mon Sep 17 00:00:00 2001 From: Shubham Date: Tue, 21 May 2024 20:20:51 +0530 Subject: [PATCH 10/21] Update Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 17e823aad..08bd131f8 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ docker-push: docker push twilio/twilio-csharp:${CURRENT_TAG} cover: - dotnet sonarscanner begin /k:"$(PROJECT_NAME)" /o:"twilio" /d:sonar.host.url=https://sonarcloud.io /d:sonar.token="${SONAR_TOKEN}" /d:sonar.language="cs" $(SONAR_SOURCES) /d:sonar.cs.opencover.reportsPaths="test/lcov.net462.opencover.xml" + dotnet sonarscanner begin /k:"$(PROJECT_NAME)" /o:"twilio" /d:sonar.host.url=https://sonarcloud.io /d:sonar.token="${SONAR_TOKEN}" /d:sonar.language="cs" $(SONAR_SOURCES) /d:sonar.cs.opencover.reportsPaths="test/lcov.net451.opencover.xml" # Write to a log file since the logs for build with sonar analyzer are pretty beefy and travis has a limit on the number of log lines dotnet build Twilio.sln > buildsonar.log dotnet test test/Twilio.Test/Twilio.Test.csproj --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=../lcov From 05ff34c47680f7b367631ba423919bfaaaca0567 Mon Sep 17 00:00:00 2001 From: Shubham Tiwari Date: Tue, 21 May 2024 20:35:39 +0530 Subject: [PATCH 11/21] chore: added net462 in test.csproj --- Makefile | 2 +- test/Twilio.Test/Twilio.Test.csproj | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 08bd131f8..17e823aad 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ docker-push: docker push twilio/twilio-csharp:${CURRENT_TAG} cover: - dotnet sonarscanner begin /k:"$(PROJECT_NAME)" /o:"twilio" /d:sonar.host.url=https://sonarcloud.io /d:sonar.token="${SONAR_TOKEN}" /d:sonar.language="cs" $(SONAR_SOURCES) /d:sonar.cs.opencover.reportsPaths="test/lcov.net451.opencover.xml" + dotnet sonarscanner begin /k:"$(PROJECT_NAME)" /o:"twilio" /d:sonar.host.url=https://sonarcloud.io /d:sonar.token="${SONAR_TOKEN}" /d:sonar.language="cs" $(SONAR_SOURCES) /d:sonar.cs.opencover.reportsPaths="test/lcov.net462.opencover.xml" # Write to a log file since the logs for build with sonar analyzer are pretty beefy and travis has a limit on the number of log lines dotnet build Twilio.sln > buildsonar.log dotnet test test/Twilio.Test/Twilio.Test.csproj --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=../lcov diff --git a/test/Twilio.Test/Twilio.Test.csproj b/test/Twilio.Test/Twilio.Test.csproj index f36f9927a..2f9ffb187 100644 --- a/test/Twilio.Test/Twilio.Test.csproj +++ b/test/Twilio.Test/Twilio.Test.csproj @@ -2,7 +2,7 @@ Exe Twilio.Tests - net6.0 + net6.0;net462 enable false $(NoWarn);CS1591 @@ -18,10 +18,13 @@ all - runtime; build; native; contentfiles; analyzers + runtime; build; native; contentfiles; analyzers; buildtransitive - + + + + From d97deaa4f43ec4a00477055395f0507094d8e74c Mon Sep 17 00:00:00 2001 From: Shubham Tiwari Date: Tue, 21 May 2024 20:43:02 +0530 Subject: [PATCH 12/21] chore: removed nullable --- test/Twilio.Test/Twilio.Test.csproj | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/Twilio.Test/Twilio.Test.csproj b/test/Twilio.Test/Twilio.Test.csproj index 2f9ffb187..21a6ee71b 100644 --- a/test/Twilio.Test/Twilio.Test.csproj +++ b/test/Twilio.Test/Twilio.Test.csproj @@ -3,23 +3,20 @@ Exe Twilio.Tests net6.0;net462 - enable false $(NoWarn);CS1591 $(NoWarn);CS1587 CS8765CS1587;CS1591;CS1570;CS1573;CS1572;CS8618;CS8603;CS8625;CS8604;CS8765 - + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - @@ -28,5 +25,8 @@ - + + + + \ No newline at end of file From e564ea9518e7d5c8b4b564374be6d2ac009c480b Mon Sep 17 00:00:00 2001 From: Shubham Tiwari Date: Tue, 21 May 2024 20:52:21 +0530 Subject: [PATCH 13/21] chore: removing net6.0 from test --- test/Twilio.Test/Twilio.Test.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Twilio.Test/Twilio.Test.csproj b/test/Twilio.Test/Twilio.Test.csproj index 21a6ee71b..599db8740 100644 --- a/test/Twilio.Test/Twilio.Test.csproj +++ b/test/Twilio.Test/Twilio.Test.csproj @@ -2,7 +2,7 @@ Exe Twilio.Tests - net6.0;net462 + net462 false $(NoWarn);CS1591 $(NoWarn);CS1587 From c2fb0859c3e6b8b441329a944824959669d3868a Mon Sep 17 00:00:00 2001 From: Shubham Tiwari Date: Tue, 21 May 2024 20:58:15 +0530 Subject: [PATCH 14/21] chore: removing net462 from makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 17e823aad..5d1beed7c 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ docker-push: docker push twilio/twilio-csharp:${CURRENT_TAG} cover: - dotnet sonarscanner begin /k:"$(PROJECT_NAME)" /o:"twilio" /d:sonar.host.url=https://sonarcloud.io /d:sonar.token="${SONAR_TOKEN}" /d:sonar.language="cs" $(SONAR_SOURCES) /d:sonar.cs.opencover.reportsPaths="test/lcov.net462.opencover.xml" + dotnet sonarscanner begin /k:"$(PROJECT_NAME)" /o:"twilio" /d:sonar.host.url=https://sonarcloud.io /d:sonar.token="${SONAR_TOKEN}" /d:sonar.language="cs" $(SONAR_SOURCES) /d:sonar.cs.opencover.reportsPaths="test/lcov.opencover.xml" # Write to a log file since the logs for build with sonar analyzer are pretty beefy and travis has a limit on the number of log lines dotnet build Twilio.sln > buildsonar.log dotnet test test/Twilio.Test/Twilio.Test.csproj --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=../lcov From bf4cc99b6640d36235b044729512ac0da9f4bcf0 Mon Sep 17 00:00:00 2001 From: Shubham Tiwari Date: Tue, 21 May 2024 22:46:52 +0530 Subject: [PATCH 15/21] chore: added net6.0 --- test/Twilio.Test/Twilio.Test.csproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/Twilio.Test/Twilio.Test.csproj b/test/Twilio.Test/Twilio.Test.csproj index 599db8740..1418d0524 100644 --- a/test/Twilio.Test/Twilio.Test.csproj +++ b/test/Twilio.Test/Twilio.Test.csproj @@ -2,7 +2,7 @@ Exe Twilio.Tests - net462 + net462;net6.0 false $(NoWarn);CS1591 $(NoWarn);CS1587 @@ -15,6 +15,7 @@ + From 2fc6fe34fcfca9f539792961b226016020163170 Mon Sep 17 00:00:00 2001 From: Shubham Date: Tue, 21 May 2024 22:47:31 +0530 Subject: [PATCH 16/21] Update Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5d1beed7c..17e823aad 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ docker-push: docker push twilio/twilio-csharp:${CURRENT_TAG} cover: - dotnet sonarscanner begin /k:"$(PROJECT_NAME)" /o:"twilio" /d:sonar.host.url=https://sonarcloud.io /d:sonar.token="${SONAR_TOKEN}" /d:sonar.language="cs" $(SONAR_SOURCES) /d:sonar.cs.opencover.reportsPaths="test/lcov.opencover.xml" + dotnet sonarscanner begin /k:"$(PROJECT_NAME)" /o:"twilio" /d:sonar.host.url=https://sonarcloud.io /d:sonar.token="${SONAR_TOKEN}" /d:sonar.language="cs" $(SONAR_SOURCES) /d:sonar.cs.opencover.reportsPaths="test/lcov.net462.opencover.xml" # Write to a log file since the logs for build with sonar analyzer are pretty beefy and travis has a limit on the number of log lines dotnet build Twilio.sln > buildsonar.log dotnet test test/Twilio.Test/Twilio.Test.csproj --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=../lcov From a01772c819981720e5ddaea1dd71bcaf76451a80 Mon Sep 17 00:00:00 2001 From: Shubham Tiwari Date: Thu, 23 May 2024 11:13:33 +0530 Subject: [PATCH 17/21] chore: adding a test --- test/Twilio.Test/Jwt/AccessToken/AccessTokenTest.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/Twilio.Test/Jwt/AccessToken/AccessTokenTest.cs b/test/Twilio.Test/Jwt/AccessToken/AccessTokenTest.cs index 7df4cb14c..c1c5de1a6 100644 --- a/test/Twilio.Test/Jwt/AccessToken/AccessTokenTest.cs +++ b/test/Twilio.Test/Jwt/AccessToken/AccessTokenTest.cs @@ -193,6 +193,14 @@ public void TestCreateVoiceGrant() var decodedParams = ToDict(outgoing)["params"]; Assert.AreEqual("bar", ToDict(decodedParams)["foo"]); } + + [Test] + public void TestTaskRouterProperties() + { + var taskRouterGrant = new TaskRouterGrant(); + taskRouterGrant.WorkspaceSid = "WSxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; + Assert.AreEqual("WSxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", taskRouterGrant.WorkspaceSid); + } [Test] public void TestCheckTaskRouter() From 3dc6e1cf7c0b592e8fd9f750d995c7cfedb18b7a Mon Sep 17 00:00:00 2001 From: Shubham Tiwari Date: Thu, 23 May 2024 11:30:13 +0530 Subject: [PATCH 18/21] chore: removing net462 --- Makefile | 2 +- test/Twilio.Test/Twilio.Test.csproj | 24 ++++++++++-------------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 17e823aad..5d1beed7c 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ docker-push: docker push twilio/twilio-csharp:${CURRENT_TAG} cover: - dotnet sonarscanner begin /k:"$(PROJECT_NAME)" /o:"twilio" /d:sonar.host.url=https://sonarcloud.io /d:sonar.token="${SONAR_TOKEN}" /d:sonar.language="cs" $(SONAR_SOURCES) /d:sonar.cs.opencover.reportsPaths="test/lcov.net462.opencover.xml" + dotnet sonarscanner begin /k:"$(PROJECT_NAME)" /o:"twilio" /d:sonar.host.url=https://sonarcloud.io /d:sonar.token="${SONAR_TOKEN}" /d:sonar.language="cs" $(SONAR_SOURCES) /d:sonar.cs.opencover.reportsPaths="test/lcov.opencover.xml" # Write to a log file since the logs for build with sonar analyzer are pretty beefy and travis has a limit on the number of log lines dotnet build Twilio.sln > buildsonar.log dotnet test test/Twilio.Test/Twilio.Test.csproj --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=../lcov diff --git a/test/Twilio.Test/Twilio.Test.csproj b/test/Twilio.Test/Twilio.Test.csproj index 1418d0524..f36f9927a 100644 --- a/test/Twilio.Test/Twilio.Test.csproj +++ b/test/Twilio.Test/Twilio.Test.csproj @@ -2,32 +2,28 @@ Exe Twilio.Tests - net462;net6.0 + net6.0 + enable false $(NoWarn);CS1591 $(NoWarn);CS1587 CS8765CS1587;CS1591;CS1570;CS1573;CS1572;CS8618;CS8603;CS8625;CS8604;CS8765 + - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - + + + all + runtime; build; native; contentfiles; analyzers + - - - - + - - - - + \ No newline at end of file From 277c821a5e1fee6d89c1e32bc93eed16195b7bc5 Mon Sep 17 00:00:00 2001 From: Shubham Date: Mon, 27 May 2024 17:49:43 +0530 Subject: [PATCH 19/21] chore: added versbose --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5d1beed7c..76a37ef33 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ docker-push: docker push twilio/twilio-csharp:${CURRENT_TAG} cover: - dotnet sonarscanner begin /k:"$(PROJECT_NAME)" /o:"twilio" /d:sonar.host.url=https://sonarcloud.io /d:sonar.token="${SONAR_TOKEN}" /d:sonar.language="cs" $(SONAR_SOURCES) /d:sonar.cs.opencover.reportsPaths="test/lcov.opencover.xml" + dotnet sonarscanner begin /k:"$(PROJECT_NAME)" /o:"twilio" /d:sonar.host.url=https://sonarcloud.io /d:sonar.token="${SONAR_TOKEN}" /d:sonar.language="cs" $(SONAR_SOURCES) /d:sonar.cs.opencover.reportsPaths="test/lcov.opencover.xml" /d:"sonar.verbose=true" # Write to a log file since the logs for build with sonar analyzer are pretty beefy and travis has a limit on the number of log lines dotnet build Twilio.sln > buildsonar.log dotnet test test/Twilio.Test/Twilio.Test.csproj --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=../lcov From 83cb7bfa87bf18ceb1df354c38cfde14039c7ea7 Mon Sep 17 00:00:00 2001 From: Shubham Date: Mon, 27 May 2024 18:30:03 +0530 Subject: [PATCH 20/21] chore: adding sonarqubetestproject --- test/Twilio.Test/Twilio.Test.csproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/Twilio.Test/Twilio.Test.csproj b/test/Twilio.Test/Twilio.Test.csproj index f36f9927a..e08fb1a2e 100644 --- a/test/Twilio.Test/Twilio.Test.csproj +++ b/test/Twilio.Test/Twilio.Test.csproj @@ -8,6 +8,7 @@ $(NoWarn);CS1591 $(NoWarn);CS1587 CS8765CS1587;CS1591;CS1570;CS1573;CS1572;CS8618;CS8603;CS8625;CS8604;CS8765 + true @@ -26,4 +27,4 @@ - \ No newline at end of file + From 7f0923748d1bb5f181cfdcb85dbbb99ab3098b33 Mon Sep 17 00:00:00 2001 From: Shubham Date: Mon, 27 May 2024 18:34:39 +0530 Subject: [PATCH 21/21] Update Twilio.csproj --- src/Twilio/Twilio.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Twilio/Twilio.csproj b/src/Twilio/Twilio.csproj index 18f8b7726..1f67c8c50 100644 --- a/src/Twilio/Twilio.csproj +++ b/src/Twilio/Twilio.csproj @@ -24,6 +24,7 @@ True 2.1.0 README.md + false