Пример #1
0
        public void CloseFile()
        {
            SpreadsheetWindowStub stub       = new SpreadsheetWindowStub();
            Controller            controller = new Controller(stub, "New_spreadsheet");

            stub.CloseFile();
        }
Пример #2
0
        public void OpenFile()
        {
            SpreadsheetWindowStub stub       = new SpreadsheetWindowStub();
            Controller            controller = new Controller(stub, "Nothing");

            stub.OpenFile(@"Spreadsheet1.ss");
        }
Пример #3
0
        public void SaveFile1()
        {
            string fileName = @"Spreadsheet1.ss";

            SpreadsheetWindowStub stub = new SpreadsheetWindowStub();

            Controller controller = new Controller(stub, "Nothing");

            stub.PutCellContent("bye");
            stub.ChooseCell(new int[] { 2, 3 });
            stub.PutCellContent("=b2");

            stub.SaveFile(fileName);

            Spreadsheet s;

            using (StreamReader reader = new StreamReader(fileName))
                s = new Spreadsheet(reader, new Regex(@".*"));

            SpreadsheetWindowStub stub2 = new SpreadsheetWindowStub();

            Controller controller2 = new Controller(stub2, s, "Nothing");

            stub2.ChooseCell(new int[] { 0, 0 });
            Assert.AreEqual("bye", stub2.SelectedValueSim);
            stub2.ChooseCell(new int[] { 2, 3 });
            Assert.AreEqual("SS.FormulaError", stub2.SelectedValueSim);
        }
Пример #4
0
        public void CheckContents2()
        {
            SpreadsheetWindowStub stub = new SpreadsheetWindowStub();

            Controller controller = new Controller(stub, "Nothing");

            stub.ChooseCell(new int[] { 0, 0 });
            stub.PutCellContent("something");

            stub.ChooseCell(new int[] { 0, 0 });
            Assert.AreEqual("something", stub.SelectedContents);
        }
Пример #5
0
        public void SetContents3()
        {
            SpreadsheetWindowStub stub = new SpreadsheetWindowStub();

            Controller controller = new Controller(stub, "Nothing");

            stub.ChooseCell(new int[] { 0, 0 });
            stub.PutCellContent("1");

            stub.ChooseCell(new int[] { 0, 0 });
            Assert.AreEqual("1", stub.SelectedValueSim);
        }
Пример #6
0
        public void TestMethod1()
        {
            SpreadsheetWindowStub stub       = new SpreadsheetWindowStub();
            SpreadsheetController controller = new SpreadsheetController(stub);

            stub.FireCellContentsChanged();
            stub.FireCellContentsChanged_InvalidName();
            stub.FireCellHighlighted();
            stub.FireCellHighlighted_InvalidName();
            stub.FireCloseSS();
            stub.FireSaveSS();
            stub.FireLoadSS();
            stub.DoClose();
        }