Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Nigusu-Allehu committed Nov 11, 2023
1 parent 64c057e commit 5cd96b1
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public PackageSourceContextInfo(string source, string name, bool isEnabled, int
}

public PackageSourceContextInfo(string source, string name, bool isEnabled, int protocolVersion, bool allowInsecureConnections)
: this(name, source, isEnabled, protocolVersion, allowInsecureConnections, disableTLSCertificateValidation: false)
: this(source, name, isEnabled, protocolVersion, allowInsecureConnections, disableTLSCertificateValidation: false)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public SourceItem(string key, string value, string protocolVersion)
}

public SourceItem(string key, string value, string protocolVersion, string allowInsecureConnections)
: this(key, value, protocolVersion, allowInsecureConnections: "", disableTLSCertificateValidation: "")
: this(key, value, protocolVersion, allowInsecureConnections, disableTLSCertificateValidation: "")
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ public void SourceItem_ParsedSuccessfully()
<add key='nuget3' value='http://serviceIndex.test3/api/index.json' protocolVersion='3' ALLOWInsecureConnections='true' />
<add key='nuget4' value='http://serviceIndex.test4/api/index.json' allowInsecureConnections='true' />
<add key='nuget5' value='http://serviceIndex.test5/api/index.json' allowInsecureConnections='false' protocolVersion='2' />
<add key='nuget6' value='http://serviceIndex.test3/api/index.json' protocolVersion='3' ALLOWInsecureConnections='true' DiSaBleTLSCertificateValidation='true'/>
<add key='nuget7' value='http://serviceIndex.test4/api/index.json' allowInsecureConnections='true' disableTLSCertificateValidation='false'/>
<add key='nuget8' value='http://serviceIndex.test5/api/index.json' allowInsecureConnections='false' protocolVersion='2' disableTLSCertificateValidation='true'/>
<add key='nuget6' value='http://serviceIndex.test6/api/index.json' protocolVersion='3' ALLOWInsecureConnections='true' DiSaBleTLSCertificateValidation='true'/>
<add key='nuget7' value='http://serviceIndex.test7/api/index.json' allowInsecureConnections='true' disableTLSCertificateValidation='false'/>
<add key='nuget8' value='http://serviceIndex.test8/api/index.json' allowInsecureConnections='false' protocolVersion='2' disableTLSCertificateValidation='true'/>
</packageSources>
</configuration>";

Expand All @@ -72,9 +72,9 @@ public void SourceItem_ParsedSuccessfully()
new SourceItem("nuget3","http://serviceIndex.test3/api/index.json", protocolVersion: "3", allowInsecureConnections: "true" ),
new SourceItem("nuget4","http://serviceIndex.test4/api/index.json", protocolVersion: null, allowInsecureConnections: "true" ),
new SourceItem("nuget5","http://serviceIndex.test5/api/index.json", protocolVersion: "2", allowInsecureConnections: "false"),
new SourceItem("nuget6","http://serviceIndex.test3/api/index.json", protocolVersion: "3", allowInsecureConnections: "true", disableTLSCertificateValidation: "true"),
new SourceItem("nuget7","http://serviceIndex.test4/api/index.json", protocolVersion: null, allowInsecureConnections: "true", disableTLSCertificateValidation: "false"),
new SourceItem("nuget8","http://serviceIndex.test5/api/index.json", protocolVersion: "2", allowInsecureConnections: "false", disableTLSCertificateValidation: "true"),
new SourceItem("nuget6","http://serviceIndex.test6/api/index.json", protocolVersion: "3", allowInsecureConnections: "true", disableTLSCertificateValidation: "true"),
new SourceItem("nuget7","http://serviceIndex.test7/api/index.json", protocolVersion: null, allowInsecureConnections: "true", disableTLSCertificateValidation: "false"),
new SourceItem("nuget8","http://serviceIndex.test8/api/index.json", protocolVersion: "2", allowInsecureConnections: "false", disableTLSCertificateValidation: "true"),
};

var nugetConfigPath = "NuGet.Config";
Expand All @@ -92,7 +92,7 @@ public void SourceItem_ParsedSuccessfully()
var children = section.Items.Cast<SourceItem>().ToList();

children.Should().NotBeEmpty();
children.Count.Should().Be(5);
children.Count.Should().Be(8);

for (var i = 0; i < children.Count; i++)
{
Expand All @@ -115,9 +115,9 @@ public void SourceItem_AsXNode_ReturnsExpectedXNode()
new SourceItem("nuget2", "http://serviceIndex.test2/api/index.json", protocolVersion: "2", allowInsecureConnections: "false"),
new SourceItem("nuget3", "http://serviceIndex.test3/api/index.json", protocolVersion: null, allowInsecureConnections: "true"),
new SourceItem("nuget4", "http://serviceIndex.test4/api/index.json", protocolVersion: "3"),
new SourceItem("nuget5", "http://serviceIndex.test1/api/index.json", protocolVersion: "3", allowInsecureConnections: "true", disableTLSCertificateValidation: "false"),
new SourceItem("nuget6", "http://serviceIndex.test2/api/index.json", protocolVersion: "2", allowInsecureConnections: "false", disableTLSCertificateValidation: "false"),
new SourceItem("nuget7", "http://serviceIndex.test3/api/index.json", protocolVersion: null, allowInsecureConnections: "true", disableTLSCertificateValidation: "true")));
new SourceItem("nuget5", "http://serviceIndex.test5/api/index.json", protocolVersion: "3", allowInsecureConnections: "true", disableTLSCertificateValidation: "false"),
new SourceItem("nuget6", "http://serviceIndex.test6/api/index.json", protocolVersion: "2", allowInsecureConnections: "false", disableTLSCertificateValidation: "false"),
new SourceItem("nuget7", "http://serviceIndex.test7/api/index.json", protocolVersion: null, allowInsecureConnections: "true", disableTLSCertificateValidation: "true")));
var resultXml = SettingsTestUtils.RemoveWhitespace(configuration.AsXNode().ToString());

var expectedXNode = new XElement("configuration",
Expand All @@ -142,19 +142,20 @@ public void SourceItem_AsXNode_ReturnsExpectedXNode()
new XAttribute("protocolVersion", "3")),
new XElement("add",
new XAttribute("key", "nuget5"),
new XAttribute("value", "http://serviceIndex.test2/api/index.json"),
new XAttribute("protocolVersion", "2"),
new XAttribute("allowInsecureConnections", "false"),
new XAttribute("value", "http://serviceIndex.test5/api/index.json"),
new XAttribute("protocolVersion", "3"),
new XAttribute("allowInsecureConnections", "true"),
new XAttribute("disableTLSCertificateValidation", "false")),
new XElement("add",
new XAttribute("key", "nuget6"),
new XAttribute("value", "http://serviceIndex.test3/api/index.json"),
new XAttribute("allowInsecureConnections", "true"),
new XAttribute("value", "http://serviceIndex.test6/api/index.json"),
new XAttribute("protocolVersion", "2"),
new XAttribute("allowInsecureConnections", "false"),
new XAttribute("disableTLSCertificateValidation", "false")),
new XElement("add",
new XAttribute("key", "nuget7"),
new XAttribute("value", "http://serviceIndex.test4/api/index.json"),
new XAttribute("protocolVersion", "3"),
new XAttribute("value", "http://serviceIndex.test7/api/index.json"),
new XAttribute("allowInsecureConnections", "true"),
new XAttribute("disableTLSCertificateValidation", "true"))));
var expectedXml = SettingsTestUtils.RemoveWhitespace(expectedXNode.ToString());

Expand Down

0 comments on commit 5cd96b1

Please sign in to comment.