public void TestingCounts() { SpreadSheet test = new SpreadSheet(50, 26); Assert.AreEqual(test.RowCount, 50); Assert.AreEqual(test.ColumnCount, 26); }
public void TestingSelfReference() { List <string> undoInput = new List <string>(); SpreadSheet test = new SpreadSheet(50, 26); test.GetCell(1, 0).Text = "=A1+5"; Assert.AreEqual(test.GetCell(1, 0).ValueStr, "!self reference"); }
public void TestingBadReference() { List <string> undoInput = new List <string>(); SpreadSheet test = new SpreadSheet(50, 26); test.GetCell(1, 0).Text = "=Cell678+50"; Assert.AreEqual(test.GetCell(1, 0).ValueStr, "!bad reference"); }
public void TestingIfDefault() { List <string> undoInput = new List <string>(); SpreadSheet test = new SpreadSheet(50, 26); test.GetCell(1, 0).Text = "test"; Assert.AreEqual(test.DetermineDefault(test.GetCell(1, 0)), 0); }
public void TestingSpreadsheetText() { SpreadSheet test = new SpreadSheet(50, 26); test.GetCell(1, 0).Text = "12"; test.GetCell(1, 1).Text = "=(A1+13)"; Assert.AreEqual(test.GetCell(1, 1).Text, "=(A1+13)"); }
public void TestingSpreadsheetVale() { SpreadSheet test = new SpreadSheet(50, 26); test.GetCell(11, 0).Text = "12"; test.GetCell(1, 1).Text = "=(A11+13)"; Assert.AreEqual("25", test.GetCell(1, 1).ValueStr); }
public void TestingCircularReference() { List <string> undoInput = new List <string>(); SpreadSheet test = new SpreadSheet(50, 26); test.GetCell(1, 0).Text = "=A2"; test.GetCell(2, 0).Text = "=A3"; test.GetCell(3, 0).Text = "=A1"; Assert.AreEqual(test.GetCell(3, 0).ValueStr, "!circular reference"); }
public void TestingClearStack() { List <string> undoInput = new List <string>(); SpreadSheet test = new SpreadSheet(50, 26); undoInput.Add("0"); undoInput.Add("0"); undoInput.Add("color"); undoInput.Add("4294967295"); test.AddUndo(undoInput); test.ClearStacks(); Assert.AreEqual(test.DetermineUndo(), -1); }
public void TestingColorUndoRedo() { List <string> undoInput = new List <string>(); SpreadSheet test = new SpreadSheet(50, 26); test.GetCell(1, 0).Color = 4286644096; undoInput.Add("0"); undoInput.Add("0"); undoInput.Add("color"); undoInput.Add("4294967295"); test.AddUndo(undoInput); test.Undo(); Assert.AreEqual(test.GetCell(1, 0).Color.ToString(), "4294967295"); test.Redo(); Assert.AreEqual(test.GetCell(1, 0).Color.ToString(), "4286644096"); }
public void TestingUndoRedo() { List <string> undoInput = new List <string>(); SpreadSheet test = new SpreadSheet(50, 26); test.GetCell(1, 0).Text = "50"; undoInput.Add("0"); undoInput.Add("0"); undoInput.Add("txt"); undoInput.Add(string.Empty); test.AddUndo(undoInput); test.Undo(); Assert.AreEqual(string.Empty, test.GetCell(1, 0).ValueStr); test.Redo(); Assert.AreEqual(test.GetCell(1, 0).ValueStr, "50"); }
/// <summary> /// Initializes a new instance of the <see cref="Form1"/> class. /// Constructor for the form. /// </summary> public Form1() { this.InitializeComponent(); this.dataGridView1.ColumnCount = 26; this.dataGridView1.Columns[0].Name = "A"; this.dataGridView1.Columns[1].Name = "B"; this.dataGridView1.Columns[2].Name = "C"; this.dataGridView1.Columns[3].Name = "D"; this.dataGridView1.Columns[4].Name = "E"; this.dataGridView1.Columns[5].Name = "F"; this.dataGridView1.Columns[6].Name = "G"; this.dataGridView1.Columns[7].Name = "H"; this.dataGridView1.Columns[8].Name = "I"; this.dataGridView1.Columns[9].Name = "J"; this.dataGridView1.Columns[10].Name = "K"; this.dataGridView1.Columns[11].Name = "L"; this.dataGridView1.Columns[12].Name = "M"; this.dataGridView1.Columns[13].Name = "N"; this.dataGridView1.Columns[14].Name = "O"; this.dataGridView1.Columns[15].Name = "P"; this.dataGridView1.Columns[16].Name = "Q"; this.dataGridView1.Columns[17].Name = "R"; this.dataGridView1.Columns[18].Name = "S"; this.dataGridView1.Columns[19].Name = "T"; this.dataGridView1.Columns[20].Name = "U"; this.dataGridView1.Columns[21].Name = "V"; this.dataGridView1.Columns[22].Name = "W"; this.dataGridView1.Columns[23].Name = "X"; this.dataGridView1.Columns[24].Name = "Y"; this.dataGridView1.Columns[25].Name = "Z"; for (int a = 1; a < 51; a++) { this.dataGridView1.Rows.Add(); this.dataGridView1.Rows[a - 1].HeaderCell.Value = a.ToString(); } this.sheet = new SpreadSheet(50, 26); this.dataGridView1.CellBeginEdit += new DataGridViewCellCancelEventHandler(this.DataGridView1_CellBeginEdit); this.dataGridView1.CellEndEdit += new DataGridViewCellEventHandler(this.DataGridView1_CellEndEdit); this.sheet.PropertyChanged += this.CellPropertyChanging; this.dynamicButton.Click += new EventHandler(this.Button1_Click); }
public void TestingGetCellColumn() { SpreadSheet test = new SpreadSheet(50, 26); Assert.AreEqual(test.GetCell(49, 25).ColumnIndex, 25); }
public void TestingGetCellRow() { SpreadSheet test = new SpreadSheet(50, 26); Assert.AreEqual(test.GetCell(50, 25).RowIndex, 49); }