Skip to content

Commit

Permalink
Fix id+version parsing issue for Microsoft.VisualStudio.Shell.15.0 (#347
Browse files Browse the repository at this point in the history
)
  • Loading branch information
skofman1 committed Feb 24, 2018
1 parent c5c255c commit 2e03aaf
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
6 changes: 6 additions & 0 deletions src/Stats.ImportAzureCdnStatistics/packagetranslations.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@
"incorrectpackageversionpattern": "2016.(.*)",
"correctedpackageid": "xrmlibrary.extensionmethods.2016",
"correctedpackageversionpattern": "$1"
},
{
"incorrectpackageid": "Microsoft.VisualStudio.Shell.15",
"incorrectpackageversionpattern": "0.(.*)",
"correctedpackageid": "Microsoft.VisualStudio.Shell.15.0",
"correctedpackageversionpattern": "$1"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,13 @@ public void PackageVersionsAreParsedCorrectly(string packageId, string packageVe
}

[Theory]
[InlineData("donottranslate", "0.1.0", "donottranslate", "0.1.0")]
[InlineData("package4", "0.1.0", "package4.0", "1.0.0")]
[InlineData("package4", "0.2.3.5", "package4.0", "2.3.5")]
[InlineData("package4", "5.1.0", "package4.5", "1.0.0")]
[InlineData("package4", "5.2.3.5", "package4.5", "2.3.5")]
public void TranslatesPackagesCorrectly(string packageId, string packageVersion, string expectedId, string expectedVersion)
[InlineData("donottranslate", "0.1.0")]
[InlineData("package4.0", "1.0.0")]
[InlineData("package4.0", "2.3.5")]
[InlineData("package4.5", "1.0.0")]
[InlineData("package4.5", "2.3.5")]
[InlineData("Microsoft.VisualStudio.Shell.15.0", "15.6.27413")]
public void TranslatesPackagesCorrectly(string packageId, string packageVersion)
{
// Arrange
var logEntry = GetCdnLogEntry($"http://test.me/{packageId}.{packageVersion}.nupkg");
Expand All @@ -49,9 +50,8 @@ public void TranslatesPackagesCorrectly(string packageId, string packageVersion,
var stats = statsParser.FromCdnLogEntry(logEntry);

// Assert
Assert.Equal(expectedId, stats.PackageId);
Assert.Equal(expectedVersion, stats.PackageVersion);

Assert.Equal(packageId, stats.PackageId);
Assert.Equal(packageVersion, stats.PackageVersion);
}

private CdnLogEntry GetCdnLogEntry(string requestUrl)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
"incorrectpackageversionpattern": "5.(.*)",
"correctedpackageid": "package4.5",
"correctedpackageversionpattern": "$1"
},
{
"incorrectpackageid": "Microsoft.VisualStudio.Shell.15",
"incorrectpackageversionpattern": "0.(.*)",
"correctedpackageid": "Microsoft.VisualStudio.Shell.15.0",
"correctedpackageversionpattern": "$1"
}
]
}

0 comments on commit 2e03aaf

Please sign in to comment.