Пример #1
0
        public void Adding_Reference_Also_Creates_SqlCmdVar()
        {
            var          parser        = new HeaderParser(".\\Test.dacpac");
            string       fileName      = string.Format("c:\\bloonblah{0}.dacpac", Guid.NewGuid().ToString().Replace("{", "").Replace("}", "").Replace("-", ""));
            const string logicalName   = "blooblah.dacpac";
            const string externalParts = "[$(blooblah)]";
            const string suppressMissingDependenciesErrors = "False";

            var newCustomData = new CustomData("Reference", "SqlSchema");

            newCustomData.AddMetadata("FileName", fileName);
            newCustomData.AddMetadata("LogicalName", logicalName);
            newCustomData.AddMetadata("ExternalParts", externalParts);
            newCustomData.AddMetadata("SupressMissingDependenciesErrors", suppressMissingDependenciesErrors);
            newCustomData.RequiredSqlCmdVars.Add("BloopyBloo");

            var writer = new HeaderWriter(".\\Test.dacpac", new DacHacFactory());

            writer.AddCustomData(newCustomData);
            writer.Close();

            var actualItem = parser.GetCustomData()
                             .Where(
                p =>
                p.Category == "SqlCmdVariables" && p.Type == "SqlCmdVariable" &&
                p.Items.Any(item => item.Name == "BloopyBloo"));

            Assert.IsNotNull(actualItem);
        }
Пример #2
0
        public void existing_metadata_items_are_overwritten()
        {
            const string expected = "111";

            var cd = new CustomData("a", "b");

            cd.AddMetadata("d", "e");
            cd.AddMetadata("d", expected);

            Assert.AreEqual(1, cd.Items.Count);
            Assert.AreEqual(expected, cd.Items.First().Value);
        }