public void TestBookName() { EWSEditor editor = new EWSEditor(); editor.SetupLog("unittests.log"); Workbook wb1 = editor.CreateWorkbook("Book1", 3); Assert.NotNull(wb1); Assert.Equals("Book1", wb1.Name); Assert.Equals(true, wb1.SetName("Книга1")); Assert.Equals("Книга1", wb1.Name); Workbook wb2 = editor.CreateWorkbook("Book1", 3); Assert.Equals(false, wb1.SetName("Book1")); Assert.Equals("Книга1", wb1.Name); Assert.Equals(true, wb2.SetName("Book1")); Assert.Equals(false, wb2.SetName("")); editor.StopLogging(); }
public void TestCreationSeveralBooks() { EWSEditor editor = new EWSEditor(); editor.SetupLog("unittests.log"); Workbook wb1 = editor.CreateWorkbook("Book1", 3); Workbook wb2 = editor.CreateWorkbook("Book2", 1); Workbook wb3 = editor.CreateWorkbook("Книга3", 1); Assert.NotNull(wb1); Assert.NotNull(wb2); Assert.NotNull(wb3); Assert.NotNull(editor.ActiveWorkbook); Assert.Equals(editor.ActiveWorkbook, wb3); Assert.NotEquals(editor.ActiveWorkbook, wb1); Assert.NotNull(editor.Workbooks["Книга3"]); Assert.Equals(3, editor.Workbooks.Count); Assert.Equals(editor.Workbooks["Book2"], wb2); editor.StopLogging(); }
public void TestCreation() { EWSEditor editor = new EWSEditor(); editor.SetupLog("unittests.log"); Workbook wb = editor.CreateWorkbook("Book1", 5); Assert.NotNull(wb); Assert.NotNull(editor.ActiveWorkbook); Assert.NotNull(editor.Workbooks["Book1"]); try { Workbook wb2 = editor.Workbooks["Book2"]; Assert.Fail("System.Collections.Generic.KeyNotFoundException hasn't been issued."); } catch (System.Collections.Generic.KeyNotFoundException) { } Assert.Equals(1, editor.Workbooks.Count); editor.StopLogging(); }