From 2bb168d691d72822c318afbe5af8e0c6a6354096 Mon Sep 17 00:00:00 2001 From: jericho Date: Sat, 9 Dec 2023 13:23:11 -0500 Subject: [PATCH 1/5] Fix incorrect namespace --- Source/ZoomNet.UnitTests/Models/ChatbotValidateTests.cs | 2 +- Source/ZoomNet.UnitTests/Models/DashboardParticipant.cs | 2 +- Source/ZoomNet.UnitTests/Models/Registrant.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/ZoomNet.UnitTests/Models/ChatbotValidateTests.cs b/Source/ZoomNet.UnitTests/Models/ChatbotValidateTests.cs index 9485e5c8..178829fe 100644 --- a/Source/ZoomNet.UnitTests/Models/ChatbotValidateTests.cs +++ b/Source/ZoomNet.UnitTests/Models/ChatbotValidateTests.cs @@ -3,7 +3,7 @@ using Xunit; using ZoomNet.Models.ChatbotMessage; -namespace ZoomNet.UnitTests.Resources +namespace ZoomNet.UnitTests.Models { public class ChatbotValidateTests { diff --git a/Source/ZoomNet.UnitTests/Models/DashboardParticipant.cs b/Source/ZoomNet.UnitTests/Models/DashboardParticipant.cs index 0805ccc2..d8f8a25f 100644 --- a/Source/ZoomNet.UnitTests/Models/DashboardParticipant.cs +++ b/Source/ZoomNet.UnitTests/Models/DashboardParticipant.cs @@ -4,7 +4,7 @@ using ZoomNet.Json; using ZoomNet.Models; -namespace ZoomNet.UnitTests.Resources +namespace ZoomNet.UnitTests.Models { public class DashboardParticipantTests { diff --git a/Source/ZoomNet.UnitTests/Models/Registrant.cs b/Source/ZoomNet.UnitTests/Models/Registrant.cs index c0881e36..2bb3b97c 100644 --- a/Source/ZoomNet.UnitTests/Models/Registrant.cs +++ b/Source/ZoomNet.UnitTests/Models/Registrant.cs @@ -4,7 +4,7 @@ using ZoomNet.Json; using ZoomNet.Models; -namespace ZoomNet.UnitTests.Resources +namespace ZoomNet.UnitTests.Models { public class RegistrantTests { From 7ad26ac8c608f8d2890cc1ddeaf2a14de318f52c Mon Sep 17 00:00:00 2001 From: jericho Date: Sat, 9 Dec 2023 13:23:33 -0500 Subject: [PATCH 2/5] Formatting --- Source/ZoomNet.UnitTests/Resources/AccountCallLogsTests.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/ZoomNet.UnitTests/Resources/AccountCallLogsTests.cs b/Source/ZoomNet.UnitTests/Resources/AccountCallLogsTests.cs index 254b38f5..3675e8ca 100644 --- a/Source/ZoomNet.UnitTests/Resources/AccountCallLogsTests.cs +++ b/Source/ZoomNet.UnitTests/Resources/AccountCallLogsTests.cs @@ -12,7 +12,8 @@ namespace ZoomNet.UnitTests.Resources { - public class AccountCallLogsTests { + public class AccountCallLogsTests + { #region FIELDS private const string SINGLE_ACCOUNT_CALL_LOGS_JSON = @" @@ -237,7 +238,7 @@ public class AccountCallLogsTests { ] } "; - + #endregion [Fact] From f3b8263982711396e4c0a25cd56b7b228ed843ec Mon Sep 17 00:00:00 2001 From: jericho Date: Sat, 9 Dec 2023 13:31:01 -0500 Subject: [PATCH 3/5] Add assertions to the Parse_json unit test in RegistrantTests.cs to reproduce the problem described in #329 --- Source/ZoomNet.UnitTests/Models/Registrant.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/ZoomNet.UnitTests/Models/Registrant.cs b/Source/ZoomNet.UnitTests/Models/Registrant.cs index 2bb3b97c..414b4361 100644 --- a/Source/ZoomNet.UnitTests/Models/Registrant.cs +++ b/Source/ZoomNet.UnitTests/Models/Registrant.cs @@ -57,6 +57,10 @@ public void Parse_json() result.RoleInPurchaseProcess.ShouldBe(RoleInPurchaseProcess.Influencer); result.State.ShouldBe("CA"); result.Status.ShouldBe(RegistrantStatus.Approved); + result.CustomQuestions.ShouldNotBeNull(); + result.CustomQuestions.Length.ShouldBe(1); + result.CustomQuestions[0].Key.ShouldBe("What do you hope to learn from this Webinar?"); + result.CustomQuestions[0].Value.ShouldStartWith("Look forward to learning"); } } } From 68fd730d8675681c241a8c358fa11b6214a7f1a4 Mon Sep 17 00:00:00 2001 From: jericho Date: Sat, 9 Dec 2023 13:34:47 -0500 Subject: [PATCH 4/5] (GH-329) Custom JSON converter to properly parse the answers to custom questions provided by a meeting registrant --- .../Json/CustomQuestionsAnswersConverter.cs | 16 ++++++++++++++++ Source/ZoomNet/Models/Registrant.cs | 2 ++ 2 files changed, 18 insertions(+) create mode 100644 Source/ZoomNet/Json/CustomQuestionsAnswersConverter.cs diff --git a/Source/ZoomNet/Json/CustomQuestionsAnswersConverter.cs b/Source/ZoomNet/Json/CustomQuestionsAnswersConverter.cs new file mode 100644 index 00000000..8f42c7b7 --- /dev/null +++ b/Source/ZoomNet/Json/CustomQuestionsAnswersConverter.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +namespace ZoomNet.Json +{ + /// + /// Converts an array of to or from JSON. + /// + /// + internal class CustomQuestionsAnswersConverter : KeyValuePairConverter + { + public CustomQuestionsAnswersConverter() + : base("title", "value") + { + } + } +} diff --git a/Source/ZoomNet/Models/Registrant.cs b/Source/ZoomNet/Models/Registrant.cs index 10091bce..159406f1 100644 --- a/Source/ZoomNet/Models/Registrant.cs +++ b/Source/ZoomNet/Models/Registrant.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Text.Json.Serialization; +using ZoomNet.Json; namespace ZoomNet.Models { @@ -118,6 +119,7 @@ public class Registrant /// Gets or sets the custom questions. /// [JsonPropertyName("custom_questions")] + [JsonConverter(typeof(CustomQuestionsAnswersConverter))] public KeyValuePair[] CustomQuestions { get; set; } /// From 0dc8f372508c24ccc0322d92f0d204e310a82479 Mon Sep 17 00:00:00 2001 From: jericho Date: Sat, 9 Dec 2023 13:41:47 -0500 Subject: [PATCH 5/5] Refresh build script --- build.cake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.cake b/build.cake index 9c2d6498..b083390c 100644 --- a/build.cake +++ b/build.cake @@ -1,9 +1,9 @@ // Install tools. #tool dotnet:?package=GitVersion.Tool&version=5.12.0 #tool dotnet:?package=coveralls.net&version=4.0.1 -#tool nuget:?package=GitReleaseManager&version=0.16.0 +#tool nuget:https://f.feedz.io/jericho/jericho/nuget/?package=GitReleaseManager&version=0.17.0-collaborators0003 #tool nuget:?package=ReportGenerator&version=5.2.0 -#tool nuget:?package=xunit.runner.console&version=2.6.2 +#tool nuget:?package=xunit.runner.console&version=2.6.3 #tool nuget:?package=CodecovUploader&version=0.7.1 // Install addins.