Exemplo n.º 1
0
        public void AddWorkSheetsTest()
        {
            ExcelManager manager = new ExcelManager();

            manager.AddWorkSheets(new StringList {
                "Worksheet1", "Worksheet2"
            }, ExcelFile);

            try
            {
                //try to go on new worksheets
                manager.ChangeCellValue(ExcelFile, "Worksheet1", "A1", "Test");
                manager.ChangeCellValue(ExcelFile, "Worksheet2", "A1", "Test");
            }
            catch
            {
                Assert.Fail();
            }
        }
Exemplo n.º 2
0
        public void ChangeCellExcel()
        {
            ExcelWriter <User> writer = new ExcelWriter <User>("Users", new StringList {
                "Name", "Firstname"
            });

            writer.Write(new User("test", "test"), ExcelFile);
            ExcelManager manager = new ExcelManager();

            manager.ChangeCellValue(ExcelFile, "Users", "A2", "LALA");
            manager.ChangeCellValue(ExcelFile, "Users", "B2", "LALA");

            IReader <User> reader = new ExcelReader <User>("Users", new StringList {
                "Name", "Firstname"
            });
            Collection <User> usersList = reader.read <UserList>(ExcelFile);

            Assert.AreEqual(1, usersList.Count);

            Assert.AreEqual("LALA", usersList[0].Name);
            Assert.AreEqual("LALA", usersList[0].Firstname);
        }