コード例 #1
0
        public void Repeat_Concat_IsConcatRepeated()
        {
            // arrange
            var numbers  = Enumerable.Range(1, 5).Select(x => x.ToString());
            var expected = new[] { "12345", "12345", "12345" };

            // act
            var result = EnumerablePrelude.Repeat(() => string.Concat(numbers), 3);

            // assert
            CollectionAssert.AreEqual(expected, result.ToArray());
        }
コード例 #2
0
        public void Ticks_OneAlive_100Generations_AllDead()
        {
            // arrange
            var worldGenerator = new StandardWorldGenerator();
            var cellGrid       = new StandardCellGrid
                                 (
                new[]
            {
                new[] { Dead(), Dead(), Dead() },
                new[] { Dead(), Alive(), Dead() },
                new[] { Dead(), Dead(), Dead() }
            }
                                 );
            var world = new StandardWorldBuilder().With(w => w.Data, new StandardWorldData {
                Grid = cellGrid
            }).Create();
            var expected = new StandardCellGrid(EnumerablePrelude.Repeat(() => EnumerablePrelude.Repeat(Dead, 3).ToArray(), 3).ToArray());

            // act
            var result = worldGenerator.Ticks(world).Skip(100).First().Data.Grid;

            // assert
            Assert.AreEqual(GridToString(expected), GridToString(result));
        }