Skip to content

Commit

Permalink
Ignore case for targetframework input. (#1420)
Browse files Browse the repository at this point in the history
  • Loading branch information
singhsarab authored Feb 6, 2018
1 parent 47a2ef6 commit fe808a2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Microsoft.TestPlatform.ObjectModel/Framework.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,21 @@ public static Framework FromString(string frameworkString)
}
catch
{
switch (frameworkString.Trim())
switch (frameworkString.Trim().ToLower())
{
case "Framework35":
case "framework35":
frameworkName = new FrameworkName(Constants.DotNetFramework35);
break;
case "Framework40":
case "framework40":
frameworkName = new FrameworkName(Constants.DotNetFramework40);
break;
case "Framework45":
case "framework45":
frameworkName = new FrameworkName(Constants.DotNetFramework45);
break;
case "FrameworkCore10":
case "frameworkcore10":
frameworkName = new FrameworkName(Constants.DotNetFrameworkCore10);
break;
case "FrameworkUap10":
case "frameworkuap10":
frameworkName = new FrameworkName(Constants.DotNetFrameworkUap10);
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,25 @@ public void FrameworkFromStringShouldReturnNullForEmptyString()
Assert.IsNull(Framework.FromString(string.Empty));
}

[TestMethod]
public void FrameworkFromStringShouldIgnoreCase()
{
var fx = Framework.FromString("framework35");
Assert.AreEqual(".NETFramework,Version=v3.5", fx.Name);

fx = Framework.FromString("FRAMEWORK40");
Assert.AreEqual(".NETFramework,Version=v4.0", fx.Name);

fx = Framework.FromString("Framework45");
Assert.AreEqual(".NETFramework,Version=v4.5", fx.Name);

fx = Framework.FromString("frameworKcore10");
Assert.AreEqual(".NETCoreApp,Version=v1.0", fx.Name);

fx = Framework.FromString("frameworkUAP10");
Assert.AreEqual("Uap,Version=v10.0", fx.Name);
}

[TestMethod]
public void FrameworkFromStringShouldTrimSpacesAroundFrameworkString()
{
Expand Down

0 comments on commit fe808a2

Please sign in to comment.