public void ShowAssemblyEditorWindow(AssemblyEditorWindowViewModel viewModel) { Window window = new AssemblyEditorWindow(); window.DataContext = viewModel; window.Owner = Application.Current.MainWindow; window.Show(); }
public void AssembleCommandShouldAssembleInstructionsToMemory() { SimpleSimulator simulator = new SimpleSimulator(); AssemblyEditorWindowViewModel viewModel = new AssemblyEditorWindowViewModel(simulator); viewModel.AssemblyEditorText = SamplePrograms.HelloWorldCode; viewModel.AssembleCommand.Execute(null); var expectedBytes = SamplePrograms.HelloWorldInstructions.SelectMany(instruction => instruction.Bytes).ToList(); var actualBytes = new List<byte>(); for (byte address = 0; address < expectedBytes.Count; address++) actualBytes.Add(simulator.Memory[address]); CollectionAssert.AreEqual(expectedBytes, actualBytes); }