Beispiel #1
0
        public void IdentifierSanitization(AnyString anyString)
        {
            var sanitized = NameSanitizer.SanitizeCsharpName(anyString.Val, null);

            Assert.True(SyntaxFacts.IsValidIdentifier(sanitized));
            if (SyntaxFacts.IsValidIdentifier(anyString.Val))
            {
                Assert.Equal(sanitized, anyString.Val);
            }
        }
Beispiel #2
0
        public void HappyPath()
        {
            // Arrange
            var          sut       = new CurrentCultureUpperCaseFormatter();
            const string AnyString = "Fake";

            // Act
            var result = sut.Convert(AnyString);

            // Assert
            Assert.AreEqual(AnyString.ToUpper(), result);
        }
Beispiel #3
0
 public AnyString this[String _index]
 {
     get
     {
         Int32     index = m_sheet.GetKeyIndex(_index);
         AnyString re    = GetColumn(index);
         if (re == null)
         {
             throw new Exception(string.Format("SheetLiteRow: 尝试获取的Column: {0} 并不存在! sheet: {1}", _index, m_sheet.SheetName));
         }
         return(re);
     }
 }
Beispiel #4
0
        private static bool _parseVariant(AnyString _raw, ref Variant.Variant _value, eVariantType _variant_type)
        {
            switch (_variant_type)
            {
            case eVariantType.UInt8:
            {
                SByte v = _raw;
                _value = v;
                return(true);
            }

            case eVariantType.Int8:
            {
                Byte v = _raw;
                _value = v;
                return(true);
            }

            case eVariantType.UInt16:
            {
                UInt16 v = _raw;
                _value = v;
                return(true);
            }

            case eVariantType.Int16:
            {
                Int16 v = _raw;
                _value = v;
                return(true);
            }

            case eVariantType.UInt32:
            {
                UInt32 v = _raw;
                _value = v;
                return(true);
            }

            case eVariantType.Int32:
            {
                Int32 v = _raw;
                _value = v;
                return(true);
            }

            case eVariantType.UInt64:
            {
                UInt64 v = _raw;
                _value = v;
                return(true);
            }

            case eVariantType.Int64:
            {
                Int64 v = _raw;
                _value = v;
                return(true);
            }

            case eVariantType.Single:
            {
                Single v = _raw;
                _value = v;
                return(true);
            }

            case eVariantType.Double:
            {
                Double v = _raw;
                _value = v;
                return(true);
            }

            case eVariantType.Boolean:
            {
                Boolean v = _raw;
                _value = v;
                return(true);
            }

            case eVariantType.String:
            {
                _value = _raw.ToString();
                return(true);
            }

            default:
            {
                Log.Error("[VariantPairSerializer.CreateFromSheetLite]: _variant_type 为 {0} 无法解析!", _raw);
                return(false);
            }
            }
        }
 public bool Equals(AnyString other)
 {
     if (ReferenceEquals(null, other)) return false;
       if (ReferenceEquals(this, other)) return true;
       return base.Equals(other) && Equals(other.lENGTHField, lENGTHField);
 }