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)); }
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)); }
public bool VisitInstruction(UnknownInstruction instruction) { return(false); }
public string[] VisitInstruction(UnknownInstruction instruction) { return(new[] { string.Format("Error: Unknown instruction '{0}'", instruction.Line) }); }