Esempio n. 1
0
 private static void VerifyTable(ResultSeriesReadModel.Table table, Tuple <int, string, int, string, int> expected)
 {
     Assert.That(table.Score, Is.EqualTo(expected.Item1));
     Assert.NotNull(table.Game1);
     Assert.NotNull(table.Game2);
     Assert.That(table.Game1.Player, Is.EqualTo(expected.Item2));
     Assert.That(table.Game1.Pins, Is.EqualTo(expected.Item3));
     Assert.That(table.Game2.Player, Is.EqualTo(expected.Item4));
     Assert.That(table.Game2.Pins, Is.EqualTo(expected.Item5));
 }
Esempio n. 2
0
    public void Handle(SerieRegistered e, string aggregateId)
    {
        string id = ResultSeriesReadModel.IdFromBitsMatchId(e.BitsMatchId, e.RosterId);
        ResultSeriesReadModel results = DocumentSession.Load <ResultSeriesReadModel>(id);

        MatchSerie       matchSerie = e.MatchSerie;
        HashSet <string> playerIds  = new()
        {
            matchSerie.Table1.Game1.Player,
            matchSerie.Table1.Game2.Player,
            matchSerie.Table2.Game1.Player,
            matchSerie.Table2.Game2.Player,
            matchSerie.Table3.Game1.Player,
            matchSerie.Table3.Game2.Player,
            matchSerie.Table4.Game1.Player,
            matchSerie.Table4.Game2.Player
        };

        Dictionary <string, Player> players = DocumentSession.Load <Player>(playerIds).ToDictionary(x => x.Id);

        ResultSeriesReadModel.Table table1 = CreateTable(players, matchSerie.Table1);
        ResultSeriesReadModel.Table table2 = CreateTable(players, matchSerie.Table2);
        ResultSeriesReadModel.Table table3 = CreateTable(players, matchSerie.Table3);
        ResultSeriesReadModel.Table table4 = CreateTable(players, matchSerie.Table4);

        results.Series.Add(new ResultSeriesReadModel.Serie
        {
            Tables = new List <ResultSeriesReadModel.Table>
            {
                table1,
                table2,
                table3,
                table4
            }
        });
    }