Skip to content

Commit

Permalink
fix culture and os
Browse files Browse the repository at this point in the history
  • Loading branch information
byCrookie committed Oct 26, 2023
1 parent 053f190 commit 5a3fb58
Show file tree
Hide file tree
Showing 8 changed files with 90 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Do you want to continue as test? [y/n] (y): y
Logged in as test
Do you want to start a migration? [y/n] (n): n
Found 3 migrations:
- 1 Exported 01.01.2020 00:00:00 (10d)
- 2 Exported 06.01.2020 00:00:00 (5d)
- 3 Exported 10.01.2020 00:00:00 (1d)
Select migrations to download?

> [ ] 2 Exported 06.01.2020 00:00:00 (5d)
[ ] 3 Exported 10.01.2020 00:00:00 (1d)

(Press <space> to toggle a migration, <enter> to accept)Select migrations to download?

[ ] 2 Exported 06.01.2020 00:00:00 (5d)
> [ ] 3 Exported 10.01.2020 00:00:00 (1d)

(Press <space> to toggle a migration, <enter> to accept)Select migrations to download?

[ ] 2 Exported 06.01.2020 00:00:00 (5d)
> [X] 3 Exported 10.01.2020 00:00:00 (1d)

(Press <space> to toggle a migration, <enter> to accept)Where do you want to save the migration files? /test1
The destination directory does not exist. Please enter a valid directory. /test2
Downloading migration 3 to /test2...
Downloaded migration 3 (/test2/test3.zip)
Fetch migration status again? [y/n] (y): n
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Do you want to continue as test? [y/n] (y): y
Logged in as test
Do you want to start a migration? [y/n] (n): n
Found 3 migrations:
- 1 Exported 01.01.2020 00:00:00 (10d)
- 2 Exported 06.01.2020 00:00:00 (5d)
- 3 Exported 10.01.2020 00:00:00 (1d)
Select migrations to download?

> [ ] 2 Exported 06.01.2020 00:00:00 (5d)
[ ] 3 Exported 10.01.2020 00:00:00 (1d)

(Press <space> to toggle a migration, <enter> to accept)Select migrations to download?

[ ] 2 Exported 06.01.2020 00:00:00 (5d)
> [ ] 3 Exported 10.01.2020 00:00:00 (1d)

(Press <space> to toggle a migration, <enter> to accept)Select migrations to download?

[ ] 2 Exported 06.01.2020 00:00:00 (5d)
> [X] 3 Exported 10.01.2020 00:00:00 (1d)

(Press <space> to toggle a migration, <enter> to accept)Where do you want to save the migration files? /test1
The destination directory does not exist. Please enter a valid directory. /test2
Downloading migration 3 to /test2...
Downloaded migration 3 (/test2/test3.zip)
Fetch migration status again? [y/n] (y): n
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.IO.Abstractions;
using System.Globalization;
using System.IO.Abstractions;
using System.IO.Abstractions.TestingHelpers;
using GithubBackup.Cli.Commands.Github.Credentials;
using GithubBackup.Cli.Commands.Github.Login;
Expand All @@ -18,7 +19,6 @@
namespace GithubBackup.Cli.Tests.Commands.Github.Manual;

[UsesVerify]
[DisableParallelization]
public class ManualRunnerTests
{
private readonly TestConsole _ansiConsole = new();
Expand All @@ -34,6 +34,7 @@ public class ManualRunnerTests
public ManualRunnerTests()
{
_ansiConsole.Profile.Capabilities.Interactive = true;
CultureInfo.CurrentCulture = new CultureInfo("de-CH");
}

[Fact]
Expand Down Expand Up @@ -284,7 +285,7 @@ public async Task RunAsync_ValidMigrations_BackupSelected()

_logger.VerifyLogs();

await Verify(_ansiConsole.Output);
await Verify(_ansiConsole.Output).UniqueForOSPlatform();
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using GithubBackup.Cli.Commands.Github.Credentials;
using System.Globalization;
using GithubBackup.Cli.Commands.Github.Credentials;
using GithubBackup.Cli.Commands.Github.Login;
using GithubBackup.Cli.Commands.Github.Migrations;
using GithubBackup.Cli.Commands.Global;
Expand All @@ -21,6 +22,11 @@ public class MigrationsRunnerTests
private readonly ILoginService _loginService = Substitute.For<ILoginService>();
private readonly IDateTimeProvider _dateTimeProvider = Substitute.For<IDateTimeProvider>();

public MigrationsRunnerTests()
{
CultureInfo.CurrentCulture = new CultureInfo("de-CH");
}

[Fact]
public async Task RunAsync_QuietAndNoMigrations_DoNotWriteToConsoleAndReadMigrations()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using FluentAssertions;
using System.Globalization;
using FluentAssertions;
using GithubBackup.TestUtils.Logging;
using Microsoft.Extensions.Logging;
using NSubstitute;
Expand All @@ -7,6 +8,11 @@ namespace GithubBackup.TestUtils.Tests;

public class LoggerExtensionsTests
{
public LoggerExtensionsTests()
{
CultureInfo.CurrentCulture = new CultureInfo("de-CH");
}

[Fact]
public void VerifyLogs_WhenHasLogs_MatchPatterns()
{
Expand Down
17 changes: 17 additions & 0 deletions GithubBackup/GithubBackup.TestUtils/Env/OS.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
namespace GithubBackup.TestUtils.Env;

// ReSharper disable once InconsistentNaming
public static class OS
{
public static string Description()
{
if (OperatingSystem.IsWindows())
return "windows";
if (OperatingSystem.IsLinux())
return "linux";
if (OperatingSystem.IsMacOS())
return "macos";

throw new NotSupportedException("Operating system not supported");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@
<ProjectReference Include="..\GithubBackup.Core\GithubBackup.Core.csproj" />
</ItemGroup>


</Project>

0 comments on commit 5a3fb58

Please sign in to comment.