Skip to content

Commit

Permalink
Cater for null values in OptionSetValueCollectionExtensions
Browse files Browse the repository at this point in the history
  • Loading branch information
jordimontana82 committed Mar 23, 2024
1 parent 4d0da5f commit f775595
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public static class OptionSetValueCollectionExtensions
/// <returns></returns>
public static HashSet<int> ConvertToHashSetOfInt(this object input, bool isOptionSetValueCollectionAccepted)
{
if (input == null) return null;

var set = new HashSet<int>();

var faultReason = $"The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ namespace FakeXrmEasy.Core.Tests.Extensions
{
public class OptionSetValueCollectionExtensionsTests
{
[Fact]
public void Should_convert_to_null_if_null()
{
Assert.Null(OptionSetValueCollectionExtensions.ConvertToHashSetOfInt(null, true));
}

[Fact]
public void Should_convert_to_a_hash_of_int_from_an_option_set_value_collection()
{
Expand Down

0 comments on commit f775595

Please sign in to comment.