Ejemplo n.º 1
0
        public void ThrowException_WhenAskingForAnAmphipodThatIsNotThere()
        {
            var sut       = new AmphipodSorter(SAMPLE_MAP);
            var exception = Assert.Throws <ArgumentException>(() => sut.GetAmphipodAt(0, 0));

            Assert.Equal("No amphipod there", exception.Message);
        }
Ejemplo n.º 2
0
        public void MakeAmphipodMoveNorthThenWestThrice()
        {
            var sut = new AmphipodSorter(SAMPLE_MAP);

            sut.MoveAmphipodFrom(7, 2).To(7, 1).To(6, 1).To(5, 1).To(4, 1);
            Assert.Equal((4, 1, 10, 'B'), sut.GetAmphipodAt(4, 1));
            Assert.Equal(40, sut.TotalCost);
        }
Ejemplo n.º 3
0
        public void MakeAmphipodMoveNorth()
        {
            var sut = new AmphipodSorter(SAMPLE_MAP);

            sut.MoveAmphipodFrom(7, 2).To(7, 1);
            Assert.Equal((7, 1, 10, 'B'), sut.GetAmphipodAt(7, 1));
            Assert.Equal(10, sut.TotalCost);
        }
Ejemplo n.º 4
0
        public void IndividualizeEveryAmphipod()
        {
            var sut = new AmphipodSorter(SAMPLE_MAP);

            Assert.Equal((3, 3, 1, 'A'), sut.GetAmphipodAt(3, 3));
        }