Пример #1
0
        public void Mass_SettingValue_ShouldStayZero()
        {
            var landscape = Landscape.Create(Size.Create(10, 10));

            landscape.Mass = 42;

            landscape.Mass.Should().Be(0);
        }
Пример #2
0
        public void Acceleration_SettingValue_ShouldStayZero()
        {
            var landscape = Landscape.Create(Size.Create(10, 10));

            landscape.Acceleration = Vector.Create(5, 6);

            landscape.Acceleration.Should().BeEquivalentTo(Vector.Zero);
        }
Пример #3
0
        public void Cords_SettingValue_ShouldStayZero()
        {
            var landscape = Landscape.Create(Size.Create(10, 10));

            landscape.Cords = Vector.Create(5, 6);

            landscape.Cords.Should().BeEquivalentTo(Vector.Zero);
        }
Пример #4
0
        public void IntersectsWith_IntersectingWithLandscape_ShouldThrowArgumentException()
        {
            Action a = () =>
            {
                Landscape.Create(Size.Create(10, 10))
                .IntersectsWith(Landscape.Create(Size.Create(10, 10)));
            };

            a.Should().Throw <ArgumentException>();
        }
Пример #5
0
        public void Create_NormalSize_ShouldReturnEmptyFieldWithRightSize(Size size)
        {
            var sut = Landscape.Create(size);

            sut.Size.Should().BeEquivalentTo(size);
            for (var i = 0; i < size.Height; i++)
            {
                for (var j = 0; j < size.Width; j++)
                {
                    sut.GetCell(i, j).Should().BeEquivalentTo(LandscapeCell.Empty);
                }
            }
        }
Пример #6
0
        public void GetCellSetCell_WorkingWithValues_ShouldReturnRightValues()
        {
            var random            = new Random();
            var landscape         = Landscape.Create(Size.Create(random.Next(10, 100), random.Next(10, 100)));
            var exceptedLandscape = new LandscapeCell[landscape.Size.Height, landscape.Size.Width];

            for (var i = 0; i < landscape.Size.Height; i++)
            {
                for (var j = 0; j < landscape.Size.Width; j++)
                {
                    exceptedLandscape[i, j] = random.Next(1, 2) == 1 ? LandscapeCell.Empty : LandscapeCell.Ground;
                    landscape.SetCell(i, j, exceptedLandscape[i, j]);
                }
            }


            for (var i = 0; i < landscape.Size.Height; i++)
            {
                for (var j = 0; j < landscape.Size.Width; j++)
                {
                    landscape.GetCell(i, j).Should().BeEquivalentTo(exceptedLandscape[i, j]);
                }
            }
        }