public void PublishDacpac(string rFile) { var fs = new FileSystem(); var settings = new SqlSProcPublishSettings(); settings.TargetType = PublishTargetType.Dacpac; SetupProjectMocks("project.rproj"); var builder = Substitute.For <IDacPacBuilder>(); builder.When(x => x.Build(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <IEnumerable <string> >())).Do(c => { c.Args()[0].Should().Be("project.dacpac"); c.Args()[1].Should().Be("project"); var e = c.Args()[2] as IEnumerable <string>; e.Should().HaveCount(1); e.First().Should().StartWith("CREATE PROCEDURE ProcName"); }); _dacServices.GetBuilder(null).ReturnsForAnyArgs(builder); var files = new string[] { Path.Combine(_files.DestinationPath, rFile) }; var publisher = new SProcPublisher(_appShell, _pss, fs, _dacServices); publisher.Publish(settings, files); builder.Received(1).Build(Arg.Any <string>(), Arg.Any <string>(), Arg.Any <IEnumerable <string> >()); }
private void CreateDacPac(SqlSProcPublishSettings settings, IEnumerable <string> sprocFiles, string dacpacPath) { var project = _pss.GetSelectedProject <IVsHierarchy>()?.GetDTEProject(); var g = new SProcScriptGenerator(_fs); var sprocMap = g.CreateStoredProcedureScripts(settings, sprocFiles); var builder = _dacServices.GetBuilder(_appShell); builder.Build(dacpacPath, project.Name, sprocMap.Scripts); }