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); }
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); }