Beispiel #1
0
        public void TimeFormula_ValueIsSetFromConstructorValidateSecond()
        {
            // Arrange
            var time = new ExcelTime(0.812M);
            LoadXmlTestData("A1", "time", "0.812");

            // Act
            var formula = new ExcelDataValidationTime(_sheet, "A1", ExcelDataValidationType.Time, _dataValidationNode, _namespaceManager);

            // Assert
            Assert.AreEqual(time.Second.Value, formula.Formula.Value.Second.Value);
        }
Beispiel #2
0
        public void TimeFormula_ValueIsSetFromConstructorValidateSecond()
        {
            // Arrange
            var time = new ExcelTime(0.812M);

            LoadXmlTestData("A1", "time", "0.812");

            // Act
            var formula = new ExcelDataValidationTime(_sheet, "A1", ExcelDataValidationType.Time, _dataValidationNode, _namespaceManager);

            // Assert
            Assert.AreEqual(time.Second.Value, formula.Formula.Value.Second.Value);
        }
        private static void PrintTimeValidationDetails(ExcelWorksheet sheet, ExcelDataValidationTime validation, int row)
        {
            var value1 = string.Empty;

            if (!string.IsNullOrEmpty(validation.Formula.ExcelFormula))
            {
                value1 = validation.Formula.ExcelFormula;
            }
            else
            {
                value1 = string.Format("{0}:{1}:{2}", validation.Formula.Value.Hour, validation.Formula.Value.Minute, validation.Formula.Value.Second ?? 0);
            }
            sheet.Cells["D" + row.ToString()].Value = value1;
        }
Beispiel #4
0
 private static void PrintTimeValidationDetails(ExcelWorksheet sheet, ExcelDataValidationTime validation, int row)
 {
     var value1 = string.Empty;
     if(!string.IsNullOrEmpty(validation.Formula.ExcelFormula))
     {
         value1 = validation.Formula.ExcelFormula;
     }
     else
     {
         value1 = string.Format("{0}:{1}:{2}", validation.Formula.Value.Hour, validation.Formula.Value.Minute, validation.Formula.Value.Second ?? 0);
     }
     sheet.Cells["D" + row.ToString()].Value = value1;
 }