public void CustomProjectParser_CanParseSampleCsProjFile_ForDebugConfig() { var result = validCsProjFile.ParseProject("debug"); result.Configuration.Should().Be("debug"); result.OutputPath.ToString().Should().Be("bin/Debug"); }
public void CustomProjectParser_CanParseSample2017CsProjNetCoreFile_ForDebugConfig() { var result = valid2017CsProjNetcoreFile.ParseProject("debug"); result.Configuration.Should().Be("debug"); result.OutputPath.ToString().Should().Be("bin/custom"); result.OutputType.Should().Be("Exe"); result.GetAssemblyFilePath().FullPath.Should().Be("bin/custom/project.exe"); }
public void ParseProject_NetCore_DefineConstants_ReturnsCorrectFallbackIfConditionsDontMatch() { var projString = @"<Project sdk=""Microsoft.NET.Sdk""><DefineConstants>Hoka;Loca;Moca;</DefineConstants><PropertyGroup Condition=""'$(Configuration)|$(Platform)'=='test|shoes'""><DefineConstants>Birth;Death;Taxes;</DefineConstants></PropertyGroup></Project>"; var file = new FakeFile(ProjectFileHelpers.GetNetCoreProjectWithString(projString)); file.ParseProject("Roca", "shoes").NetCore.DefineConstants.Should().BeEquivalentTo("Hoka", "Loca", "Moca"); }
public void ParseProject_GetsCorrectOutputPath_FallbackConfigPlatformAndTargetFramework() { var file = new FakeFile(ProjectFileHelpers.GetNetCoreProjectWithString(@"<PropertyGroup> <TargetFramework>NetStandard1.6</TargetFramework> </PropertyGroup>")); file.ParseProject("test", "x86").OutputPath.ToString().Should().Be("bin/x86/test/NetStandard1.6"); }
public void ParseProject_GetsCorrectOutputPath_UsesConditionOverride() { var file = new FakeFile(ProjectFileHelpers.GetNetCoreProjectWithString(@"<PropertyGroup Condition=""'$(Configuration)|$(Platform)'=='Test|x86'""> <OutputPath>bin\wayhey\</OutputPath> </PropertyGroup>")); file.ParseProject("test", "x86").OutputPath.ToString().Should().Be("bin/wayhey"); }
public void CustomProjectParser_CanParseSample2017CsProjNetStandardFile_ForReleaseConfig() { var result = valid2017CsProjNetstandardFile.ParseProject("debug"); result.Configuration.Should().Be("debug"); result.OutputPath.ToString().Should().Be("bin/wayhey"); result.OutputType.Should().Be("Library"); result.GetAssemblyFilePath().FullPath.Should().Be("bin/wayhey/project.dll"); }
public void ParseProject_NetCore_NuspecProperties_ReturnsIfSet() { var file = new FakeFile(ProjectFileHelpers.GetNetCoreProjectWithElement("NuspecProperties", "edgar=poe;jimmini=cricket;")); var props = file.ParseProject("test").NetCore.NuspecProperties; props.Should().HaveCount(2); props["edgar"].Should().Be("poe"); props["jimmini"].Should().Be("cricket"); }
public void IsWebApplication_ReturnsTrue_WhenProjectIsOfTypeWebApplication() { // arrange var sut = validCsProjWebApplicationFile.ParseProject("debug"); // act var webApp = sut.IsWebApplication(); // assert webApp.Should().BeTrue(); }
public void ParseProject_NetCore_PackageReference_ReturnsWithVersionAsChildElement() { var packageRef = @"<PackageReference Include=""Cake.Core""> <Version>1.3.1</Version> </PackageReference>"; var file = new FakeFile(ProjectFileHelpers.GetNetCoreProjectWithString(packageRef)); var references = file.ParseProject("test").NetCore.PackageReferences; references.Should().HaveCount(1); var first = references.First(); first.Version.Should().Be("1.3.1"); }
public void ParseProject_NetCore_PackageReference_ReturnsWithIncludeAsChildElement() { var packageRef = @"<PackageReference> <Include>Cake.Core</Include> </PackageReference>"; var file = new FakeFile(ProjectFileHelpers.GetNetCoreProjectWithString(packageRef)); var references = file.ParseProject("test").NetCore.PackageReferences; references.Should().HaveCount(1); var first = references.First(); first.Name.Should().Be("Cake.Core"); }
public void ParseProject_NetCore_PackageReference_ReturnsWithTargetFrameworkInAttributeIfSet() { var packageRef = @"<ItemGroup> <PackageReference Include=""System.Collections.Immutable"" Version=""1.3.1"" Condition=""'$(TargetFramework)'== 'net451'"" /> </ItemGroup>"; var file = new FakeFile(ProjectFileHelpers.GetNetCoreProjectWithString(packageRef)); var references = file.ParseProject("test").NetCore.PackageReferences; references.Should().HaveCount(1); var first = references.First(); first.ExcludeAssets.Should().BeNull(); first.IncludeAssets.Should().BeNull(); first.PrivateAssets.Should().BeNull(); first.Name.Should().Be("System.Collections.Immutable"); first.TargetFramework.Should().Be("net451"); first.Version.Should().Be("1.3.1"); }
public void ParseProject_NetCore_Targets_ReturnsIfSet() { var targetString = @"<Target Name=""Jogging"" BeforeTargets=""Stretch;Jump;;"" AfterTargets=""IceBath"" DependsOn=""Mood""> <Exec Command=""hop.cmd"" /> <Exec Command=""skip.cmd"" /> </Target>"; var file = new FakeFile(ProjectFileHelpers.GetNetCoreProjectWithString(targetString)); var targets = file.ParseProject("test").NetCore.Targets; var first = targets.Should().ContainSingle().Subject; first.BeforeTargets.Should().BeEquivalentTo("Stretch", "Jump"); first.AfterTargets.Should().BeEquivalentTo("IceBath"); first.DependsOn.Should().BeEquivalentTo("Mood"); first.Name.Should().Be("Jogging"); first.Executables.Should().HaveCount(2); first.Executables.First().Command.Should().Be("hop.cmd"); first.Executables.Last().Command.Should().Be("skip.cmd"); }
public void ParseProject_NetCore_DotNetCliToolReferences_ReturnsIfSet() { var cliRefs = @"<ItemGroup> <DotNetCliToolReference Include=""Blerk1"" Version=""1.0.0"" /> <DotNetCliToolReference Include=""Blerk2"" Version=""2.3.4"" /> </ItemGroup>"; var file = new FakeFile(ProjectFileHelpers.GetNetCoreProjectWithString(cliRefs)); var references = file.ParseProject("test").NetCore.DotNetCliToolReferences; references.Should().HaveCount(2); var first = references.First(); first.Name.Should().Be("Blerk1"); first.Version.Should().Be("1.0.0"); var last = references.Last(); last.Name.Should().Be("Blerk2"); last.Version.Should().Be("2.3.4"); }
public void ParseProject_NetCore_ProjectReferences_ReturnIfSet() { var file = new FakeFile(ProjectFileHelpers.GetNetCoreProjectWithString("<ProjectReference Include=\"..\\a\\b.csproj\" /><ProjectReference Include=\"..\\c\\d.csproj\" />"), "c:/project/src/x.csproj"); var references = file.ParseProject("test").NetCore.ProjectReferences; references.Should().HaveCount(2); var first = references.First(); first.Name.Should().Be("b"); first.RelativePath.Should().Be("../a/b.csproj"); first.FilePath.ToString().Should().Be("c:/project/a/b.csproj"); first.Package.Should().BeNull(); first.Project.Should().BeNull(); var second = references.Last(); second.Name.Should().Be("d"); second.RelativePath.Should().Be("../c/d.csproj"); second.FilePath.ToString().Should().Be("c:/project/c/d.csproj"); second.Package.Should().BeNull(); second.Project.Should().BeNull(); }
public void ParseProject_NetCore_SignAssembly_ReturnsIfSet() { var file = new FakeFile(ProjectFileHelpers.GetNetCoreProjectWithElement("SignAssembly", "TRUE")); file.ParseProject("test").NetCore.SignAssembly.Should().BeTrue(); }
public void ParseProject_NetCore_TargetFrameworks_TargetFrameworkFallback() { var file = new FakeFile(ProjectFileHelpers.GetNetCoreProjectWithElement("TargetFramework", "net45")); file.ParseProject("test").NetCore.TargetFrameworks.Should().BeEquivalentTo("net45"); }
public void ParseProject_GetsCorrectOutputType_WhenExeSpecified() { var file = new FakeFile(ProjectFileHelpers.GetNetCoreProjectWithElement("OutputType", "Exe")); file.ParseProject("test").OutputType.Should().Be("Exe"); }
public void ParseProject_NetCore_TreatWarningsAsErrors_ReturnsIfSet() { var file = new FakeFile(ProjectFileHelpers.GetNetCoreProjectWithElement("TreatWarningsAsErrors", "true")); file.ParseProject("test").NetCore.TreatWarningsAsErrors.Should().BeTrue(); }
public void ParseProject_NetCore_Version_ReturnsIfSemver() { var file = new FakeFile(ProjectFileHelpers.GetNetCoreProjectWithString("<VersionPrefix>1.2.3</VersionPrefix><VersionSuffix>alpha5813</VersionSuffix><Version>8.9.10</Version>")); file.ParseProject("test").NetCore.Version.Should().Be("1.2.3-alpha5813"); }
public void ParseProject_NetCore_WebSdk_ReturnsIfSet() { var file = new FakeFile(ProjectFileHelpers.GetNetCoreWebProjectWithString(null)); file.ParseProject("test").NetCore.Sdk.Should().BeEquivalentTo("Microsoft.Net.Sdk.Web"); }
public void ParseProject_NetCore_TargetFrameworks_ReturnsIfSet() { var file = new FakeFile(ProjectFileHelpers.GetNetCoreProjectWithElement("TargetFrameworks", "net45;net46;###**%%.1;;")); file.ParseProject("test").NetCore.TargetFrameworks.Should().BeEquivalentTo("net45", "net46", "###**%%.1"); }
public void ParseProject_NetCore_Version_VersionFallback() { var file = new FakeFile(ProjectFileHelpers.GetNetCoreProjectWithElement("Version", "1.2.3.5")); file.ParseProject("test").NetCore.Version.Should().Be("1.2.3.5"); }
public void ParseProject_NetCore_FileVersion_ReturnsIfSet() { var file = new FakeFile(ProjectFileHelpers.GetNetCoreProjectWithElement("FileVersion", "1.4.3.5")); file.ParseProject("test").NetCore.FileVersion.Should().Be("1.4.3.5"); }
public void ParseProject_GetsCorrectOutputType_WhenNoneSpecified() { var file = new FakeFile(ProjectFileHelpers.GetNetCoreProjectWithElement("AssemblyName", "a")); file.ParseProject("test").OutputType.Should().Be("Library"); }
public void CustomProjectParser_ShouldParseProjectWithAbsolutePaths() { var result = validCsProjWithAbsoluteFilePaths.ParseProject("debug"); result.References.Should().Contain(x => x.HintPath.FullPath == "C:/Program Files (x86)/Reference Assemblies/Microsoft/Framework/.NETFramework/v4.5.2/System.dll"); }
public void ParseProject_NetCore_ThreadPoolMinThreads_ReturnsIfSet() { var file = new FakeFile(ProjectFileHelpers.GetNetCoreProjectWithElement("ThreadPoolMinThreads", "3")); file.ParseProject("test").NetCore.RuntimeOptions.ThreadPoolMinThreads.Should().Be(3); }
public void ParseProject_NetCore_Version_DefaultFallback() { var file = new FakeFile(ProjectFileHelpers.GetNetCoreProjectWithString(null)); file.ParseProject("test").NetCore.Version.Should().Be("1.0.0"); }
public void ParseProject_NetCore_RuntimeIdentifiers_ReturnsIfSet() { var file = new FakeFile(ProjectFileHelpers.GetNetCoreProjectWithElement("RuntimeIdentifiers", "charlie;delta;echo;;")); file.ParseProject("test").NetCore.RuntimeIdentifiers.Should().BeEquivalentTo("charlie", "delta", "echo"); }
public void CustomProjectParser_CanParseCsProjWithConditionalReferences() { var result = validCsProjConditionalReferenceFile.ParseProject("debug"); result.References.Should().HaveCount(8).And.Contain(x => x.Name.Equals("Microsoft.VisualStudio.QualityTools.UnitTestFramework")); }
public void ParseProject_NetCore_ServerGarbageCollection_ReturnsIfSet() { var file = new FakeFile(ProjectFileHelpers.GetNetCoreProjectWithElement("ServerGarbageCollection", "true")); file.ParseProject("test").NetCore.RuntimeOptions.ServerGarbageCollection.Should().BeTrue(); }