コード例 #1
0
        public void ReadAllCommand_text_sequence_input_should_return_CleanningSession()
        {
            CommandReader SUT = new CommandReader(_mockView.Object);

            _mockView.SetupSequence(x => x.ReadLine()).Returns("4")
            .Returns("-100 -101")
            .Returns("N 100")
            .Returns("E 1000")
            .Returns("S 500")
            .Returns("W 10");
            CleanningSession result = SUT.ReadAllCommands();

            Assert.AreEqual(-100, result.StartingCoordinate.X);
            Assert.AreEqual(-101, result.StartingCoordinate.Y);
            Assert.AreEqual(4, result.Commands.Count);

            Assert.AreEqual(Direction.N, result.Commands[0].Direction);
            Assert.AreEqual(100, result.Commands[0].Steps);

            Assert.AreEqual(Direction.E, result.Commands[1].Direction);
            Assert.AreEqual(1000, result.Commands[1].Steps);

            Assert.AreEqual(Direction.S, result.Commands[2].Direction);
            Assert.AreEqual(500, result.Commands[2].Steps);

            Assert.AreEqual(Direction.W, result.Commands[3].Direction);
            Assert.AreEqual(10, result.Commands[3].Steps);
        }
コード例 #2
0
ファイル: EntriesTest.cs プロジェクト: tcoelho80/RobotCleaner
        public void ReadAllCommand_text_sequence_input_should_return_CleanningSession()
        {
            CommandReader test = new CommandReader(_mockView.Object, _mockRobotCleanerServices.Object);

            _mockView.SetupSequence(x => x.ReadLine())
            .Returns("2")
            .Returns("10 22")
            .Returns("E 2")
            .Returns("N 1");
            CleanningProcess result = test.ReadAllCommands();

            Assert.AreEqual(2, result.Commands.Count);

            Assert.AreEqual(10, result.StartingCoordinate.X);
            Assert.AreEqual(22, result.StartingCoordinate.Y);

            Assert.AreEqual(Direction.E, result.Commands[0].Direction);
            Assert.AreEqual(2, result.Commands[0].Steps);

            Assert.AreEqual(Direction.N, result.Commands[1].Direction);
            Assert.AreEqual(1, result.Commands[1].Steps);
        }