diff --git a/Snowflake.Data.Tests/UnitTests/Session/SessionPropertiesWithDefaultValuesExtractorTest.cs b/Snowflake.Data.Tests/UnitTests/Session/SessionPropertiesWithDefaultValuesExtractorTest.cs index a67642c7d..057a2bfe4 100644 --- a/Snowflake.Data.Tests/UnitTests/Session/SessionPropertiesWithDefaultValuesExtractorTest.cs +++ b/Snowflake.Data.Tests/UnitTests/Session/SessionPropertiesWithDefaultValuesExtractorTest.cs @@ -34,7 +34,7 @@ public void TestReturnDefaultValueWhenValueIsMissing( // arrange var properties = SFSessionProperties.parseConnectionString($"account=test;user=test;password=test", null); var extractor = new SessionPropertiesWithDefaultValuesExtractor(properties, false); - var defaultValue = int.Parse(SFSessionProperty.CONNECTION_TIMEOUT.GetAttribute().defaultValue); + var defaultValue = GetDefaultIntSessionProperty(SFSessionProperty.CONNECTION_TIMEOUT); // act var value = extractor.ExtractPropertyWithDefaultValue( @@ -54,7 +54,7 @@ public void TestReturnDefaultValueWhenPreValidationFails() // arrange var properties = SFSessionProperties.parseConnectionString("account=test;user=test;password=test;connection_timeout=15", null); var extractor = new SessionPropertiesWithDefaultValuesExtractor(properties, false); - var defaultValue = int.Parse(SFSessionProperty.CONNECTION_TIMEOUT.GetAttribute().defaultValue); + var defaultValue = GetDefaultIntSessionProperty(SFSessionProperty.CONNECTION_TIMEOUT); // act var value = extractor.ExtractPropertyWithDefaultValue( @@ -74,7 +74,7 @@ public void TestReturnDefaultValueWhenPostValidationFails() // arrange var properties = SFSessionProperties.parseConnectionString("account=test;user=test;password=test;connection_timeout=15", null); var extractor = new SessionPropertiesWithDefaultValuesExtractor(properties, false); - var defaultValue = int.Parse(SFSessionProperty.CONNECTION_TIMEOUT.GetAttribute().defaultValue); + var defaultValue = GetDefaultIntSessionProperty(SFSessionProperty.CONNECTION_TIMEOUT); // act var value = extractor.ExtractPropertyWithDefaultValue( @@ -94,7 +94,7 @@ public void TestReturnDefaultValueWhenExtractFails() // arrange var properties = SFSessionProperties.parseConnectionString("account=test;user=test;password=test;connection_timeout=15X", null); var extractor = new SessionPropertiesWithDefaultValuesExtractor(properties, false); - var defaultValue = int.Parse(SFSessionProperty.CONNECTION_TIMEOUT.GetAttribute().defaultValue); + var defaultValue = GetDefaultIntSessionProperty(SFSessionProperty.CONNECTION_TIMEOUT); // act var value = extractor.ExtractPropertyWithDefaultValue( @@ -134,7 +134,7 @@ public void TestFailWhenPostValidationFails() // arrange var properties = SFSessionProperties.parseConnectionString("account=test;user=test;password=test;connection_timeout=15", null); var extractor = new SessionPropertiesWithDefaultValuesExtractor(properties, true); - var defaultValue = int.Parse(SFSessionProperty.CONNECTION_TIMEOUT.GetAttribute().defaultValue); + var defaultValue = GetDefaultIntSessionProperty(SFSessionProperty.CONNECTION_TIMEOUT); // act var thrown = Assert.Throws(() => @@ -169,5 +169,7 @@ public void TestFailWhenExtractFails() Assert.That(thrown.Message, Does.Contain("Invalid value of parameter CONNECTION_TIMEOUT")); } + private int GetDefaultIntSessionProperty(SFSessionProperty property) => + int.Parse(SFSessionProperty.CONNECTION_TIMEOUT.GetAttribute().defaultValue); } }