public void AssembleInstruction_Returns_Single_Line() { // arrange var instruction = new AddressInstruction(1234); var assembler = new HackAddressInstructionAssembler(); // act string[] result = assembler.AssembleInstruction(instruction); // assert Assert.AreEqual(1, result.Length); }
public void AssembleInstruction_Throws_ArgumentOutOfRangeException_When_Address_Is_Greater_Than_15_bits() { // arrange var instruction = new AddressInstruction(65536); var assembler = new HackAddressInstructionAssembler(); // act TestDelegate testDelegate = () => assembler.AssembleInstruction(instruction); // assert Assert.Throws <ArgumentOutOfRangeException>(testDelegate); }
public void AssembleInstruction_Returns_Single_Line() { // arrange var instruction = new AddressInstruction(1234); var assembler = new HackAddressInstructionAssembler(); // act string[] result = assembler.AssembleInstruction(instruction); // assert Assert.AreEqual(1, result.Length); }
public void AssembleInstruction_Returns_Line_Starts_With_Zero() { // arrange var instruction = new AddressInstruction(1234); var assembler = new HackAddressInstructionAssembler(); // act string[] result = assembler.AssembleInstruction(instruction); string line = result[0]; // assert Assert.AreEqual('0', line[0]); }
public void AssembleInstruction_Returns_16_Bit_Line() { // arrange var instruction = new AddressInstruction(1234); var assembler = new HackAddressInstructionAssembler(); // act string[] result = assembler.AssembleInstruction(instruction); string line = result[0]; // assert Assert.AreEqual(16, line.Length); }
public void AssembleInstruction_Returns_Line_Starts_With_Zero() { // arrange var instruction = new AddressInstruction(1234); var assembler = new HackAddressInstructionAssembler(); // act string[] result = assembler.AssembleInstruction(instruction); string line = result[0]; // assert Assert.AreEqual('0', line[0]); }
public void AssembleInstruction_Returns_16_Bit_Line() { // arrange var instruction = new AddressInstruction(1234); var assembler = new HackAddressInstructionAssembler(); // act string[] result = assembler.AssembleInstruction(instruction); string line = result[0]; // assert Assert.AreEqual(16, line.Length); }
public void AssembleInstruction_Returns_Binary_Representation_Of_Address_Instruction(int address, string expected) { // arrange var instruction = new AddressInstruction(address); var assembler = new HackAddressInstructionAssembler(); // act string[] result = assembler.AssembleInstruction(instruction); string line = result[0]; // assert Assert.AreEqual(1, result.Length); Assert.AreEqual(expected.Replace(" ", ""), line); }
public void AssembleInstruction_Returns_Binary_Representation_Of_Address_Instruction(int address, string expected) { // arrange var instruction = new AddressInstruction(address); var assembler = new HackAddressInstructionAssembler(); // act string[] result = assembler.AssembleInstruction(instruction); string line = result[0]; // assert Assert.AreEqual(1, result.Length); Assert.AreEqual(expected.Replace(" ",""), line); }
public void AssembleInstruction_Throws_ArgumentOutOfRangeException_When_Address_Is_Greater_Than_15_bits() { // arrange var instruction = new AddressInstruction(65536); var assembler = new HackAddressInstructionAssembler(); // act TestDelegate testDelegate = () => assembler.AssembleInstruction(instruction); // assert Assert.Throws<ArgumentOutOfRangeException>(testDelegate); }