Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
erri120 committed Aug 18, 2020
1 parent 614b71e commit 93f917a
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 1 deletion.
55 changes: 55 additions & 0 deletions Extensions.Test/ExtensionUpdaterTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// /*
// Copyright (C) 2020 erri120
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// */

using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using ExtensionUpdater;
using Xunit;

namespace Extensions.Test
{
public class ExtensionUpdaterTest
{
[Fact]
public async Task TestGetGitHubReleases()
{
List<GitHubRelease> releases = await GitHub.GetGitHubReleases("erri120/Playnite.Extensions");
Assert.NotNull(releases);
Assert.NotEmpty(releases);

var release = releases.First();
Assert.NotNull(release.assets);
Assert.NotEmpty(release.assets);

var asset = release.assets.OrderBy(x => x.size).First();
Assert.NotNull(asset);
Assert.NotNull(asset.name);
Assert.NotNull(asset.browser_download_url);

if(File.Exists(asset.name))
File.Delete(asset.name);

await GitHub.DownloadGitHubReleaseAsset(asset, asset.name);
Assert.True(File.Exists(asset.name));

var fsi = new FileInfo(asset.name);
Assert.Equal(asset.size, fsi.Length);
}
}
}
4 changes: 3 additions & 1 deletion Extensions.Test/Extensions.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2020.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.1" />
<PackageReference Include="PlayniteSDK" Version="5.2.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
<PackageReference Include="coverlet.collector" Version="1.3.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\DLSiteMetadata\DLSiteMetadata.csproj" />
<ProjectReference Include="..\Extensions.Common\Extensions.Common.csproj" />
<ProjectReference Include="..\ExtensionUpdater\ExtensionUpdater.csproj" />
<ProjectReference Include="..\F95ZoneMetadata\F95ZoneMetadata.csproj" />
<ProjectReference Include="..\JastusaMetadata\JastusaMetadata.csproj" />
<ProjectReference Include="..\VNDBMetadata\VNDBMetadata.csproj" />
Expand Down

0 comments on commit 93f917a

Please sign in to comment.