public void GetConnectionString_InvalidFile_FileNotFoundException()
        {
            var fullPath = DiskOnFile.CreatePhysicalFile(ODC_FILE, "NBi.Testing.Integration.Core.Resources." + ODC_FILE);
            var parser   = new OfficeDataConnectionFileParser(Path.GetDirectoryName(fullPath) + Path.DirectorySeparatorChar);

            Assert.Throws <FileNotFoundException>(delegate { parser.GetConnectionString("NonExisting.odc"); });
        }
        public void GetConnectionString_ValidAbsoluteFile_CorrectConnectionString()
        {
            var fullPath         = DiskOnFile.CreatePhysicalFile(ODC_FILE, "NBi.Testing.Integration.Core.Resources." + ODC_FILE);
            var parser           = new OfficeDataConnectionFileParser(Path.GetDirectoryName(fullPath));
            var connectionString = parser.GetConnectionString(fullPath);

            Assert.That(connectionString, Is.EqualTo("Provider=MSOLAP.7;Integrated Security=ClaimsToken;Identity Provider=AAD;Data Source=https://analysis.windows.net/powerbi/api;;Initial Catalog=sobe_wowvirtualserver-ccdf3d76-59d9-4e10-83e8-82eb0d27d1e9;Location=https://wabi-north-europe-redirect.analysis.windows.net/xmla?vs=sobe_wowvirtualserver&db=ccdf3d76-59d9-4e10-83e8-82eb0d27d1e9;MDX Compatibility= 1; MDX Missing Member Mode= Error; Safety Options= 2; Update Isolation Level= 2"));
        }
        public void GetConnectionStringFromText_ValidText_CorrectConnectionString()
        {
            var text = "<html xmlns:o=\"urn:schemas-microsoft-com:office:office\"xmlns=\"http://www.w3.org/TR/REC-html40\"><head>";

            text += "  <odc:ConnectionString>Data Source=foo;initial catalog=bar</odc:ConnectionString> ";
            text += "</head></html>";

            var parser           = new OfficeDataConnectionFileParser();
            var connectionString = parser.GetConnectionStringFromText(text);

            Assert.That(connectionString, Is.EqualTo("Data Source=foo;initial catalog=bar"));
        }