public void CreatioPkg_Create_CheckPackageStructure() { var oldEnvironment = Environment.CurrentDirectory; Environment.CurrentDirectory = Path.Combine(Environment.CurrentDirectory, ResultDir); var pkg = CreatioPackage.CreatePackage(PackageName, Maintainer); Environment.CurrentDirectory = oldEnvironment; pkg.Create(); File(Path.Combine(pkg.FullPath, CreatioPackage.DescriptorName)).Should().Exist(); File(Path.Combine(pkg.FullPath, PackageName + "." + CreatioPackage.CsprojExtension)).Should().Exist(); File(Path.Combine(pkg.FullPath, CreatioPackage.PackageConfigName)).Should().Exist(); File(Path.Combine(pkg.FullPath, CreatioPackage.PropertiesDirName + "\\" + CreatioPackage.AssemblyInfoName)) .Should().Exist(); File(Path.Combine(pkg.FullPath, "Files\\cs", "EmptyClass.cs")).Should().Exist(); File(Path.Combine(pkg.FullPath, "Assemblies" + "\\" + CreatioPackage.PlaceholderFileName)).Should().Exist(); File(Path.Combine(pkg.FullPath, "Data" + "\\" + CreatioPackage.PlaceholderFileName)).Should().Exist(); File(Path.Combine(pkg.FullPath, "Resources" + "\\" + CreatioPackage.PlaceholderFileName)).Should().Exist(); File(Path.Combine(pkg.FullPath, "Schemas" + "\\" + CreatioPackage.PlaceholderFileName)).Should().Exist(); File(Path.Combine(pkg.FullPath, "SqlScripts" + "\\" + CreatioPackage.PlaceholderFileName)).Should().Exist(); Directory(Path.Combine(pkg.FullPath, "Assemblies")).Should().Exist(); Directory(Path.Combine(pkg.FullPath, "Data")).Should().Exist(); Directory(Path.Combine(pkg.FullPath, "Resources")).Should().Exist(); Directory(Path.Combine(pkg.FullPath, "Schemas")).Should().Exist(); Directory(Path.Combine(pkg.FullPath, "SqlScripts")).Should().Exist(); Directory(Path.Combine(pkg.FullPath, "Files")).Should().Exist(); Directory(Path.Combine(pkg.FullPath, "Files\\cs")).Should().Exist(); }
public void CreatioPkg_Create_CheckCorrectTplFilePathGettingFromPath() { var oldCD = Environment.CurrentDirectory; var oldPath = Environment.GetEnvironmentVariable("PATH"); Environment.CurrentDirectory = Path.Combine(Environment.CurrentDirectory, ResultDir); Environment.SetEnvironmentVariable("PATH", oldCD + ";C:\\Program Files"); var pkg = CreatioPackage.CreatePackage(PackageName, Maintainer); pkg.Create(); Environment.CurrentDirectory = oldCD; Environment.SetEnvironmentVariable("PATH", oldPath); var resultPath = Path.Combine(pkg.FullPath, CreatioPackage.PackageConfigName); var samplePath = Path.Combine(Environment.CurrentDirectory, ExpectFilesDir, CreatioPackage.PackageConfigName); File(resultPath).Should().Exist(); File.ReadAllText(resultPath).Should().BeEquivalentTo(File.ReadAllText(samplePath)); }
public override int Execute(NewPkgOptions options) { var settings = _settingsRepository.GetEnvironment(); try { CreatioPackage package = CreatioPackage.CreatePackage(options.Name, settings.Maintainer); package.Create(); if (!string.IsNullOrEmpty(options.Rebase) && options.Rebase != "nuget") { _referenceCommand.Execute(new ReferenceOptions { Path = package.FullPath, ReferenceType = options.Rebase }); package.RemovePackageConfig(); } Console.WriteLine("Done"); return(0); } catch (Exception e) { Console.WriteLine(e); return(1); } }