Exemplo n.º 1
0
 /**
  * Constructs this string formula
  *
  * @param t the record
  * @param excelFile the excel file
  * @param fr the formatting record
  * @param es the external sheet
  * @param nt the workbook
  * @param si the sheet
  * @param dummy the overload indicator
  */
 public SharedStringFormulaRecord(Record t,
                                  File excelFile,
                                  FormattingRecords fr,
                                  ExternalSheet es,
                                  WorkbookMethods nt,
                                  SheetImpl si,
                                  EmptyString dummy)
     : base(t, fr, es, nt, si, excelFile.getPos())
 {
     value = string.Empty;
 }
Exemplo n.º 2
0
        public void ConvertBackThrowsException()
        {
            // Arrange
            var conv = new EmptyString();

            // Act
            var ex = ExceptionAssert.Catch <NotSupportedException>(() => conv.ConvertBack(null, null, null, null));

            // Assert
            Assert.IsNotNull(ex);
        }
Exemplo n.º 3
0
        public void StringIsHandledCorrectly()
        {
            // Arrange
            var conv = new EmptyString();

            // Act
            var empty    = (bool)conv.Convert(string.Empty, null, null, null);
            var nonEmpty = (bool)conv.Convert(" ", null, null, null);

            // Assert
            Assert.IsTrue(empty);
            Assert.IsFalse(nonEmpty);
        }
Exemplo n.º 4
0
        public void NonStringIsHandledCorrectly()
        {
            // Arrange
            var conv = new EmptyString();

            // Act
            var nullObj = conv.Convert(null, null, null, null);
            var integer = conv.Convert(123, null, null, null);

            // Assert
            Assert.IsTrue((bool)nullObj);
            Assert.IsTrue((bool)integer);
        }
Exemplo n.º 5
0
        public static bool IsEmpty(object value1)
        {
            if (value1 == null)
            {
                return(true);
            }

            if (value1.GetType().Equals(typeof(string)))
            {
                return(EmptyString.Equals((string)value1));
            }

            if (value1.GetType().Equals(typeof(DateTime)))
            {
                return(EmptyDate.Equals((DateTime)value1));
            }

            if (value1.GetType().Equals(typeof(byte[])))
            {
                return(((byte[])value1).Length == 0);
            }

            return(false);
        }
 /**
  * Constructs this string formula
  *
  * @param t the record
  * @param excelFile the excel file
  * @param fr the formatting record
  * @param es the external sheet
  * @param nt the workbook
  * @param si the sheet
  * @param dummy the overload indicator
  */
 public SharedStringFormulaRecord(Record t,
     File excelFile,
     FormattingRecords fr,
     ExternalSheet es,
     WorkbookMethods nt,
     SheetImpl si,
     EmptyString dummy)
     : base(t,fr,es,nt,si,excelFile.getPos())
 {
     value = string.Empty;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Create plain string format.
 /// </summary>
 public TextFormat()
 {
     _null  = new NullString(this);
     _empty = new EmptyString(this);
 }
Exemplo n.º 8
0
 public virtual void Visit(EmptyString expression, T context)
 {
 }
Exemplo n.º 9
0
 public override void Visit(EmptyString expression, object context)
 {
     expressions.Add(expression);
     base.Visit(expression, context);
 }
Exemplo n.º 10
0
 public void Visit(EmptyString expression, Nonterminal context)
 {
     Add(context, expression, NullTerminal.Instance);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Create default format.
 /// </summary>
 public CSharpFormat()
 {
     _null  = new NullString(this);
     _empty = new EmptyString(this);
 }