public void MenuClose02()
        {
            SpreadsheetViewStub stub       = new SpreadsheetViewStub();
            Controller          controller = new Controller(stub);

            stub.FireFileChosenEvent("../../demo1.ss");
            Assert.AreEqual("../../demo1.ss", stub.Title);

            // Change value of A2
            stub.FireSelectionChangedEvent(0, 1);
            stub.Value    = "4";
            stub.Contents = "4";
            Assert.AreEqual("A2", stub.CellName);

            stub.FireEvaluateClicked("A2", "4");

            // Cancel closing sheet
            stub.customSetDialogResult = DialogResult.Cancel;
            stub.FireCloseEvent();
            Assert.IsTrue(stub.CalledCloseEvent);

            // Save sheet
            stub.customSetDialogResult = DialogResult.Yes;
            stub.FireCloseEvent();
            Assert.IsTrue(stub.CalledCloseEvent);
        }
        public void Test6()
        {
            SpreadsheetViewStub stub       = new SpreadsheetViewStub();
            Controller          controller = new Controller(stub);

            stub.FireFileChosenEvent("savedSpreadsheet.xml");
            Assert.IsFalse(stub.DidSendMessage);
        }
        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);
        }
Exemple #5
0
        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);
        }
Exemple #7
0
        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 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 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 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);
        }
Exemple #12
0
        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 FileChosenEvent06()
        {
            SpreadsheetViewStub stub       = new SpreadsheetViewStub();
            Controller          controller = new Controller(stub);

            stub.FireFileChosenEvent("../../demo1.ss");
            Assert.AreEqual("../../demo1.ss", stub.Title);

            // Change value of A2
            stub.FireSelectionChangedEvent(0, 1);
            stub.Value    = "4";
            stub.Contents = "4";
            Assert.AreEqual("A2", stub.CellName);

            stub.FireEvaluateClicked("A2", "4");

            // Selecting Yes in pop-up message prompting to save
            stub.customSetDialogResult = DialogResult.Yes;
            stub.FireFileChosenEvent("../../demo1.ss");
            Assert.IsTrue(stub.CalledFileChosenEvent);
        }
        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 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 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);
        }
Exemple #17
0
        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 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 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);
        }
        public void FileChosenEvent01()
        {
            SpreadsheetViewStub stub       = new SpreadsheetViewStub();
            Controller          controller = new Controller(stub);

            stub.FireFileChosenEvent("../../demo1.ss");
            Assert.AreEqual("../../demo1.ss", stub.Title);

            stub.FireSelectionChangedEvent(0, 0);
            Assert.AreEqual("Doubles", stub.Value.ToString());
            Assert.AreEqual("A1", stub.CellName.ToString());
            Assert.AreEqual("Doubles", stub.Contents.ToString());

            stub.FireSelectionChangedEvent(0, 2);
            Assert.AreEqual("3", stub.Value.ToString());
            Assert.AreEqual("A3", stub.CellName.ToString());
            Assert.AreEqual("3", stub.Contents.ToString());

            stub.FireSelectionChangedEvent(0, 3);
            Assert.AreEqual("hi", stub.Value.ToString());
            Assert.AreEqual("A4", stub.CellName.ToString());
            Assert.AreEqual("hi", stub.Contents.ToString());
        }