public void TestClose() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); Controller controller = new Controller(stub); stub.FireCloseEvent(); Assert.IsTrue(stub.CalledDoClose); }
public void TestSave1() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); Controller controller = new Controller(stub); stub.FireSaveEvent(null); Assert.AreEqual(stub.Message.Substring(0, 20), "Unable to save file\n"); }
public void FileChosenEvent02() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); Controller controller = new Controller(stub); // IOException stub.FireFileChosenEvent("../../InvalidFormatSheet.ss"); Assert.IsTrue(stub.CalledFileChosenEvent); }
public void FileChosenEvent04() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); Controller controller = new Controller(stub); // Spreadsheet Read Exception stub.FireFileChosenEvent(""); Assert.IsTrue(stub.CalledFileChosenEvent); }
public void TestOpenFile1() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); stub.spreadSheetPanel = new SpreadsheetPanel(); Controller controller = new Controller(stub); stub.FireFileChosenEvent("../../NotRealFile.ss"); Assert.IsTrue(stub.Message.StartsWith("Unable")); }
public void CalledDoClose02() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); Controller controller = new Controller(stub); stub.FireFileChosenEvent("../../demo1.ss"); stub.FireCloseEvent(); Assert.IsTrue(stub.CalledDoClose); }
public void TestSaveAndTitle() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); stub.spreadSheetPanel = new SpreadsheetPanel(); Controller controller = new Controller(stub); stub.FireFileSaveEvent("../../testing.ss"); Assert.AreEqual(stub.Title, "../../testing.ss"); }
public void TestHelpName() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); stub.spreadSheetPanel = new SpreadsheetPanel(); Controller controller = new Controller(stub); stub.FireHelpEvent(); Assert.IsTrue(stub.Message.Equals("Click on a cell to select it.\nEnter desired contents of cell into \"Contents\" box and press enter to apply.")); }
public void TestSelectionChange() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); stub.spreadSheetPanel = new SpreadsheetPanel(); Controller controller = new Controller(stub); stub.FireSelectionEvent(stub.spreadSheetPanel); Assert.AreEqual(null, stub.Name); }
public void TestNewEvent() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); stub.spreadSheetPanel = new SpreadsheetPanel(); Controller controller = new Controller(stub); stub.FireNewEvent(); Assert.IsTrue(stub.CalledOpenNew); }
public void TestSave2() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); Controller controller = new Controller(stub); stub.FireSaveEvent("spreadsheet2.ss"); Assert.IsFalse(stub.Changed); Assert.AreEqual(stub.Message, null); Assert.AreEqual(stub.Title, "spreadsheet2.ss"); }
public void TestContentsBox() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); stub.spreadSheetPanel = new SpreadsheetPanel(); Controller controller = new Controller(stub); stub.FireContentsEvent(); Assert.AreEqual("Cannot change cell contents to " + null + " because: " + "Value cannot be null.", stub.Message); }
public void TestOpenFile() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); stub.spreadSheetPanel = new SpreadsheetPanel(); Controller controller = new Controller(stub); stub.FireFileChosenEvent("../../testing1.ss"); Assert.AreEqual("../../testing1.ss", stub.Title); Assert.AreEqual(stub.Contents, "=A2"); }
public void XClose01() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); Controller controller = new Controller(stub); stub.FireFileChosenEvent("../../demo1.ss"); Assert.AreEqual("../../demo1.ss", stub.Title); stub.FireClosingForm(new FormClosingEventArgs(new CloseReason(), true)); Assert.IsTrue(stub.CalledClosingForm); }
public void KeyPress01() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); Controller controller = new Controller(stub); stub.FireFileChosenEvent("../../demo1.ss"); Assert.AreEqual("../../demo1.ss", stub.Title); stub.FireKeyPressedEvent('\r', "A1", "Doubles"); Assert.IsTrue(stub.CalledKeyPressedEvent); }
public void EvaluateButton01() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); Controller controller = new Controller(stub); stub.FireFileChosenEvent("../../demo1.ss"); Assert.AreEqual("../../demo1.ss", stub.Title); stub.FireEvaluateClicked("A1", "Doubles"); Assert.IsTrue(stub.CalledEvaluateClick); }
public void SaveFile01() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); Controller controller = new Controller(stub); stub.FireFileChosenEvent("../../demo1.ss"); Assert.AreEqual("../../demo1.ss", stub.Title); stub.FireSaveEvent("../../demo1.ss"); Assert.IsTrue(stub.CalledSaveEvent); }
public void TestSelectionChanged() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); Controller controller = new Controller(stub); stub.FireSelectionChangedEvent(); Assert.AreEqual(stub.CellName, "A1"); Assert.AreEqual(stub.CellValue, string.Empty); Assert.AreEqual(stub.CellContent, string.Empty); }
public void TestUpdate2() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); Controller controller = new Controller(stub); stub.CellName = "A1"; stub.FireUpdateEvent("10"); stub.FireUpdateEvent("=a1"); Assert.AreEqual(stub.Message.Substring(0, 8), "Error: \n"); Assert.AreEqual(stub.CellContent, "10"); }
public void HowTo01() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); Controller controller = new Controller(stub); stub.FireFileChosenEvent("../../demo1.ss"); Assert.AreEqual("../../demo1.ss", stub.Title); stub.FireHowToEvent(); Assert.IsTrue(stub.CalledHowTo); Assert.IsTrue(stub.CalledMessage); }
public void TestSetCell() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); Controller controller = new Controller(stub); stub.SetCell(3, 4, "10"); Assert.IsTrue(stub.CalledSetCell); Assert.AreEqual(stub.Col, 3); Assert.AreEqual(stub.Row, 4); Assert.AreEqual(stub.CellContent, "10"); }
public void TestContentsBox2() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); stub.spreadSheetPanel = new SpreadsheetPanel(); Controller controller = new Controller(stub); stub.FireFileChosenEvent("../../testing1.ss"); stub.Contents = "2"; stub.FireContentsEvent(); Assert.AreEqual("2", stub.Value); }
public void Test5() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); Controller controller = new Controller(stub); stub.FireCellContentsChange("A1", "CS 1410"); stub.FireCellContentsChange("A2", "CS 2420"); stub.FireCellContentsChange("A3", "CS 3500"); stub.FireCellContentsChange("A4", "CS 3810"); stub.FireSaveEvent("savedSpreadsheet1.xml"); Assert.IsFalse(stub.DidSendMessage); }
public void TestUpdate1() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); Controller controller = new Controller(stub); stub.CellName = "A1"; stub.FireUpdateEvent("10"); Assert.AreEqual(stub.Row, 0); Assert.AreEqual(stub.Col, 0); Assert.AreEqual(stub.CellValue, "10"); Assert.AreEqual(stub.CellContent, "10"); Assert.IsTrue(stub.Changed); }
public void SaveFile04() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); Controller controller = new Controller(stub); stub.FireFileChosenEvent("../../demo1.ss"); Assert.AreEqual("../../demo1.ss", stub.Title); SaveFileDialog sfd = new SaveFileDialog(); sfd.FileName = ".../.../SaveAs02.ss"; stub.FireSaveAsEvent(sfd); Assert.IsTrue(stub.CalledSaveAsEvent); }
public void SaveFile05() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); Controller controller = new Controller(stub); stub.FireFileChosenEvent("../../demo1.ss"); Assert.AreEqual("../../demo1.ss", stub.Title); // Make a change stub.FireEvaluateClicked("A2", "4"); // Save the file stub.FireSaveEvent("../../demo1.ss"); Assert.IsTrue(stub.CalledSaveEvent); }
public void XClose03() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); Controller controller = new Controller(stub); stub.FireFileChosenEvent("../../demo1.ss"); Assert.AreEqual("../../demo1.ss", stub.Title); // Make a change stub.FireEvaluateClicked("A2", "4"); // Set dialog selection to cancel (save warning) stub.customSetDialogResult = DialogResult.Yes; stub.FireClosingForm(new FormClosingEventArgs(new CloseReason(), true)); Assert.IsTrue(stub.CalledClosingForm); }
public void TestXClose() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); stub.spreadSheetPanel = new SpreadsheetPanel(); Controller controller = new Controller(stub); stub.FireFileChosenEvent("../../testing1.ss"); stub.Contents = "2"; stub.FireContentsEvent(); FormClosingEventArgs e; e = new FormClosingEventArgs(CloseReason.UserClosing, true); stub.FireXCloseEvent(e); Assert.AreEqual(true, e.Cancel); }
public void TestConstructor() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); Spreadsheet spreadsheet = new Spreadsheet(); spreadsheet.SetContentsOfCell("a1", "=10"); Controller controller = new Controller(stub, spreadsheet, "test.ss"); Assert.IsTrue(stub.CalledSetCell); Assert.IsFalse(stub.Changed); Assert.AreEqual(stub.CellName, "A1"); Assert.AreEqual(stub.Title, "test.ss"); Assert.AreEqual(stub.CellContent, "=10"); Assert.AreEqual(stub.CellValue, "10"); }
public void EvaluateButton02() { SpreadsheetViewStub stub = new SpreadsheetViewStub(); Controller controller = new Controller(stub); stub.FireFileChosenEvent("../../demo1.ss"); Assert.AreEqual("../../demo1.ss", stub.Title); //Formula Format Exception stub.FireEvaluateClicked("E1", "=Z101"); Assert.IsTrue(stub.CalledEvaluateClick); Assert.IsTrue(stub.CalledMessage); //Circular Exception stub.FireEvaluateClicked("A2", "=B2"); Assert.IsTrue(stub.CalledEvaluateClick); Assert.IsTrue(stub.CalledMessage); }