diff --git a/NucuCar.Domain/Utilities/ConnectionStringParser.cs b/NucuCar.Domain/Utilities/ConnectionStringParser.cs index f12e1c6..30d5362 100644 --- a/NucuCar.Domain/Utilities/ConnectionStringParser.cs +++ b/NucuCar.Domain/Utilities/ConnectionStringParser.cs @@ -25,8 +25,8 @@ namespace NucuCar.Domain.Utilities var parsedConnectionString = new Dictionary(); foreach (var item in items) { - var keyValue = item.Split("="); - if (keyValue.Length != 2) + var keyValue = item.Split("=", 2); + if (keyValue.Length < 2) { throw new ArgumentException( $"Invalid argument for connection string, expected KEY=VALUE got {item}"); diff --git a/NucuCar.UnitTests/NucuCar.Domain.Tests/Utilities/ConnectionStringParserTest.cs b/NucuCar.UnitTests/NucuCar.Domain.Tests/Utilities/ConnectionStringParserTest.cs index 3fa32bc..93d9989 100644 --- a/NucuCar.UnitTests/NucuCar.Domain.Tests/Utilities/ConnectionStringParserTest.cs +++ b/NucuCar.UnitTests/NucuCar.Domain.Tests/Utilities/ConnectionStringParserTest.cs @@ -46,6 +46,16 @@ namespace NucuCar.UnitTests.NucuCar.Domain.Tests.Utilities }); } + [Fact] + private void Test_ConnectionStringParser_ValueWithMultipleEquals() + { + const string connectionString = "Test=1;Test2=base64="; + var parsedString = ConnectionStringParser.Parse(connectionString); + + Assert.Equal("1", parsedString.GetValueOrDefault("Test")); + Assert.Equal("base64=", parsedString.GetValueOrDefault("Test2")); + } + } } \ No newline at end of file