Skip to content

Commit

Permalink
changes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-knozderko committed Mar 14, 2024
1 parent d26cb75 commit c4015b9
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<SFSessionPropertyAttr>().defaultValue);
var defaultValue = GetDefaultIntSessionProperty(SFSessionProperty.CONNECTION_TIMEOUT);

// act
var value = extractor.ExtractPropertyWithDefaultValue(
Expand All @@ -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<SFSessionPropertyAttr>().defaultValue);
var defaultValue = GetDefaultIntSessionProperty(SFSessionProperty.CONNECTION_TIMEOUT);

// act
var value = extractor.ExtractPropertyWithDefaultValue(
Expand All @@ -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<SFSessionPropertyAttr>().defaultValue);
var defaultValue = GetDefaultIntSessionProperty(SFSessionProperty.CONNECTION_TIMEOUT);

// act
var value = extractor.ExtractPropertyWithDefaultValue(
Expand All @@ -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<SFSessionPropertyAttr>().defaultValue);
var defaultValue = GetDefaultIntSessionProperty(SFSessionProperty.CONNECTION_TIMEOUT);

// act
var value = extractor.ExtractPropertyWithDefaultValue(
Expand Down Expand Up @@ -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<SFSessionPropertyAttr>().defaultValue);
var defaultValue = GetDefaultIntSessionProperty(SFSessionProperty.CONNECTION_TIMEOUT);

// act
var thrown = Assert.Throws<Exception>(() =>
Expand Down Expand Up @@ -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<SFSessionPropertyAttr>().defaultValue);
}
}

0 comments on commit c4015b9

Please sign in to comment.