public void XmlErrorLog_Load_Visio2010_1()
        {
            string input_filename = this.GetTestResultsOutPath(@"datafiles\XMLErrorLog_Visio_2010_1.txt");

            Assert.IsTrue(File.Exists(input_filename));
            var log = new VisioAutomation.Application.Logging.XmlErrorLog(input_filename);

            Assert.AreEqual(2, log.FileSessions.Count);

            var first_session  = log.FileSessions[0];
            var second_session = log.FileSessions[1];

            Assert.IsTrue(first_session.Source.EndsWith("vdx_with_warnings_1.vdx"));
            Assert.IsTrue(second_session.Source.EndsWith("VDX_Tests.VDX_MultiPageDocument2015-10-1--20-09-10.vdx"));

            Assert.AreEqual(4, first_session.Records.Count);
            Assert.AreEqual(2, second_session.Records.Count);

            Assert.IsTrue(first_session.Records[0].Type == "Warning" && first_session.Records[0].SubType == "DataType");
            Assert.IsTrue(first_session.Records[1].Type == "Warning" && first_session.Records[1].SubType == "DataType");
            Assert.IsTrue(first_session.Records[2].Type == "Warning" && first_session.Records[2].SubType == "DataType");
            Assert.IsTrue(first_session.Records[3].Type == "Warning" && first_session.Records[3].SubType == "DataType");

            Assert.IsTrue(second_session.Records[0].Type == "Warning" && second_session.Records[0].SubType == "DataType");
            Assert.IsTrue(second_session.Records[1].Type == "Warning" && second_session.Records[1].SubType == "DataType");
        }
        public void XmlErrorLog_Load_Visio2013_1()
        {
            string input_filename = this.GetTestResultsOutPath(@"datafiles\XMLErrorLog_Visio_2013_1.txt");

            Assert.IsTrue(File.Exists(input_filename));
            var log = new VisioAutomation.Application.Logging.XmlErrorLog(input_filename);

            Assert.AreEqual(4, log.FileSessions.Count);

            var first_session  = log.FileSessions[0];
            var second_session = log.FileSessions[1];
            var third_session  = log.FileSessions[2];
            var fourth_session = log.FileSessions[3];

            Assert.AreEqual(0, first_session.Records.Count);
            Assert.AreEqual(0, second_session.Records.Count);
            Assert.AreEqual(0, third_session.Records.Count);
            Assert.AreEqual(2, fourth_session.Records.Count);

            Assert.IsTrue(first_session.Source.EndsWith("template_router.vdx"));
            Assert.IsTrue(second_session.Source.EndsWith("COMPS_U.VSSX"));
            Assert.IsTrue(third_session.Source.EndsWith("PERIPH_U.VSSX"));
            Assert.IsTrue(fourth_session.Source.EndsWith("vdx_with_warnings_1.vdx"));

            Assert.IsTrue(first_session.Records.Count == 0);
        }
        public void XmlErrorLog_Load_Visio2013_1()
        {
            string input_filename = this.GetTestResultsOutPath(@"datafiles\XMLErrorLog_Visio_2013_1.txt");

            Assert.IsTrue(File.Exists(input_filename));
            var log = new VisioAutomation.Application.Logging.XmlErrorLog(input_filename);
            Assert.AreEqual(4, log.FileSessions.Count);

            var first_session = log.FileSessions[0];
            var second_session = log.FileSessions[1];
            var third_session = log.FileSessions[2];
            var fourth_session = log.FileSessions[3];

            Assert.AreEqual(0, first_session.Records.Count);
            Assert.AreEqual(0, second_session.Records.Count);
            Assert.AreEqual(0, third_session.Records.Count);
            Assert.AreEqual(2, fourth_session.Records.Count);

            Assert.IsTrue(first_session.Source.EndsWith("template_router.vdx"));
            Assert.IsTrue(second_session.Source.EndsWith("COMPS_U.VSSX"));
            Assert.IsTrue(third_session.Source.EndsWith("PERIPH_U.VSSX"));
            Assert.IsTrue(fourth_session.Source.EndsWith("vdx_with_warnings_1.vdx"));

            Assert.IsTrue(first_session.Records.Count==0);
        }
        public void XmlErrorLog_Load_Visio2010_1()
        {
            string input_filename = this.GetTestResultsOutPath(@"datafiles\XMLErrorLog_Visio_2010_1.txt");

            Assert.IsTrue(File.Exists(input_filename));
            var log = new VisioAutomation.Application.Logging.XmlErrorLog(input_filename);
            Assert.AreEqual(2,log.FileSessions.Count);

            var first_session = log.FileSessions[0];
            var second_session = log.FileSessions[1];

            Assert.IsTrue(first_session.Source.EndsWith("vdx_with_warnings_1.vdx"));
            Assert.IsTrue(second_session.Source.EndsWith("VDX_Tests.VDX_MultiPageDocument2015-10-1--20-09-10.vdx"));

            Assert.AreEqual(4, first_session.Records.Count);
            Assert.AreEqual(2, second_session.Records.Count);

            Assert.IsTrue(first_session.Records[0].Type == "Warning" && first_session.Records[0].SubType=="DataType");
            Assert.IsTrue(first_session.Records[1].Type == "Warning" && first_session.Records[1].SubType == "DataType");
            Assert.IsTrue(first_session.Records[2].Type == "Warning" && first_session.Records[2].SubType == "DataType");
            Assert.IsTrue(first_session.Records[3].Type == "Warning" && first_session.Records[3].SubType == "DataType");

            Assert.IsTrue(second_session.Records[0].Type == "Warning" && second_session.Records[0].SubType == "DataType");
            Assert.IsTrue(second_session.Records[1].Type == "Warning" && second_session.Records[1].SubType == "DataType");
        }
        public void VSD_Load_Visio2013()
        {
            string input_filename = this.GetTestResultsOutPath(@"datafiles\VSDX_Log_Visio_2013.txt");

            Assert.IsTrue(File.Exists(input_filename));
            var log = new VisioAutomation.Application.Logging.XmlErrorLog(input_filename);

            Assert.AreEqual(51, log.FileSessions.Count);
        }
        public void VSD_Load_Visio2013()
        {
            string input_filename = this.GetTestResultsOutPath(@"datafiles\VSDX_Log_Visio_2013.txt");

            Assert.IsTrue(File.Exists(input_filename));
            var log = new VisioAutomation.Application.Logging.XmlErrorLog(input_filename);
            Assert.AreEqual(51, log.FileSessions.Count);


        }
Example #7
0
        public void VerifyDocCanBeLoaded(string filename)
        {
            var    app         = new IVisio.Application();
            var    version     = VA.Application.ApplicationHelper.GetVersion(app);
            string logfilename = VA.Application.ApplicationHelper.GetXmlErrorLogFilename(app);

            VA.Application.Logging.XmlErrorLog log_before = null;
            var old_fileinfo = new FileInfo(logfilename);

            if (File.Exists(logfilename))
            {
                log_before = new VA.Application.Logging.XmlErrorLog(logfilename);
            }

            var time = DateTime.Now;

            this.TryOpen(app.Documents, filename); // this causes the doc to load no matter what the error

            VA.Application.Logging.XmlErrorLog log_after = null;
            if (File.Exists(logfilename))
            {
                log_after = new VA.Application.Logging.XmlErrorLog(logfilename);
            }

            if (log_before != null && log_after == null)
            {
                Assert.Fail("Invalid case for all visio versions - if it existed before it must exist after");
                return;
            }

            if (log_before == null && log_after == null)
            {
                // Didn't exist before, didn't exist after - that's fine - the file loaded with no issues
                return;
            }

            // log_after exists
            VDX_Tests.VerifyNoErrorsInLog(log_after, filename, logfilename, version, time);

            // Force close all docs
            app.Quit(true);
        }
Example #8
0
        public void VerifyDocCanBeLoaded(string filename)
        {
            var app = new IVisio.Application();
            var version = VA.Application.ApplicationHelper.GetVersion(app);
            string logfilename = VA.Application.ApplicationHelper.GetXMLErrorLogFilename(app);

            VA.Application.Logging.XmlErrorLog log_before = null;
            var old_fileinfo = new FileInfo(logfilename);

            if (File.Exists(logfilename))
            {
                log_before = new VA.Application.Logging.XmlErrorLog(logfilename);
            }

            var time = DateTime.Now;
            this.TryOpen(app.Documents, filename); // this causes the doc to load no matter what the error 

            VA.Application.Logging.XmlErrorLog log_after = null;
            if (File.Exists(logfilename))
            {
                log_after = new VA.Application.Logging.XmlErrorLog(logfilename);
            }

            if (log_before != null && log_after == null)
            {
                Assert.Fail("Invalid case for all visio versions - if it existed before it must exist after");
                return;
            }
 
            if (log_before == null && log_after == null)
            {
                // Didn't exist before, didn't exist after - that's fine - the file loaded with no issues
                return;
            }

            // log_after exists
            VDX_Tests.VerifyNoErrorsInLog(log_after, filename, logfilename, version, time);

            VA.Documents.DocumentHelper.ForceCloseAll(app.Documents);
            app.Quit();
        }
Example #9
0
        public void VDX_DetectLoadWarnings()
        {
            string input_filename = this.GetTestResultsOutPath(@"datafiles\vdx_with_warnings_1.vdx");

            // Load the VDX
            var    app         = new IVisio.Application();
            var    version     = VA.Application.ApplicationHelper.GetVersion(app);
            string logfilename = VA.Application.ApplicationHelper.GetXmlErrorLogFilename(app);

            var doc = this.TryOpen(app.Documents, input_filename);

            // See what happened
            var log_after           = new VA.Application.Logging.XmlErrorLog(logfilename);
            var most_recent_session = log_after.FileSessions[0];
            var warnings            = most_recent_session.Records.Where(r => r.Type == "Warning").ToList();
            var errors = most_recent_session.Records.Where(r => r.Type == "Error").ToList();

            // Verify
            int expected_errors   = 0; // this VDX should not report any errors
            int expected_warnings = 4; // this VDX should contain four warnings for Visio2010 and two warnings for Visio 2013

            if (version.Major >= 15)
            {
                expected_warnings = 2;
            }

            Assert.AreEqual(expected_errors, errors.Count);     // this VDX should not report any errors
            Assert.AreEqual(expected_warnings, warnings.Count); // this VDX should contain exactly two warnings
            Assert.AreEqual(1, app.Documents.Count);

            // Cleanup
            // Force close all docs
            var docs = app.Documents.ToEnumerable().ToList();

            foreach (var d in docs)
            {
                d.Close(true);
            }
            app.Quit(true);
        }
Example #10
0
        private static void VerifyNoErrorsInLog(VA.Application.Logging.XmlErrorLog log_after, string filename, string logfilename, Version version, DateTime opentime)
        {
            int duration         = 2;
            var lower_time_bound = opentime;
            var upper_time_bound = opentime.AddSeconds(duration);

            // First see of any sessions matching the source exist
            // If not, then the load must have been successful
            var all_sessions_from_source = log_after.FileSessions.Where(s => s.Source == filename).ToList();

            if (all_sessions_from_source.Count < 1)
            {
                return;
            }

            // From that set of sessions, find the one closest in time to when we
            // asked Visio to open the file.
            // If none could be found, then then we assume no error could be found
            // NOTE: It would be better not to have to rely on a time duration.
            var sessions_near_in_time =
                all_sessions_from_source.Where(c => (lower_time_bound <= c.StartTime && c.StartTime <= upper_time_bound)).ToList();

            if (sessions_near_in_time.Count < 1)
            {
                // couldn't find any in the time period. We'll have to assume no error could be found.
                return;
            }

            var target_session = all_sessions_from_source[0];

            var warnings = target_session.Records.Where(rec => rec.Type == "Warning").ToList();
            var errors   = target_session.Records.Where(rec => rec.Type == "Error").ToList();

            if (errors.Count > 0)
            {
                string msg = string.Format("XML Error Log {0} contains an error", logfilename);
                Assert.Fail(msg);
            }
        }
Example #11
0
        public void VDX_DetectLoadWarnings()
        {
            string input_filename = this.GetTestResultsOutPath(@"datafiles\vdx_with_warnings_1.vdx");
 
            // Load the VDX
            var app = new IVisio.Application();
            var version = VA.Application.ApplicationHelper.GetVersion(app);
            string logfilename = VA.Application.ApplicationHelper.GetXMLErrorLogFilename(app);

            var doc = this.TryOpen(app.Documents, input_filename);
            
            // See what happened
            var log_after = new VA.Application.Logging.XmlErrorLog(logfilename);
            var most_recent_session = log_after.FileSessions[0];
            var warnings = most_recent_session.Records.Where(r => r.Type == "Warning").ToList();
            var errors = most_recent_session.Records.Where(r => r.Type == "Error").ToList();

            // Verify
            int expected_errors = 0;  // this VDX should not report any errors
            int expected_warnings = 4; // this VDX should contain four warnings for Visio2010 and two warnings for Visio 2013         
            if (version.Major >= 15)
            {
                expected_warnings = 2;
            }

            Assert.AreEqual(expected_errors, errors.Count); // this VDX should not report any errors
            Assert.AreEqual(expected_warnings, warnings.Count); // this VDX should contain exactly two warnings                                
            Assert.AreEqual(1, app.Documents.Count);

            // Cleanup
            VA.Documents.DocumentHelper.ForceCloseAll(app.Documents);
            app.Quit(true);
        }