Ejemplo n.º 1
0
        public void Position_20And5OnA20x5Matrix_Is99()
        {
            var items = new StageItemBuilder().WithWidth(20).WithHeight(5).Build();
            var sut   = new ListMatrix(items, 20, 5);

            Assert.Equal(99, sut.Position(20, 5));
        }
Ejemplo n.º 2
0
        public static IMap Create(IEnumerable <char> mapItems, int width, int height)
        {
            var matrix = new ListMatrix(mapItems, width, height);
            var map    = new Map(matrix);

            return(map);
        }
Ejemplo n.º 3
0
        public void Position_3And2OnA3x2Matrix_Is6()
        {
            var items = new StageItemBuilder().WithWidth(3).WithHeight(2).Build();
            var sut   = new ListMatrix(items, 3, 2);

            Assert.Equal(5, sut.Position(3, 2));
        }
Ejemplo n.º 4
0
        private static ListMatrix ListMatrix10x10()
        {
            var items = new StageItemBuilder().Build();
            var sut   = new ListMatrix(items);

            return(sut);
        }
Ejemplo n.º 5
0
        public void ToString_IsStillAwesome()
        {
            var items  = new StageItemBuilder().WithWidth(20).WithHeight(5).Build();
            var sut    = new ListMatrix(items, 20, 5);
            var result = sut.ToString();

            Assert.NotEmpty(result);
        }
Ejemplo n.º 6
0
        public void ElementAt_EmtpyList_ThrowsArgumentOutOfRangeException()
        {
            var sut = new ListMatrix(new List <char>(), 0, 0);

            Assert.Throws <ArgumentOutOfRangeException>(() => sut.ElementAt(1, 1));
        }
Ejemplo n.º 7
0
 public StageItemBuilder WithStartPosition(int x, int y)
 {
     _startPosition = ListMatrix.Position(x, y, _width, NumberItems);
     return(this);
 }