public void CloseFile() { SpreadsheetWindowStub stub = new SpreadsheetWindowStub(); Controller controller = new Controller(stub, "New_spreadsheet"); stub.CloseFile(); }
public void OpenFile() { SpreadsheetWindowStub stub = new SpreadsheetWindowStub(); Controller controller = new Controller(stub, "Nothing"); stub.OpenFile(@"Spreadsheet1.ss"); }
public void SaveFile1() { string fileName = @"Spreadsheet1.ss"; SpreadsheetWindowStub stub = new SpreadsheetWindowStub(); Controller controller = new Controller(stub, "Nothing"); stub.PutCellContent("bye"); stub.ChooseCell(new int[] { 2, 3 }); stub.PutCellContent("=b2"); stub.SaveFile(fileName); Spreadsheet s; using (StreamReader reader = new StreamReader(fileName)) s = new Spreadsheet(reader, new Regex(@".*")); SpreadsheetWindowStub stub2 = new SpreadsheetWindowStub(); Controller controller2 = new Controller(stub2, s, "Nothing"); stub2.ChooseCell(new int[] { 0, 0 }); Assert.AreEqual("bye", stub2.SelectedValueSim); stub2.ChooseCell(new int[] { 2, 3 }); Assert.AreEqual("SS.FormulaError", stub2.SelectedValueSim); }
public void CheckContents2() { SpreadsheetWindowStub stub = new SpreadsheetWindowStub(); Controller controller = new Controller(stub, "Nothing"); stub.ChooseCell(new int[] { 0, 0 }); stub.PutCellContent("something"); stub.ChooseCell(new int[] { 0, 0 }); Assert.AreEqual("something", stub.SelectedContents); }
public void SetContents3() { SpreadsheetWindowStub stub = new SpreadsheetWindowStub(); Controller controller = new Controller(stub, "Nothing"); stub.ChooseCell(new int[] { 0, 0 }); stub.PutCellContent("1"); stub.ChooseCell(new int[] { 0, 0 }); Assert.AreEqual("1", stub.SelectedValueSim); }
public void TestMethod1() { SpreadsheetWindowStub stub = new SpreadsheetWindowStub(); SpreadsheetController controller = new SpreadsheetController(stub); stub.FireCellContentsChanged(); stub.FireCellContentsChanged_InvalidName(); stub.FireCellHighlighted(); stub.FireCellHighlighted_InvalidName(); stub.FireCloseSS(); stub.FireSaveSS(); stub.FireLoadSS(); stub.DoClose(); }