public void Should_Combine_The_Two_Paths() { // Given var path = new ConvertableDirectoryPath("./root"); // When var result = path + new DirectoryPath("other"); // Then Assert.Equal("root/other", result.Path.FullPath); }
public void Should_Return_A_New_Convertable_Directory_Path() { // Given var path = new ConvertableDirectoryPath("./root"); // When var result = path + new ConvertableDirectoryPath("other"); // Then Assert.IsType <ConvertableDirectoryPath>(result); }
public void Should_Return_String_Representation_Of_Path() { // Given var path = new ConvertableDirectoryPath("./foo/bar"); // When var result = path.ToString(); // Then Assert.Equal("foo/bar", result); }
public void Should_Return_A_Representation_Of_The_Current_Instance() { // Given var path = new ConvertableDirectoryPath("./root"); // When var result = (string)path; // Then Assert.Equal("root", result); }
public void Should_Return_Path_Provided_To_Constructor() { // Given var path = new DirectoryPath("./root"); // When var result = new ConvertableDirectoryPath(path).Path; // Then Assert.Same(path, result); }
public Build() { Cake.Log.Verbosity = Verbosity.Diagnostic; const string solutionName = "dotnettar"; const string solutionFileName = solutionName + ".sln"; string configuration = Cake.Argument("configuration", "Release"); IEnumerable <SolutionProject> projects = Cake.ParseSolution(solutionFileName) .Projects .Where(p => !(p is SolutionFolder) && p.Name != "CodeCakeBuilder"); // We do not publish .Tests projects for this solution. IEnumerable <SolutionProject> projectsToPublish = projects .Where(p => !p.Path.Segments.Contains("Tests")); // The SimpleRepositoryInfo should be computed once and only once. SimpleRepositoryInfo gitInfo = Cake.GetSimpleRepositoryInfo(); // This default global info will be replaced by Check-Repository task. // It is allocated here to ease debugging and/or manual work on complex build script. // Git .ignore file should ignore this folder. // Here, we name it "Releases" (default , it could be "Artefacts", "Publish" or anything else, // but "Releases" is by default ignored in https://github.com/github/gitignore/blob/master/VisualStudio.gitignore. ConvertableDirectoryPath releasesDir = Cake.Directory("CodeCakeBuilder/Releases"); CheckRepositoryInfo globalInfo = new CheckRepositoryInfo { Version = gitInfo.SafeNuGetVersion }; Task("Check-Repository") .Does(() => { globalInfo = StandardCheckRepository(projectsToPublish, gitInfo); }); Task("Clean") .Does(() => { // Avoids cleaning CodeCakeBuilder itself! Cake.CleanDirectories("**/bin/" + configuration, d => !d.Path.Segments.Contains("CodeCakeBuilder")); Cake.CleanDirectories("**/obj/" + configuration, d => !d.Path.Segments.Contains("CodeCakeBuilder")); Cake.CleanDirectories(releasesDir); }); Task("Build") .IsDependentOn("Check-Repository") .IsDependentOn("Clean") .Does(() => { //StandardSolutionBuild( solutionFileName, gitInfo, globalInfo.BuildConfiguration ); }); Task("Create-NuGet-Packages") .WithCriteria(() => gitInfo.IsValid) .IsDependentOn("Build") .Does(() => { StandardCreateNuGetPackages(releasesDir, projectsToPublish, gitInfo, globalInfo.BuildConfiguration); }); Task("Unit-Testing") .IsDependentOn("Build") .WithCriteria(() => Cake.InteractiveMode() == InteractiveMode.NoInteraction || Cake.ReadInteractiveOption("RunUnitTests", "Run Unit Tests?", 'Y', 'N') == 'Y') .Does(() => { //StandardUnitTests( globalInfo.BuildConfiguration, projects.Where( p => p.Name.EndsWith( ".Tests" ) ) ); }); Task("Push-NuGet-Packages") .WithCriteria(() => gitInfo.IsValid) .IsDependentOn("Create-NuGet-Packages") .Does(() => { StandardPushNuGetPackages(globalInfo, releasesDir); }); Task("Default") .IsDependentOn("Push-NuGet-Packages"); }