public void VisitUnknownInstruction_Always_Returns_Error_Text()
        {
            // arrange
            var computeAssembler = Substitute.For<IInstructionAssembler<ComputeInstruction>>();
            var addressAssembler = Substitute.For<IInstructionAssembler<AddressInstruction>>();
            IInstructionVisitor<string[]> visitor = new AssemblyInstructionVisitor(computeAssembler, addressAssembler);
            const string inputLine = "MORE CLASH!";
            var instruction = new UnknownInstruction(inputLine);

            // act
            string[] result = visitor.VisitInstruction(instruction);

            // assert
            Assert.AreEqual(1, result.Length);
            Assert.IsTrue(result[0].Contains("Error"));
            Assert.IsTrue(result[0].Contains(inputLine));
        }
示例#2
0
        public void VisitUnknownInstruction_Always_Returns_Error_Text()
        {
            // arrange
            var computeAssembler = Substitute.For <IInstructionAssembler <ComputeInstruction> >();
            var addressAssembler = Substitute.For <IInstructionAssembler <AddressInstruction> >();
            IInstructionVisitor <string[]> visitor = new AssemblyInstructionVisitor(computeAssembler, addressAssembler);
            const string inputLine   = "MORE CLASH!";
            var          instruction = new UnknownInstruction(inputLine);

            // act
            string[] result = visitor.VisitInstruction(instruction);

            // assert
            Assert.AreEqual(1, result.Length);
            Assert.IsTrue(result[0].Contains("Error"));
            Assert.IsTrue(result[0].Contains(inputLine));
        }
示例#3
0
 public bool VisitInstruction(UnknownInstruction instruction)
 {
     return(false);
 }
示例#4
0
 public string[] VisitInstruction(UnknownInstruction instruction)
 {
     return(new[] { string.Format("Error: Unknown instruction '{0}'", instruction.Line) });
 }