diff --git a/src/Directory.Build.props b/src/Directory.Build.props index ff906bb..53fdbc0 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,8 +1,8 @@ - 0.0.1 - 0.0.1 : - Initial release + 0.0.2 + 0.0.2 : + Add Bingo time range setting in BingoGame options diff --git a/src/GranDen.Game.ApiLib.Bingo/Options/BingoGameOption.cs b/src/GranDen.Game.ApiLib.Bingo/Options/BingoGameOption.cs index e314366..7088e8a 100644 --- a/src/GranDen.Game.ApiLib.Bingo/Options/BingoGameOption.cs +++ b/src/GranDen.Game.ApiLib.Bingo/Options/BingoGameOption.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace GranDen.Game.ApiLib.Bingo.Options @@ -38,5 +39,15 @@ public class BingoGameSetting /// [Range(1, int.MaxValue)] public int Height { get; set; } + + /// + /// Bingo game start moment + /// + public DateTimeOffset? GameStart { get; set; } + + /// + /// Bingo game end moment + /// + public DateTimeOffset? GameEnd { get; set; } } } diff --git a/test/GranDen.Game.ApiLib.Bingo.Test/BingoPlayerApiTest.cs b/test/GranDen.Game.ApiLib.Bingo.Test/BingoPlayerApiTest.cs index a9229d2..13ad91a 100644 --- a/test/GranDen.Game.ApiLib.Bingo.Test/BingoPlayerApiTest.cs +++ b/test/GranDen.Game.ApiLib.Bingo.Test/BingoPlayerApiTest.cs @@ -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; @@ -176,30 +178,41 @@ public void PlayerCanGetPrizeStatusAfterGameExpired() private void InitConfiguration() { - var inRamDict = new Dictionary - { - {"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() @@ -269,4 +282,4 @@ private static DbConnection CreateInMemoryDatabase() public void Dispose() => _connection.Dispose(); } -} \ No newline at end of file +} diff --git a/test/GranDen.Game.ApiLib.Bingo.Test/GranDen.Game.ApiLib.Bingo.Test.csproj b/test/GranDen.Game.ApiLib.Bingo.Test/GranDen.Game.ApiLib.Bingo.Test.csproj index 181ec99..a3b324a 100644 --- a/test/GranDen.Game.ApiLib.Bingo.Test/GranDen.Game.ApiLib.Bingo.Test.csproj +++ b/test/GranDen.Game.ApiLib.Bingo.Test/GranDen.Game.ApiLib.Bingo.Test.csproj @@ -25,6 +25,7 @@ all +