public void Should_find_formulas_on_a_worksheet() { //----------------------------------------------------------------------------------------------------------- // Arrange //----------------------------------------------------------------------------------------------------------- ExcelWorksheet worksheet1 = excelPackage1.GetWorksheet("TEST5"); worksheet1.Cells[18, 2, 18, 2].Formula = "=SUM(B2:B4)"; ExcelWorksheet worksheet2 = excelPackage1.GetWorksheet("TEST4"); //----------------------------------------------------------------------------------------------------------- // Act //----------------------------------------------------------------------------------------------------------- bool result1 = worksheet1.HasAnyFormula(); bool result2 = worksheet2.HasAnyFormula(); Action action1 = () => { worksheet1.CheckAndThrowIfThereIsAnyFormula("First worksheet has formulas."); }; //----------------------------------------------------------------------------------------------------------- // Assert //----------------------------------------------------------------------------------------------------------- result1.Should().BeTrue(); result2.Should().BeFalse(); action1.Should().Throw <ExcelValidationException>().WithMessage("First worksheet has formulas."); }