Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        public void Test2()
        {
            SpreadsheetViewStub stub       = new SpreadsheetViewStub();
            Controller          controller = new Controller(stub);

            stub.FireCellContentsChange("A1", "11");
            stub.FireCellContentsChange("A2", "2");
            stub.FireCellContentsChange("A3", "=A1 * A2");
            stub.FireCellContentsChange("A4", "22");

            stub.FireCellSelected(0, 0);
            Assert.AreEqual("A1", stub.CurrentCellName);
            Assert.AreEqual("11", stub.CurrentCellContents.ToString());
            Assert.AreEqual(11.0, stub.CurrentCellValue);

            stub.FireCellSelected(0, 1);
            Assert.AreEqual("A2", stub.CurrentCellName);
            Assert.AreEqual("2", stub.CurrentCellContents.ToString());
            Assert.AreEqual(2.0, stub.CurrentCellValue);

            stub.FireCellSelected(0, 2);
            Assert.AreEqual("A3", stub.CurrentCellName);
            Assert.AreEqual("A1*A2", stub.CurrentCellContents.ToString());
            Assert.AreEqual(22.0, stub.CurrentCellValue);

            stub.FireCellSelected(0, 3);
            Assert.AreEqual("A4", stub.CurrentCellName);
            Assert.AreEqual("22", stub.CurrentCellContents.ToString());
            Assert.AreEqual(22.0, stub.CurrentCellValue);

            stub.FireCloseEvent();
            Assert.IsTrue(stub.CalledDoClose);
            Assert.IsTrue(stub.CalledAskSave);
            Assert.IsFalse(stub.CalledOpenNew);
        }
Esempio n. 3
0
        public void Test1()
        {
            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.FireCellSelected(0, 0);
            Assert.AreEqual("A1", stub.CurrentCellName);
            Assert.AreEqual("CS 1410", stub.CurrentCellContents);
            Assert.AreEqual("CS 1410", stub.CurrentCellValue);

            stub.FireCellSelected(0, 1);
            Assert.AreEqual("A2", stub.CurrentCellName);
            Assert.AreEqual("CS 2420", stub.CurrentCellContents);
            Assert.AreEqual("CS 2420", stub.CurrentCellValue);

            stub.FireCellSelected(0, 2);
            Assert.AreEqual("A3", stub.CurrentCellName);
            Assert.AreEqual("CS 3500", stub.CurrentCellContents);
            Assert.AreEqual("CS 3500", stub.CurrentCellValue);

            stub.FireCellSelected(0, 3);
            Assert.AreEqual("A4", stub.CurrentCellName);
            Assert.AreEqual("CS 3810", stub.CurrentCellContents);
            Assert.AreEqual("CS 3810", stub.CurrentCellValue);

            stub.FireCloseEvent();
            Assert.IsTrue(stub.CalledDoClose);
            Assert.IsTrue(stub.CalledAskSave);
            Assert.IsFalse(stub.CalledOpenNew);
        }
Esempio n. 4
0
        public void CalledDoClose01()
        {
            SpreadsheetViewStub stub       = new SpreadsheetViewStub();
            Controller          controller = new Controller(stub);

            stub.FireCloseEvent();
            Assert.IsTrue(stub.CalledDoClose);
        }
Esempio n. 5
0
        public void TestCloseEvent()
        {
            SpreadsheetViewStub stub = new SpreadsheetViewStub();

            stub.spreadSheetPanel = new SpreadsheetPanel();
            Controller controller = new Controller(stub);

            stub.FireCloseEvent();
            Assert.IsTrue(stub.CalledDoClose);
        }
Esempio n. 6
0
        public void CalledDoClose02()
        {
            SpreadsheetViewStub stub       = new SpreadsheetViewStub();
            Controller          controller = new Controller(stub);

            stub.FireFileChosenEvent("../../demo1.ss");

            stub.FireCloseEvent();
            Assert.IsTrue(stub.CalledDoClose);
        }
Esempio n. 7
0
        public void MenuClose01()
        {
            SpreadsheetViewStub stub       = new SpreadsheetViewStub();
            Controller          controller = new Controller(stub);

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

            stub.FireCloseEvent();
            Assert.IsTrue(stub.CalledCloseEvent);
        }