Skip to content

Commit

Permalink
Merge pull request #4 from GranDen-Corp/dev
Browse files Browse the repository at this point in the history
Version 0.0.2
  • Loading branch information
windperson authored Jul 3, 2020
2 parents d9e0ba7 + e8b5b83 commit 21b0356
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 27 deletions.
6 changes: 3 additions & 3 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project>
<PropertyGroup>
<Version Condition=" '$(Version)'=='' ">0.0.1</Version>
<PackageReleaseNotes>0.0.1 :
&#xD;&#xA;Initial release
<Version Condition=" '$(Version)'=='' ">0.0.2</Version>
<PackageReleaseNotes>0.0.2 :
&#xD;&#xA;Add Bingo time range setting in BingoGame options
&#xD;&#xA;
</PackageReleaseNotes>
</PropertyGroup>
Expand Down
13 changes: 12 additions & 1 deletion src/GranDen.Game.ApiLib.Bingo/Options/BingoGameOption.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace GranDen.Game.ApiLib.Bingo.Options
Expand Down Expand Up @@ -38,5 +39,15 @@ public class BingoGameSetting
/// </summary>
[Range(1, int.MaxValue)]
public int Height { get; set; }

/// <summary>
/// Bingo game start moment
/// </summary>
public DateTimeOffset? GameStart { get; set; }

/// <summary>
/// Bingo game end moment
/// </summary>
public DateTimeOffset? GameEnd { get; set; }
}
}
59 changes: 36 additions & 23 deletions test/GranDen.Game.ApiLib.Bingo.Test/BingoPlayerApiTest.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.IO;
using System.Linq;
using System.Text;
using GranDen.Game.ApiLib.Bingo.DTO;
using GranDen.Game.ApiLib.Bingo.Repositories.Interfaces;
using GranDen.Game.ApiLib.Bingo.Services.Interfaces;
Expand Down Expand Up @@ -176,30 +178,41 @@ public void PlayerCanGetPrizeStatusAfterGameExpired()

private void InitConfiguration()
{
var inRamDict = new Dictionary<string, string>
{
{"BingoGame:0:GameName", "DemoGame"},
{"BingoGame:0:GameTableKey", "game_1"},
{"BingoGame:0:Width", "4"},
{"BingoGame:0:Height", "4"},

{"GameTable:0:GameTableKey", "game_1"},
{"GameTable:0:PrizeLines:0", "(0, 0), (1, 0), (2, 0), (3, 0) | 'Horizontal Line1'"},
{"GameTable:0:PrizeLines:1", "(0, 1), (1, 1), (2, 1), (3, 1) | 'Horizontal Line2'"},
{"GameTable:0:PrizeLines:2", "(0, 2), (1, 2), (2, 2), (3, 2) | 'Horizontal Line3'"},
{"GameTable:0:PrizeLines:3", "(0, 3), (1, 3), (2, 3), (3, 3) | 'Horizontal Line4'"},


{"GameTable:0:PrizeLines:4", "(0, 0), (0, 1), (0, 2), (0, 3) | 'Vertical Line1'"},
{"GameTable:0:PrizeLines:5", "(1, 0), (1, 1), (1, 2), (1, 3) | 'Vertical Line2'"},
{"GameTable:0:PrizeLines:6", "(2, 0), (2, 1), (2, 2), (2, 3) | 'Vertical Line3'"},
{"GameTable:0:PrizeLines:7", "(3, 0), (3, 1), (3, 2), (3, 3) | 'Vertical Line4'"},

{"GameTable:0:PrizeLines:8", "(0, 0), (1, 1), (2, 2), (3, 3) | 'Diagonal Line1'"},
{"GameTable:0:PrizeLines:9", "(3, 0), (2, 1), (1, 2), (0, 3) | 'Diagonal Line1'"},
};
const string BingoGameJsonStr = @"
{
""BingoGame"" : [
{
""GameName"" : ""DemoGame"",
""GameTableKey"" : ""game_1"",
""Width"" : 4,
""Height"" : 4
}
],
""GameTable"" : [
{
""GameTableKey"" : ""game_1"",
""PrizeLines"" : [
""(0, 0), (1, 0), (2, 0), (3, 0) | 'Horizontal Line1'"",
""(0, 1), (1, 1), (2, 1), (3, 1) | 'Horizontal Line2'"",
""(0, 2), (1, 2), (2, 2), (3, 2) | 'Horizontal Line3'"",
""(0, 3), (1, 3), (2, 3), (3, 3) | 'Horizontal Line4'"",
""(0, 0), (0, 1), (0, 2), (0, 3) | 'Vertical Line1'"",
""(1, 0), (1, 1), (1, 2), (1, 3) | 'Vertical Line2'"",
""(2, 0), (2, 1), (2, 2), (2, 3) | 'Vertical Line3'"",
""(3, 0), (3, 1), (3, 2), (3, 3) | 'Vertical Line4'"",
""(0, 0), (1, 1), (2, 2), (3, 3) | 'Diagonal Line1'"",
""(3, 0), (2, 1), (1, 2), (0, 3) | 'Diagonal Line2'""
]
}
]
}
";

_configuration = new ConfigurationBuilder().AddInMemoryCollection(inRamDict).Build();
using var ms = new MemoryStream(Encoding.UTF8.GetBytes(BingoGameJsonStr));
_configuration = new ConfigurationBuilder().AddJsonStream(ms).Build();
}

private void InitServices()
Expand Down Expand Up @@ -269,4 +282,4 @@ private static DbConnection CreateInMemoryDatabase()

public void Dispose() => _connection.Dispose();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.5" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.5" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.2">
Expand Down

0 comments on commit 21b0356

Please sign in to comment.