Ejemplo n.º 1
0
        public MFTestResults RandomXmlTest()
        {
            Random random = new Random();
            int seed = 0;
            int readCount = 0;
            DateTime startTime = DateTime.Now;
            TimeSpan oneMinute = new TimeSpan(0, 1, 0);

            try
            {
                // Run through at least 1 minute of random XML.
                do
                {
                    seed = random.Next();

                    RandomXmlStream xmlStream = new RandomXmlStream(seed);

                    Log.Comment("RandomXmlStream, seed = " + seed.ToString());

                    XmlReader reader = XmlReader.Create(xmlStream);

                    readCount = 0;

                    while (reader.Read())
                    {
                        readCount++;
                    }
                    reader.Close();
                }
                while ((DateTime.Now - startTime) < oneMinute);
            }
            catch (Exception e)
            {
                Log.Exception("Unexpected exception during random XML Test with seed " + seed.ToString() + ", after " + readCount.ToString() + " Read() calls: \r\n" + e);
                return MFTestResults.Fail;
            }

            return MFTestResults.Pass;
        }
        public MFTestResults RandomXmlTest()
        {
            Random   random    = new Random();
            int      seed      = 0;
            int      readCount = 0;
            DateTime startTime = DateTime.Now;
            TimeSpan oneMinute = new TimeSpan(0, 1, 0);

            try
            {
                // Run through at least 1 minute of random XML.
                do
                {
                    seed = random.Next();

                    RandomXmlStream xmlStream = new RandomXmlStream(seed);

                    Log.Comment("RandomXmlStream, seed = " + seed.ToString());

                    XmlReader reader = XmlReader.Create(xmlStream);

                    readCount = 0;

                    while (reader.Read())
                    {
                        readCount++;
                    }
                    reader.Close();
                }while ((DateTime.Now - startTime) < oneMinute);
            }
            catch (Exception e)
            {
                Log.Exception("Unexpected exception during random XML Test with seed " + seed.ToString() + ", after " + readCount.ToString() + " Read() calls: \r\n" + e);
                return(MFTestResults.Fail);
            }

            return(MFTestResults.Pass);
        }