Skip to content

Commit

Permalink
Merge pull request #4 from AndreyTsvetkov/3
Browse files Browse the repository at this point in the history
3
  • Loading branch information
AndreyTsvetkov authored Sep 21, 2016
2 parents 5220321 + b8e6203 commit aa70794
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 2 deletions.
14 changes: 14 additions & 0 deletions src/TS.FastNugetUpdate.Tests/NugetUpdateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,20 @@ public void Apply_ChangesVersionToCorrect()
Assert.IsTrue(File.ReadAllText(packagesFile).Contains("1.3.1.7"));
}

[TestMethod]
public void Apply_ChangesBetaVersionToCorrect()
{
var fileRoot = Environment.CurrentDirectory;

var sut = new NugetUpdate("Functional.Maybe", "1.0.8", Console.Out.WriteLine, Console.Error.WriteLine);

Assert.IsTrue(sut.Apply(fileRoot));
var projectFile = Path.Combine(fileRoot, "demo-with-beta", "demo-with-beta.csproj");
var packagesFile = Path.Combine(fileRoot, "demo-with-beta", "packages.config");
Assert.IsTrue(File.ReadAllText(projectFile).Contains("1.0.8"));
Assert.IsTrue(File.ReadAllText(packagesFile).Contains("1.0.8"));
}


[TestMethod]
public void Apply_RemainsLinesNumberTheSame()
Expand Down
6 changes: 6 additions & 0 deletions src/TS.FastNugetUpdate.Tests/TS.FastNugetUpdate.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,15 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="demo-with-beta\packages.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="demo\packages.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Content Include="demo-with-beta\demo-with-beta.csproj">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="packages\Functional.Maybe.1.0.8\lib\portable-net40+win+MonoAndroid10+xamarinios10+MonoTouch10\Functional.Maybe.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Reference Include="Functional.Maybe, Version=1.0.3.0">
<HintPath>..\packages\Functional.Maybe.1.0.6-beta\lib\portable-net40+win+MonoAndroid10+xamarinios10+MonoTouch10\Functional.Maybe.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions src/TS.FastNugetUpdate.Tests/demo-with-beta/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Functional.Maybe" version="1.0.6-beta" />
</packages>
2 changes: 1 addition & 1 deletion src/TS.FastNugetUpdate/NugetUpdate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private static Func<string, string> FixAssemblyReference(string name, string pac
var reference = new Regex(
$@"<Reference Include=""{RegexEncode(name)}, Version=[^""]+"">");
var hintPath = new Regex(
$@"<HintPath>(?<packageRoot>[\.\w\\]*?packages)\\{RegexEncode(name)}\.\d+\.\d+\.\d+(\.\d+)?\\(?<restPath>[^<]+)</HintPath>");
$@"<HintPath>(?<packageRoot>[\.\w\\]*?packages)\\{RegexEncode(name)}\..*?\\(?<restPath>[^<]+)</HintPath>");

return content =>
{
Expand Down
2 changes: 1 addition & 1 deletion src/TS.FastNugetUpdate/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c74b89d7-2d95-4b05-96a9-2b39ff5569d6")]

[assembly: AssemblyVersion("0.0.1")]
[assembly: AssemblyVersion("0.1.0")]

0 comments on commit aa70794

Please sign in to comment.