public void Can_Add_Reference()
        {
            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);

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

            var actualItem = parser.GetCustomData()
                .Where(
                    p =>
                        p.Category == "Reference" && p.Type == "SqlSchema" &&
                        p.Items.Any(item => item.Name == "FileName" && item.Value == fileName));

            Assert.IsNotNull(actualItem);
        }
Exemplo n.º 2
0
        private void AddReferences()
        {
            var parser = new HeaderWriter(_outputPath, new DacHacFactory());
            foreach (var reference in _references)
            {
                parser.AddCustomData(reference.GetData());
            }

            parser.Close();
        }