/// <summary>
        /// Test TestMultipy.asm
        /// </summary>
        public void TestBase(String asmFile, String binFile)
        {
            model.Expect(x => x.Reset());
            outWindow.Expect(x => x.WriteOutput(Arg <string> .Is.Anything)).Repeat.Any();
            outWindow.Expect(x => x.WriteError(Arg <string> .Is.Anything)).Repeat.Never();
            mockRepo.ReplayAll();

            System.Console.WriteLine("Test: ");
            bool parseResult = parser.Assemble(asmFile);

            Assert.IsTrue(parseResult);
            mockRepo.Verify(outWindow);

            byte[] expected = ParseMachineCode(binFile);
            Assert.AreEqual(expected, parser.MachineCode);
        }
Exemple #2
0
        public void TestEndExisits()
        {
            model.Expect(x => x.Reset());
            outWindow.Expect(x => x.WriteOutput(Arg <string> .Is.Anything)).Repeat.Any();
            outWindow.Expect(x => x.WriteError(Arg <string> .Is.Anything)).Repeat.Never();
            mockRepo.ReplayAll();

            StringBuilder builder = new StringBuilder();

            builder.Append("Start:\n");
            builder.Append("MOV AL,BL\n");
            builder.Append("End");
            bool parseResut = parser.Assemble(builder.ToString());

            mockRepo.Verify(outWindow);
            Assert.IsTrue(parseResut);
        }