Пример #1
0
            public void Builder_Without_Path_Should_Throw_IndexOutOfRangeException()
            {
                var model       = new Builder();
                var pathHistory = new PathHistory(model);

                Assert.Throws <IndexOutOfRangeException>(() => pathHistory.GetOld());
            }
Пример #2
0
            public void Builder_With_Multiple_Steps(int skipOldStepCount)
            {
                var model       = new Builder();
                var pathHistory = new PathHistory(model);

                model.Path.Increase(new Pillar(0, 0));
                model.Path.Increase(new Pillar(2, 1));
                model.Path.Increase(new Pillar(4, 2));
                model.Path.Increase(new Pillar(6, 3));
                model.Path.Increase(new Pillar(8, 4));

                for (int i = 0; i < skipOldStepCount; i++)
                {
                    pathHistory.GetOld();
                }

                var actual = pathHistory.GetOld();

                Assert.That(actual.X, Is.EqualTo(skipOldStepCount * 2), "pillar.X");
                Assert.That(actual.Y, Is.EqualTo(skipOldStepCount), "pillar.Y");
            }
Пример #3
0
            public void Builder_With_One_Step_Should_Return_The_First_Step()
            {
                var model       = new Builder();
                var pathHistory = new PathHistory(model);

                model.Path.Increase(new Pillar(3, 10));

                var actual = pathHistory.GetOld();

                Assert.That(actual.X, Is.EqualTo(3), "pillar.X");
                Assert.That(actual.Y, Is.EqualTo(10), "pillar.Y");
            }