Пример #1
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);
        }
Пример #2
0
        public void TestMethod5()
        {
            SpreadsheetViewStub stub    = new SpreadsheetViewStub();
            Controller          control = new Controller(stub);

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

            double.TryParse(val, out double result);
            Assert.AreEqual(10, result, .00000000001);
        }
Пример #3
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();
        }
Пример #4
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");
        }
Пример #5
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);
        }
Пример #6
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");
        }