Пример #1
0
        public void ResourceStaticAnalysisCanReturnSchemaStream()
        {
            var reader = ResourceStaticAnalysisToolbox.GetConfigSchemaStream();

            Assert.IsNotNull(reader);
            var p = reader.ReadLine();

            Assert.AreEqual("<?xml version=\"1.0\" encoding=\"utf-8\"?>", p);
        }
        /// <summary>
        /// Offers a convenient method for loading a serialized version of configuration into memory.
        /// This deserialized object can then be passed into ResourceStaticAnalysis at construction to allow for engine configuration to happen.
        /// <param name="pathToXml">Uri or path to Xml file that contains a serialized version of engine configuration.</param>
        /// </summary>
        public static EngineConfig Deserialize(string pathToXml)
        {
            var settings = new XmlReaderSettings {
                ValidationType = ValidationType.Schema
            };
            XmlSchema schema;

            using (var configSchemaReader = XmlReader.Create(ResourceStaticAnalysisToolbox.GetConfigSchemaStream()))
            {
                schema = XmlSchema.Read(configSchemaReader, ConfigSchemaValidator);
            }
            settings.Schemas.Add(schema);
            settings.ValidationEventHandler += ConfigXmlValidationProblem;
            using (var fileReader = XmlReader.Create(pathToXml, settings))
            {
                return(Deserialize(fileReader));
            }
        }
Пример #3
0
 /// <summary>
 /// Checks if this string contains all of the strings.
 /// </summary>
 /// <param name="comparisonType">Type of string comparison to be used.</param>
 /// <param name="strings">Strings to check against.</param>
 /// <returns>True if all of the strings are contained in this string.</returns>
 public bool ContainsAnd(StringComparison comparisonType, params string[] strings)
 {
     return(ResourceStaticAnalysisToolbox.ContainsAnd(this.Value, comparisonType, strings));
 }
Пример #4
0
 /// <summary>
 /// Checks if this string contains at least one of the strings. Uses default Ordinal comparison.
 /// </summary>
 /// <param name="strings">Strings to check against.</param>
 /// <returns>True if at least one string is contained in this string.</returns>
 public bool Contains(params string[] strings)
 {
     return(ResourceStaticAnalysisToolbox.Contains(this.Value, StringComparison.Ordinal, strings));
 }
Пример #5
0
 /// <summary>
 /// Checks if this string equals any of the strings provided.
 /// </summary>
 /// <param name="comparisonType">Type of string comparison to be used.</param>
 /// <param name="strings">Strings to check against.</param>
 /// <returns>True if at least one of the strings are equal to this string.</returns>
 public bool Equals(StringComparison comparisonType, params string[] strings)
 {
     return(ResourceStaticAnalysisToolbox.Equals(this.Value, comparisonType, strings));
 }