Skip to content

Commit

Permalink
Merge pull request #6 from leafbird/dev
Browse files Browse the repository at this point in the history
test 실패 수정. 테스트용 cofig 설정 처리 추가.
  • Loading branch information
leafbird authored Nov 13, 2023
2 parents 7dbd05f + d0d6efa commit af85309
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
11 changes: 10 additions & 1 deletion GameRank.Core/Configs/GameRankConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

public sealed class GameRankConfig
{
public static GameRankConfig Instance { get; private set; } = null!;
public static GameRankConfig Instance { get; private set; } = new();

public string StoragePath { get; init; } = string.Empty;
public bool CreateLatestFile { get; init; }

Check warning on line 11 in GameRank.Core/Configs/GameRankConfig.cs

View workflow job for this annotation

GitHub Actions / build

Expand All @@ -30,4 +30,13 @@ public static bool TryLoad(string[] args, [MaybeNullWhen(false)] out GameRankCon
Instance = config;
return true;
}

Check warning on line 33 in GameRank.Core/Configs/GameRankConfig.cs

View workflow job for this annotation

GitHub Actions / build

public static void SetForTest()
{
Instance = new GameRankConfig
{
StoragePath = Path.Combine(Path.GetTempPath(), "GameRank"),
CreateLatestFile = true,
};
}
}
6 changes: 5 additions & 1 deletion GameRank.Test/Tests/TestFileStorage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ public class FileStorageTests
[TestInitialize]
public void Initialize()
{
this.testPath = Path.Combine(Path.GetTempPath(), "FileStorageTests");
GameRankConfig.SetForTest();
this.testPath = GameRankConfig.Instance.StoragePath;

if (Directory.Exists(this.testPath))
{
Directory.Delete(this.testPath, true);
Expand Down Expand Up @@ -49,6 +51,8 @@ public void 폴더_생성_테스트()
[TestMethod]
public void 저장내용_JSON_확인()
{
var config = GameRankConfig.Instance;

// Arrange
var storage = new FileStorage(this.testPath);
var rankData = new DailyRankData
Expand Down

0 comments on commit af85309

Please sign in to comment.