Exemplo n.º 1
0
 public void ListFormula_FormulaValueIsSetFromXmlNodeInConstructorOrderIsCorrect()
 {
     // Arrange
     LoadXmlTestData("A1", "list", "\"1,2\"");
     // Act
     var validation = new ExcelDataValidationList(_sheet, "A1", ExcelDataValidationType.List, _dataValidationNode, _namespaceManager);
     // Assert
     CollectionAssert.AreEquivalent(new List<string>{ "1", "2"}, (ICollection)validation.Formula.Values);
 }
Exemplo n.º 2
0
 public void ListFormula_FormulaValueIsSetFromXmlNodeInConstructor()
 {
     // Arrange
     LoadXmlTestData("A1", "list", "\"1,2\"");
     // Act
     var validation = new ExcelDataValidationList(_sheet, "A1", ExcelDataValidationType.List, _dataValidationNode, _namespaceManager);
     // Assert
     Assert.AreEqual(2, validation.Formula.Values.Count);
 }
        public void ListFormula_FormulasExcelFormulaIsSetFromXmlNodeInConstructor()
        {
            // Arrange
            LoadXmlTestData("A1", "list", "A1");
            // Act
            var validation = new ExcelDataValidationList(_sheet, "A1", ExcelDataValidationType.List, _dataValidationNode, _namespaceManager);

            // Assert
            Assert.AreEqual("A1", validation.Formula.ExcelFormula);
        }
Exemplo n.º 4
0
        public void ListFormula_FormulaValueIsSetFromXmlNodeInConstructor()
        {
            // Arrange
            LoadXmlTestData("A1", "list", "\"1,2\"");
            // Act
            var validation = new ExcelDataValidationList(_sheet, ExcelDataValidation.NewId(), "A1", ExcelDataValidationType.List, _dataValidationNode, _namespaceManager);

            // Assert
            Assert.AreEqual(2, validation.Formula.Values.Count);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Adds an <see cref="IExcelDataValidationList"/> to the worksheet. The accepted values are defined
        /// in a list.
        /// </summary>
        /// <param name="address">The range/address to validate</param>
        /// <returns></returns>
        public IExcelDataValidationList AddListValidation(string address)
        {
            ValidateAddress(address);
            EnsureRootElementExists();
            var item = new ExcelDataValidationList(_worksheet, address, ExcelDataValidationType.List);

            _validations.Add(item);
            OnValidationCountChanged();
            return(item);
        }
        public void ListFormula_FormulaValueIsSetFromXmlNodeInConstructorOrderIsCorrect()
        {
            // Arrange
            LoadXmlTestData("A1", "list", "\"1,2\"");
            // Act
            var validation = new ExcelDataValidationList(_sheet, "A1", ExcelDataValidationType.List, _dataValidationNode, _namespaceManager);

            // Assert
            CollectionAssert.AreEquivalent(new List <string> {
                "1", "2"
            }, (ICollection)validation.Formula.Values);
        }