Beispiel #1
0
        public void TestMethod2()
        {
            SpreadsheetViewStub stub    = new SpreadsheetViewStub();
            Controller          control = new Controller(stub);

            stub.FireNewEvent();
            Assert.IsTrue(stub.CalledOpenNew);
        }
Beispiel #2
0
        public void TestMethod3()
        {
            SpreadsheetViewStub stub    = new SpreadsheetViewStub();
            Controller          control = new Controller(stub);

            stub.FireHelpEvent();
            Assert.IsTrue(stub.CalledDoHelp);
        }
Beispiel #3
0
        public void testOFail()
        {
            SpreadsheetViewStub stub    = new SpreadsheetViewStub();
            Controller          control = new Controller(stub);

            stub.FireOpenEvent("testfail.ss");
            stub.Title.ToString();
        }
Beispiel #4
0
        public void TestMethod1()
        {
            SpreadsheetViewStub stub    = new SpreadsheetViewStub();
            Controller          control = new Controller(stub);

            stub.FireCloseEvent();
            Assert.IsTrue(stub.CalledDoClose);
        }
Beispiel #5
0
        public void testSFail()
        {
            SpreadsheetViewStub stub    = new SpreadsheetViewStub();
            Controller          control = new Controller(stub);

            stub.SetNewSelection(0, 0);
            stub.FireContentEvent("=1");
            stub.FireSaveEvent("");
            stub.Title.ToString();
        }
Beispiel #6
0
        public void TestMethod11()
        {
            SpreadsheetViewStub stub    = new SpreadsheetViewStub();
            Controller          control = new Controller(stub);

            stub.SetNewSelection(0, 0);
            stub.FireContentEvent("=2");
            stub.FireSaveEvent("test.ss");
            Assert.AreEqual(stub.Title, "test.ss");
        }
Beispiel #7
0
        public void TestMethod8()
        {
            SpreadsheetViewStub stub    = new SpreadsheetViewStub();
            Controller          control = new Controller(stub);

            stub.SetNewSelection(1, 1);
            stub.FireContentEvent("=x");
            object value = stub.GetValue("B2");
            string val   = value.ToString();

            Assert.AreEqual("Formula Error", val);
        }
Beispiel #8
0
        public void TestMethod4()
        {
            SpreadsheetViewStub stub    = new SpreadsheetViewStub();
            Controller          control = new Controller(stub);

            stub.SetNewSelection(1, 1);
            stub.FireContentEvent("=2+2");
            object value = stub.GetValue("B2");
            string val   = value.ToString();

            double.TryParse(val, out double result);
            Assert.AreEqual(4, result, .00000000001);
        }
Beispiel #9
0
        public void TestMethod9()
        {
            SpreadsheetViewStub stub    = new SpreadsheetViewStub();
            Controller          control = new Controller(stub);

            stub.SetNewSelection(1, 1);
            stub.FireContentEvent("=2");
            stub.SetNewSelection(2, 2);
            stub.FireContentEvent("=1");
            stub.SetNewSelection(0, 0);
            stub.FireContentEvent("=b2+c3");
            string val = stub.FireGetContentEvent("A1");

            Assert.AreEqual("=B2+C3", val);
        }
Beispiel #10
0
        public void TestMethod12()
        {
            SpreadsheetViewStub stub    = new SpreadsheetViewStub();
            Controller          control = new Controller(stub);

            SpreadsheetViewStub stub1 = new SpreadsheetViewStub();
            String      fileName      = "test.ss";
            Spreadsheet ss            = new Spreadsheet();
            Controller  contro1l      = new Controller(stub1, ss, fileName);

            stub.SetNewSelection(0, 0);
            stub.FireContentEvent("=2");
            stub.FireSaveEvent("test.ss");
            Assert.AreEqual(stub.Title.ToString(), "test.ss");

            stub1.FireOpenEvent(fileName);
            Assert.AreEqual(stub1.Title.ToString(), "test.ss");
        }