Beispiel #1
0
        public static void TestUseCase(Assert assert)
        {
            assert.Expect(1);

            var list = new[] { new { LastName = "", FirstName = "", } }.Skip(1).ToList();
            list.Add(new
            {
                LastName = "Ruth",
                FirstName = "Babe",
            });
            list.Add(new
            {
                LastName = "Johnson",
                FirstName = "Walter",
            });
            list.Add(new
            {
                LastName = "Cobb",
                FirstName = "Ty",
            });
            list.Add(new
            {
                LastName = "Schmidt",
                FirstName = "Mike",
            });

            var query = from p in list
                        where p.LastName.Length == 4
                        select new
                        {
                            p.LastName,
                            p.FirstName,
                        };

            var s = JSON.Stringify(query.ToList());

            assert.Equal(s, "{\"items\":[{\"lastName\":\"Ruth\",\"firstName\":\"Babe\"},{\"lastName\":\"Cobb\",\"firstName\":\"Ty\"}]}", "#485");
        }
Beispiel #2
0
        private void OutputGameState(Game game)
        {
            Csl.Header(string.Format("Game state {0}, next to move is {1}", game.States.Count, game.GetActivePlayer().Name));

            Csl.StartTable(18, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 10);

            var headers = new[] {"Player"}.Concat(Enumerable.Range(1, 8).Select(x => x.ToString())).Concat(new [] { "Sum" });

            Csl.TableHead(headers.ToArray());

            var white = new[] {game.White.Name}.Concat(game.GetCurrentState().WhiteCells.Select(x => (x is Die) ? ((Die) x).Value.ToString() : "." )).ToList();
            white.Add(game.GetCurrentState().WhiteCells.OfType<Die>().Sum(x => x.Value).ToString());

            Csl.TableRow(white.ToArray());

            var black = new[] { game.Black.Name }.Concat(game.GetCurrentState().BlackCells.Select(x => (x is Die) ? ((Die) x).Value.ToString() : "." )).ToList();
            black.Add(game.GetCurrentState().BlackCells.OfType<Die>().Sum(x => x.Value).ToString());

            Csl.TableRow(black.ToArray());

            Csl.Break(2);
        }