From 2dc908d46ed860bb520150ed78772e408d924f9a Mon Sep 17 00:00:00 2001 From: Edward Wilde Date: Tue, 28 Oct 2014 09:18:10 +0000 Subject: [PATCH 1/3] Implement configuration convention Closes #58 --- .gitignore | 3 +- .../ProjectConfigurationTests.cs | 55 ++++ .../SampleApp.Tests/SampleApp.Tests.csproj | 205 +++++++------ Samples/SampleApp.Tests/packages.config | 2 + Samples/SampleApp/SampleApp.csproj | 192 ++++++------ TestAssembly/TestAssembly.csproj | 194 ++++++------- .../ProjectPropertyGroupsTests.cs | 37 +++ ...mize_true_if_property_defined.approved.txt | 4 + ...s_should_have_platform_AnyCPU.approved.txt | 4 + .../ProjectBasedConventions.cs | 202 ++++++++----- ...debug_type_should_be_pdb_only.approved.txt | 9 + .../Properties/Resources.Designer.cs | 210 +++++++------- .../Properties/Resources.resx | 3 + .../ProjectFileWithReleaseDebugTypeFull.txt | 15 + .../TestStack.ConventionTests.Tests.csproj | 234 +++++++-------- .../ConventionData/ProjectPropertyGroup.cs | 72 +++++ .../ConventionData/ProjectPropertyGroups.cs | 36 +++ .../ConfigurationHasSpecificValue.cs | 71 +++++ .../TestStack.ConventionTests.csproj | 273 +++++++++--------- 19 files changed, 1108 insertions(+), 713 deletions(-) create mode 100644 Samples/SampleApp.Tests/ProjectConfigurationTests.cs create mode 100644 TestStack.ConventionTests.Tests/ConventionData/ProjectPropertyGroupsTests.cs create mode 100644 TestStack.ConventionTests.Tests/ProjectBasedConventions.all_configuration_groups_should_have_optimize_true_if_property_defined.approved.txt create mode 100644 TestStack.ConventionTests.Tests/ProjectBasedConventions.all_configuration_groups_should_have_platform_AnyCPU.approved.txt create mode 100644 TestStack.ConventionTests.Tests/ProjectBasedConventions.release_debug_type_should_be_pdb_only.approved.txt create mode 100644 TestStack.ConventionTests.Tests/Resources/ProjectFileWithReleaseDebugTypeFull.txt create mode 100644 TestStack.ConventionTests/ConventionData/ProjectPropertyGroup.cs create mode 100644 TestStack.ConventionTests/ConventionData/ProjectPropertyGroups.cs create mode 100644 TestStack.ConventionTests/Conventions/ConfigurationHasSpecificValue.cs diff --git a/.gitignore b/.gitignore index 20ccecc..20aa641 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,5 @@ _ReSharper.* ConventionTests*.nupkg _NCrunch* *.received.txt -*.orig \ No newline at end of file +*.orig +packages \ No newline at end of file diff --git a/Samples/SampleApp.Tests/ProjectConfigurationTests.cs b/Samples/SampleApp.Tests/ProjectConfigurationTests.cs new file mode 100644 index 0000000..1564718 --- /dev/null +++ b/Samples/SampleApp.Tests/ProjectConfigurationTests.cs @@ -0,0 +1,55 @@ +namespace SampleApp.Tests +{ + using System; + using System.IO; + using System.Xml.Linq; + using NSubstitute; + using NUnit.Framework; + using SampleApp.Domain; + using SampleApp.Dtos; + using TestStack.ConventionTests; + using TestStack.ConventionTests.ConventionData; + using TestStack.ConventionTests.Conventions; + using TestStack.ConventionTests.Internal; + + [TestFixture] + public class ProjectConfigurationTests + { + IProjectLocator projectLocator; + IProjectProvider projectProvider; + + [SetUp] + public void Setup() + { + projectLocator = Substitute.For(); + projectProvider = Substitute.For(); + projectProvider + .LoadProjectDocument(Arg.Any()) + .Returns(XDocument.Parse(File.ReadAllText(Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, @"..\..\..\SampleApp\SampleApp.csproj"))))); + } + + [Test] + public void debug_configurations_should_have_debug_type_pdb_only() + { + Convention.Is(new ConfigurationHasSpecificValue(ConfigurationType.Debug, "DebugType", "full"), new ProjectPropertyGroups(typeof(DomainClass).Assembly, projectProvider, projectLocator)); + } + + [Test] + public void debug_configurations_should_have_optimize_false() + { + Convention.Is(new ConfigurationHasSpecificValue(ConfigurationType.Debug, "Optimize", "false"), new ProjectPropertyGroups(typeof(DomainClass).Assembly, projectProvider, projectLocator)); + } + + [Test] + public void release_configurations_should_have_debug_type_pdb_only() + { + Convention.Is(new ConfigurationHasSpecificValue(ConfigurationType.Release, "DebugType", "pdbonly"), new ProjectPropertyGroups(typeof(DomainClass).Assembly, projectProvider, projectLocator)); + } + + [Test] + public void release_configurations_should_have_optimize_true() + { + Convention.Is(new ConfigurationHasSpecificValue(ConfigurationType.Release, "Optimize", "true"), new ProjectPropertyGroups(typeof(DomainClass).Assembly, projectProvider, projectLocator)); + } + } +} \ No newline at end of file diff --git a/Samples/SampleApp.Tests/SampleApp.Tests.csproj b/Samples/SampleApp.Tests/SampleApp.Tests.csproj index b30954c..f28ee96 100644 --- a/Samples/SampleApp.Tests/SampleApp.Tests.csproj +++ b/Samples/SampleApp.Tests/SampleApp.Tests.csproj @@ -1,95 +1,112 @@ - - - - - Debug - AnyCPU - {8FEF48A8-6FF5-4B65-B84A-6690D735C703} - Library - Properties - SampleApp.Tests - SampleApp.Tests - v4.0 - 512 - 208c48d3 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll - - - ..\..\packages\NUnit.2.6.2\lib\nunit.framework.dll - - - - - ..\..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.dll - - - ..\..\packages\Microsoft.AspNet.WebApi.Client.4.0.30506.0\lib\net40\System.Net.Http.Formatting.dll - - - ..\..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.WebRequest.dll - - - ..\..\packages\Microsoft.AspNet.WebApi.Core.4.0.30506.0\lib\net40\System.Web.Http.dll - - - - - - - - - - - - - - - - - - - - {56467A5A-7DD6-45B3-A84C-144A3C5D0C7A} - SampleApp - - - {955B0236-089F-434D-BA02-63A1E24C2B7C} - TestStack.ConventionTests - - - - - - - - - - + + + + + Debug + AnyCPU + {8FEF48A8-6FF5-4B65-B84A-6690D735C703} + Library + Properties + SampleApp.Tests + SampleApp.Tests + v4.0 + 512 + 208c48d3 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + False + ..\..\packages\Mono.Cecil.0.9.5.4\lib\net40\Mono.Cecil.dll + + + ..\..\packages\Mono.Cecil.0.9.5.4\lib\net40\Mono.Cecil.Mdb.dll + + + ..\..\packages\Mono.Cecil.0.9.5.4\lib\net40\Mono.Cecil.Pdb.dll + + + ..\..\packages\Mono.Cecil.0.9.5.4\lib\net40\Mono.Cecil.Rocks.dll + + + False + ..\..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll + + + ..\..\packages\NSubstitute.1.6.1.0\lib\NET40\NSubstitute.dll + + + ..\..\packages\NUnit.2.6.2\lib\nunit.framework.dll + + + + + ..\..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.dll + + + ..\..\packages\Microsoft.AspNet.WebApi.Client.4.0.30506.0\lib\net40\System.Net.Http.Formatting.dll + + + ..\..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.WebRequest.dll + + + ..\..\packages\Microsoft.AspNet.WebApi.Core.4.0.30506.0\lib\net40\System.Web.Http.dll + + + + + + + + + + + + + + + + + + + + + {56467A5A-7DD6-45B3-A84C-144A3C5D0C7A} + SampleApp + + + {955B0236-089F-434D-BA02-63A1E24C2B7C} + TestStack.ConventionTests + + + + + + + + + + \ No newline at end of file diff --git a/Samples/SampleApp.Tests/packages.config b/Samples/SampleApp.Tests/packages.config index 4db763b..bf58b37 100644 --- a/Samples/SampleApp.Tests/packages.config +++ b/Samples/SampleApp.Tests/packages.config @@ -3,6 +3,8 @@ + + \ No newline at end of file diff --git a/Samples/SampleApp/SampleApp.csproj b/Samples/SampleApp/SampleApp.csproj index d207768..b5dbae1 100644 --- a/Samples/SampleApp/SampleApp.csproj +++ b/Samples/SampleApp/SampleApp.csproj @@ -1,97 +1,97 @@ - - - - - Debug - AnyCPU - {56467A5A-7DD6-45B3-A84C-144A3C5D0C7A} - Library - Properties - SampleApp - SampleApp - v4.0 - 512 - b4eb12a9 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll - - - - - - - ..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.dll - - - ..\packages\Microsoft.AspNet.WebApi.Client.4.0.30506.0\lib\net40\System.Net.Http.Formatting.dll - - - ..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.WebRequest.dll - - - ..\packages\Microsoft.AspNet.WebApi.Core.4.0.30506.0\lib\net40\System.Web.Http.dll - - - - - - - - - - - - - - - - - - - SomeView.xaml - - - - - - - - - - Designer - - - - - Designer - MSBuild:Compile - - - - + + + + + Debug + AnyCPU + {56467A5A-7DD6-45B3-A84C-144A3C5D0C7A} + Library + Properties + SampleApp + SampleApp + v4.0 + 512 + b4eb12a9 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll + + + + + + + ..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.dll + + + ..\packages\Microsoft.AspNet.WebApi.Client.4.0.30506.0\lib\net40\System.Net.Http.Formatting.dll + + + ..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.WebRequest.dll + + + ..\packages\Microsoft.AspNet.WebApi.Core.4.0.30506.0\lib\net40\System.Web.Http.dll + + + + + + + + + + + + + + + + + + + SomeView.xaml + + + + + + + + + + Designer + + + + + Designer + MSBuild:Compile + + + + \ No newline at end of file diff --git a/TestAssembly/TestAssembly.csproj b/TestAssembly/TestAssembly.csproj index c47dd3f..26869f4 100644 --- a/TestAssembly/TestAssembly.csproj +++ b/TestAssembly/TestAssembly.csproj @@ -1,98 +1,98 @@ - - - - - Debug - AnyCPU - {D5A0D078-C660-4654-8A14-DDC816BEBC54} - Library - Properties - TestAssembly - TestAssembly - v4.0 - 512 - 0443d319 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - True - ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll - - - ..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll - - - - - ..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.dll - - - ..\packages\Microsoft.AspNet.WebApi.Client.4.0.30506.0\lib\net40\System.Net.Http.Formatting.dll - - - ..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.WebRequest.dll - - - ..\packages\Microsoft.AspNet.WebApi.Core.4.0.30506.0\lib\net40\System.Web.Http.dll - - - ..\packages\Microsoft.AspNet.WebApi.WebHost.4.0.30506.0\lib\net40\System.Web.Http.WebHost.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + AnyCPU + {D5A0D078-C660-4654-8A14-DDC816BEBC54} + Library + Properties + TestAssembly + TestAssembly + v4.0 + 512 + 0443d319 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + True + ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll + + + ..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll + + + + + ..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.dll + + + ..\packages\Microsoft.AspNet.WebApi.Client.4.0.30506.0\lib\net40\System.Net.Http.Formatting.dll + + + ..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.WebRequest.dll + + + ..\packages\Microsoft.AspNet.WebApi.Core.4.0.30506.0\lib\net40\System.Web.Http.dll + + + ..\packages\Microsoft.AspNet.WebApi.WebHost.4.0.30506.0\lib\net40\System.Web.Http.WebHost.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TestStack.ConventionTests.Tests/ConventionData/ProjectPropertyGroupsTests.cs b/TestStack.ConventionTests.Tests/ConventionData/ProjectPropertyGroupsTests.cs new file mode 100644 index 0000000..6843a8d --- /dev/null +++ b/TestStack.ConventionTests.Tests/ConventionData/ProjectPropertyGroupsTests.cs @@ -0,0 +1,37 @@ +namespace TestStack.ConventionTests.Tests.ConventionData +{ + using System.Linq; + using System.Xml.Linq; + using NSubstitute; + using NUnit.Framework; + using TestStack.ConventionTests.ConventionData; + using TestStack.ConventionTests.Internal; + using TestStack.ConventionTests.Tests.Properties; + + [TestFixture] + public class ProjectPropertyGroupsTests + { + IProjectProvider projectProvider; + + [SetUp] + public void Setup() + { + projectProvider = Substitute.For(); + } + + [Test] + public void can_parse_a_normal_project_file_to_read_global_debug_and_release_property_groups() + { + projectProvider + .LoadProjectDocument(Arg.Any()) + .Returns(XDocument.Parse(Resources.ProjectFileWithBinReference)); + + var projectGroups = new ProjectPropertyGroups(typeof(ProjectPropertyGroups).Assembly, projectProvider, Substitute.For()); + + Assert.That(projectGroups.PropertyGroups.Length, Is.EqualTo(3)); + Assert.That(projectGroups.PropertyGroups.Any(item => item.Debug)); + Assert.That(projectGroups.PropertyGroups.Any(item => item.Release)); + Assert.That(projectGroups.PropertyGroups.Any(item => item.Global)); + } + } +} \ No newline at end of file diff --git a/TestStack.ConventionTests.Tests/ProjectBasedConventions.all_configuration_groups_should_have_optimize_true_if_property_defined.approved.txt b/TestStack.ConventionTests.Tests/ProjectBasedConventions.all_configuration_groups_should_have_optimize_true_if_property_defined.approved.txt new file mode 100644 index 0000000..183a444 --- /dev/null +++ b/TestStack.ConventionTests.Tests/ProjectBasedConventions.all_configuration_groups_should_have_optimize_true_if_property_defined.approved.txt @@ -0,0 +1,4 @@ +'Optimize property in Release|AnyCPU must have a value of true' for 'Project property groups in TestStack.ConventionTests.Tests' +-------------------------------------------------------------------------------------------------------------------------------- + + Optimize:false diff --git a/TestStack.ConventionTests.Tests/ProjectBasedConventions.all_configuration_groups_should_have_platform_AnyCPU.approved.txt b/TestStack.ConventionTests.Tests/ProjectBasedConventions.all_configuration_groups_should_have_platform_AnyCPU.approved.txt new file mode 100644 index 0000000..f8ebe7a --- /dev/null +++ b/TestStack.ConventionTests.Tests/ProjectBasedConventions.all_configuration_groups_should_have_platform_AnyCPU.approved.txt @@ -0,0 +1,4 @@ +'Platform property in Release|x86 must have a value of AnyCPU' for 'Project property groups in TestStack.ConventionTests.Tests' +------------------------------------------------------------------------------------------------------------------------------- + + Platform:x86 diff --git a/TestStack.ConventionTests.Tests/ProjectBasedConventions.cs b/TestStack.ConventionTests.Tests/ProjectBasedConventions.cs index d3066b2..b2734fd 100644 --- a/TestStack.ConventionTests.Tests/ProjectBasedConventions.cs +++ b/TestStack.ConventionTests.Tests/ProjectBasedConventions.cs @@ -1,78 +1,126 @@ -namespace TestStack.ConventionTests.Tests -{ - using System.Xml.Linq; - using ApprovalTests; - using ApprovalTests.Reporters; - using NSubstitute; - using NUnit.Framework; - using TestStack.ConventionTests.ConventionData; - using TestStack.ConventionTests.Conventions; - using TestStack.ConventionTests.Internal; - using TestStack.ConventionTests.Tests.Properties; - - [TestFixture] - [UseReporter(typeof(DiffReporter))] - public class ProjectBasedConventions - { - IProjectProvider projectProvider; - - [SetUp] - public void Setup() - { - projectProvider = Substitute.For(); - } - - [Test] - public void assemblies_referencing_bin_obj() - { - projectProvider - .LoadProjectDocument(Arg.Any()) - .Returns(XDocument.Parse(Resources.ProjectFileWithBinReference)); - - var projectLocator = Substitute.For(); - var project = new ProjectReferences(typeof(ProjectBasedConventions).Assembly, projectProvider, projectLocator); - var ex = Assert.Throws(() => Convention.Is(new ProjectDoesNotReferenceDllsFromBinOrObjDirectories(), project)); - - Approvals.Verify(ex.Message); - } - - [Test] - public void assemblies_referencing_bin_obj_with_approved_exceptions() - { - projectProvider - .LoadProjectDocument(Arg.Any()) - .Returns(XDocument.Parse(Resources.ProjectFileWithBinReference)); - - - var projectLocator = Substitute.For(); - var project = new ProjectReferences(typeof(ProjectBasedConventions).Assembly, projectProvider, projectLocator); - Convention.IsWithApprovedExeptions(new ProjectDoesNotReferenceDllsFromBinOrObjDirectories(), project); - } - - [Test] - public void scripts_not_embedded_resources() - { - projectProvider - .LoadProjectDocument(Arg.Any()) - .Returns(XDocument.Parse(Resources.ProjectFileWithInvalidSqlScriptFile)); - - var projectLocator = Substitute.For(); - var project = new ProjectFileItems(typeof (ProjectBasedConventions).Assembly, projectProvider, projectLocator); - var ex = Assert.Throws(() => Convention.Is(new FilesAreEmbeddedResources(".sql"), project)); - - Approvals.Verify(ex.Message); - } - - [Test] - public void scripts_not_embedded_resources_with_approved_exceptions() - { - var projectLocator = Substitute.For(); - var project = new ProjectFileItems(typeof (ProjectBasedConventions).Assembly, projectProvider, projectLocator); - projectProvider - .LoadProjectDocument(Arg.Any()) - .Returns(XDocument.Parse(Resources.ProjectFileWithInvalidSqlScriptFile)); - - Convention.IsWithApprovedExeptions(new FilesAreEmbeddedResources(".sql"), project); - } - } +namespace TestStack.ConventionTests.Tests +{ + using System.Xml.Linq; + using ApprovalTests; + using ApprovalTests.Reporters; + using NSubstitute; + using NUnit.Framework; + using TestStack.ConventionTests.ConventionData; + using TestStack.ConventionTests.Conventions; + using TestStack.ConventionTests.Internal; + using TestStack.ConventionTests.Tests.Properties; + + [TestFixture] + [UseReporter(typeof(DiffReporter))] + public class ProjectBasedConventions + { + IProjectProvider projectProvider; + + [SetUp] + public void Setup() + { + projectProvider = Substitute.For(); + } + + [Test] + public void assemblies_referencing_bin_obj() + { + projectProvider + .LoadProjectDocument(Arg.Any()) + .Returns(XDocument.Parse(Resources.ProjectFileWithBinReference)); + + var projectLocator = Substitute.For(); + var project = new ProjectReferences(typeof(ProjectBasedConventions).Assembly, projectProvider, projectLocator); + var ex = Assert.Throws(() => Convention.Is(new ProjectDoesNotReferenceDllsFromBinOrObjDirectories(), project)); + + Approvals.Verify(ex.Message); + } + + [Test] + public void assemblies_referencing_bin_obj_with_approved_exceptions() + { + projectProvider + .LoadProjectDocument(Arg.Any()) + .Returns(XDocument.Parse(Resources.ProjectFileWithBinReference)); + + + var projectLocator = Substitute.For(); + var project = new ProjectReferences(typeof(ProjectBasedConventions).Assembly, projectProvider, projectLocator); + Convention.IsWithApprovedExeptions(new ProjectDoesNotReferenceDllsFromBinOrObjDirectories(), project); + } + + [Test] + public void scripts_not_embedded_resources() + { + projectProvider + .LoadProjectDocument(Arg.Any()) + .Returns(XDocument.Parse(Resources.ProjectFileWithInvalidSqlScriptFile)); + + var projectLocator = Substitute.For(); + var project = new ProjectFileItems(typeof (ProjectBasedConventions).Assembly, projectProvider, projectLocator); + var ex = Assert.Throws(() => Convention.Is(new FilesAreEmbeddedResources(".sql"), project)); + + Approvals.Verify(ex.Message); + } + + [Test] + public void scripts_not_embedded_resources_with_approved_exceptions() + { + var projectLocator = Substitute.For(); + var project = new ProjectFileItems(typeof (ProjectBasedConventions).Assembly, projectProvider, projectLocator); + projectProvider + .LoadProjectDocument(Arg.Any()) + .Returns(XDocument.Parse(Resources.ProjectFileWithInvalidSqlScriptFile)); + + Convention.IsWithApprovedExeptions(new FilesAreEmbeddedResources(".sql"), project); + } + + [Test] + public void release_debug_type_should_be_pdb_only() + { + projectProvider + .LoadProjectDocument(Arg.Any()) + .Returns(XDocument.Parse(Resources.ProjectFileWithReleaseDebugTypeFull)); + + var projectLocator = Substitute.For(); + var propertyGroups = new ProjectPropertyGroups(typeof(ProjectBasedConventions).Assembly, projectProvider, projectLocator); + var ex = + Assert.Throws( + () => Convention.Is(new ConfigurationHasSpecificValue(ConfigurationType.Release, "DebugType", "pdbonly"), propertyGroups)); + + Approvals.Verify(ex.Message); + } + + [Test] + public void all_configuration_groups_should_have_platform_AnyCPU() + { + projectProvider + .LoadProjectDocument(Arg.Any()) + .Returns(XDocument.Parse(Resources.ProjectFileWithReleaseDebugTypeFull)); + + var projectLocator = Substitute.For(); + var propertyGroups = new ProjectPropertyGroups(typeof(ProjectBasedConventions).Assembly, projectProvider, projectLocator); + var ex = + Assert.Throws( + () => Convention.Is(new ConfigurationHasSpecificValue(ConfigurationType.All, "Platform", "AnyCPU"), propertyGroups)); + + Approvals.Verify(ex.Message); + } + + [Test] + public void all_configuration_groups_should_have_optimize_true_if_property_defined() + { + projectProvider + .LoadProjectDocument(Arg.Any()) + .Returns(XDocument.Parse(Resources.ProjectFileWithReleaseDebugTypeFull)); + + var projectLocator = Substitute.For(); + var propertyGroups = new ProjectPropertyGroups(typeof(ProjectBasedConventions).Assembly, projectProvider, projectLocator); + var ex = + Assert.Throws( + () => Convention.Is(new ConfigurationHasSpecificValue(ConfigurationType.All, "Optimize", "true"), propertyGroups)); + + Approvals.Verify(ex.Message); + } + } } \ No newline at end of file diff --git a/TestStack.ConventionTests.Tests/ProjectBasedConventions.release_debug_type_should_be_pdb_only.approved.txt b/TestStack.ConventionTests.Tests/ProjectBasedConventions.release_debug_type_should_be_pdb_only.approved.txt new file mode 100644 index 0000000..525c95e --- /dev/null +++ b/TestStack.ConventionTests.Tests/ProjectBasedConventions.release_debug_type_should_be_pdb_only.approved.txt @@ -0,0 +1,9 @@ +'DebugType property in Release|AnyCPU must have a value of pdbonly' for 'Project property groups in TestStack.ConventionTests.Tests' +------------------------------------------------------------------------------------------------------------------------------------ + + DebugType:full + +'DebugType property in Release|x86 must have a value of pdbonly' for 'Project property groups in TestStack.ConventionTests.Tests' +--------------------------------------------------------------------------------------------------------------------------------- + + DebugType:full diff --git a/TestStack.ConventionTests.Tests/Properties/Resources.Designer.cs b/TestStack.ConventionTests.Tests/Properties/Resources.Designer.cs index 93cd927..625521b 100644 --- a/TestStack.ConventionTests.Tests/Properties/Resources.Designer.cs +++ b/TestStack.ConventionTests.Tests/Properties/Resources.Designer.cs @@ -1,98 +1,112 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.32559 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace TestStack.ConventionTests.Tests.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TestStack.ConventionTests.Tests.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?> - ///<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - /// <PropertyGroup> - /// <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> - /// <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - /// <SchemaVersion>2.0</SchemaVersion> - /// <ProjectGuid>{1E12EA0C-9182-4029-991A-B0B9D38F5783}</ProjectGuid> - /// <FileAlignment>512</FileAlignment> - /// </PropertyGroup> - /// <PropertyGroup Cond [rest of string was truncated]";. - /// - internal static string ProjectFileWithBinReference { - get { - return ResourceManager.GetString("ProjectFileWithBinReference", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?> - ///<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - /// <ItemGroup> - /// <None Include="Scripts\Script2.sql" /> - /// </ItemGroup> - /// <ItemGroup> - /// <EmbeddedResource Include="Scripts\Script1.sql" /> - /// </ItemGroup> - ///</Project>. - /// - internal static string ProjectFileWithInvalidSqlScriptFile { - get { - return ResourceManager.GetString("ProjectFileWithInvalidSqlScriptFile", resourceCulture); - } - } - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.34014 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace TestStack.ConventionTests.Tests.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TestStack.ConventionTests.Tests.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?> + ///<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + /// <PropertyGroup> + /// <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + /// <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + /// <SchemaVersion>2.0</SchemaVersion> + /// <ProjectGuid>{1E12EA0C-9182-4029-991A-B0B9D38F5783}</ProjectGuid> + /// <FileAlignment>512</FileAlignment> + /// </PropertyGroup> + /// <PropertyGroup Cond [rest of string was truncated]";. + /// + internal static string ProjectFileWithBinReference { + get { + return ResourceManager.GetString("ProjectFileWithBinReference", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?> + ///<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + /// <ItemGroup> + /// <None Include="Scripts\Script2.sql" /> + /// </ItemGroup> + /// <ItemGroup> + /// <EmbeddedResource Include="Scripts\Script1.sql" /> + /// </ItemGroup> + ///</Project>. + /// + internal static string ProjectFileWithInvalidSqlScriptFile { + get { + return ResourceManager.GetString("ProjectFileWithInvalidSqlScriptFile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to <?xml version="1.0" encoding="utf-8"?> + ///<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + /// <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + /// <DebugType>full</DebugType> + /// </PropertyGroup> + ///</Project>. + /// + internal static string ProjectFileWithReleaseDebugTypeFull { + get { + return ResourceManager.GetString("ProjectFileWithReleaseDebugTypeFull", resourceCulture); + } + } + } +} diff --git a/TestStack.ConventionTests.Tests/Properties/Resources.resx b/TestStack.ConventionTests.Tests/Properties/Resources.resx index bb84c5e..848bf9d 100644 --- a/TestStack.ConventionTests.Tests/Properties/Resources.resx +++ b/TestStack.ConventionTests.Tests/Properties/Resources.resx @@ -124,4 +124,7 @@ ..\Resources\ProjectFileWithInvalidSqlScriptFile.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + ..\resources\projectfilewithreleasedebugtypefull.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + \ No newline at end of file diff --git a/TestStack.ConventionTests.Tests/Resources/ProjectFileWithReleaseDebugTypeFull.txt b/TestStack.ConventionTests.Tests/Resources/ProjectFileWithReleaseDebugTypeFull.txt new file mode 100644 index 0000000..126a645 --- /dev/null +++ b/TestStack.ConventionTests.Tests/Resources/ProjectFileWithReleaseDebugTypeFull.txt @@ -0,0 +1,15 @@ + + + + AnyCPU + + + AnyCPU + full + false + + + x86 + full + + \ No newline at end of file diff --git a/TestStack.ConventionTests.Tests/TestStack.ConventionTests.Tests.csproj b/TestStack.ConventionTests.Tests/TestStack.ConventionTests.Tests.csproj index 5552b5c..fd63170 100644 --- a/TestStack.ConventionTests.Tests/TestStack.ConventionTests.Tests.csproj +++ b/TestStack.ConventionTests.Tests/TestStack.ConventionTests.Tests.csproj @@ -1,116 +1,120 @@ - - - - - Debug - AnyCPU - {FEFF8305-A192-4CEA-A373-6CF2F365A9E5} - Library - Properties - TestStack.ConventionTests.Tests - TestStack.ConventionTests.Tests - v4.0 - 512 - 8e6f0986 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\packages\ApprovalTests.3.0.01\lib\net40\ApprovalTests.dll - - - ..\packages\ApprovalUtilities.3.0.01\lib\net35\ApprovalUtilities.dll - - - ..\packages\Autofac.3.1.1\lib\net40\Autofac.dll - - - ..\packages\NSubstitute.1.6.1.0\lib\NET40\NSubstitute.dll - - - ..\packages\NUnit.2.6.2\lib\nunit.framework.dll - - - - - - - - - - - - - - - - - - - - - - - - True - True - Resources.resx - - - - - - - - - - {D5A0D078-C660-4654-8A14-DDC816BEBC54} - TestAssembly - - - {a747fd64-5338-4572-879d-a9deb00ebd56} - TestStack.ConventionTests.Autofac - - - {955B0236-089F-434D-BA02-63A1E24C2B7C} - TestStack.ConventionTests - - - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - - - - - - - - + + + + + Debug + AnyCPU + {FEFF8305-A192-4CEA-A373-6CF2F365A9E5} + Library + Properties + TestStack.ConventionTests.Tests + TestStack.ConventionTests.Tests + v4.0 + 512 + 8e6f0986 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\ApprovalTests.3.0.01\lib\net40\ApprovalTests.dll + + + ..\packages\ApprovalUtilities.3.0.01\lib\net35\ApprovalUtilities.dll + + + ..\packages\Autofac.3.1.1\lib\net40\Autofac.dll + + + ..\packages\NSubstitute.1.6.1.0\lib\NET40\NSubstitute.dll + + + ..\packages\NUnit.2.6.2\lib\nunit.framework.dll + + + + + + + + + + + + + + + + + + + + + + + + + True + True + Resources.resx + + + + + + + + + + {D5A0D078-C660-4654-8A14-DDC816BEBC54} + TestAssembly + + + {a747fd64-5338-4572-879d-a9deb00ebd56} + TestStack.ConventionTests.Autofac + + + {955B0236-089F-434D-BA02-63A1E24C2B7C} + TestStack.ConventionTests + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + + + + + + + + + \ No newline at end of file diff --git a/TestStack.ConventionTests/ConventionData/ProjectPropertyGroup.cs b/TestStack.ConventionTests/ConventionData/ProjectPropertyGroup.cs new file mode 100644 index 0000000..7cb2d11 --- /dev/null +++ b/TestStack.ConventionTests/ConventionData/ProjectPropertyGroup.cs @@ -0,0 +1,72 @@ +namespace TestStack.ConventionTests.ConventionData +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Xml.Linq; + + public class ProjectPropertyGroup + { + readonly Dictionary properties; + + public ProjectPropertyGroup(string condition, IEnumerable> properties) + { + Condition = condition; + this.properties = new Dictionary(); + foreach (var pair in properties) + { + this.properties.Add(pair.Key, pair.Value); + } + } + + public string Condition { get; set; } + + public bool Debug + { + get + { + return !Global && Condition.IndexOf("debug", StringComparison.InvariantCultureIgnoreCase) > -1; + } + } + + public bool Global + { + get { return this.Condition == null; } + } + + public string Name + { + get + { + if (this.Global) + { + return "Global"; + } + + var entries = this.Condition.Split(new[]{'\''}, StringSplitOptions.RemoveEmptyEntries).Where(item => item.Trim().Length > 0); + return entries.Last(); + } + } + + public bool Release + { + get + { + return !Global && Condition.IndexOf("release", StringComparison.InvariantCultureIgnoreCase) > -1; + } + } + + public string this[string property] + { + get + { + if (!properties.ContainsKey(property)) + { + return null; + } + + return properties[property]; + } + } + } +} \ No newline at end of file diff --git a/TestStack.ConventionTests/ConventionData/ProjectPropertyGroups.cs b/TestStack.ConventionTests/ConventionData/ProjectPropertyGroups.cs new file mode 100644 index 0000000..d48be37 --- /dev/null +++ b/TestStack.ConventionTests/ConventionData/ProjectPropertyGroups.cs @@ -0,0 +1,36 @@ +namespace TestStack.ConventionTests.ConventionData +{ + using System.Collections.Generic; + using System.Linq; + using System.Reflection; + using System.Xml.Linq; + using TestStack.ConventionTests.Internal; + + public class ProjectPropertyGroups : AbstractProjectData + { + public ProjectPropertyGroups(Assembly assembly, IProjectProvider projectProvider = null, IProjectLocator projectLocator = null) + : base(assembly, projectProvider, projectLocator) + { + } + + public ProjectPropertyGroup[] PropertyGroups + { + get + { + var project = GetProject(); + const string msbuild = "http://schemas.microsoft.com/developer/msbuild/2003"; + return project + .Root + .Elements(XName.Get("PropertyGroup", msbuild)) + .Select(propertyGroup => + new ProjectPropertyGroup(propertyGroup.Attribute("Condition") != null ? propertyGroup.Attribute("Condition").Value : null, + propertyGroup.Elements() + .Select(item => new KeyValuePair(item.Name.LocalName, item.Value))) + { + + }) + .ToArray(); + } + } + } +} \ No newline at end of file diff --git a/TestStack.ConventionTests/Conventions/ConfigurationHasSpecificValue.cs b/TestStack.ConventionTests/Conventions/ConfigurationHasSpecificValue.cs new file mode 100644 index 0000000..91603d4 --- /dev/null +++ b/TestStack.ConventionTests/Conventions/ConfigurationHasSpecificValue.cs @@ -0,0 +1,71 @@ +namespace TestStack.ConventionTests.Conventions +{ + using System; + using System.Collections.Generic; + using System.Linq; + using TestStack.ConventionTests.ConventionData; + + public enum ConfigurationType + { + Unknown, + All, + Global, + Release, + Debug + } + + public class ConfigurationHasSpecificValue : IConvention + { + public ConfigurationType Type { get; set; } + public string Property { get; set; } + public string Value { get; set; } + + public ConfigurationHasSpecificValue(ConfigurationType type, string property, string value) + { + Type = type; + Property = property; + Value = value; + } + + + public void Execute(ProjectPropertyGroups data, IConventionResultContext result) + { + foreach (var group in data.PropertyGroups.Where(Match)) + { + if (group[Property] == null) + { + continue; + } + + result.Is(string.Format("{0} property in {1} must have a value of {2}", this.Property, group.Name, this.Value), + group[Property].Equals(this.Value) ? new string[]{} : new[] {string.Format("{0}:{1}", this.Property, group[Property])}); + } + } + + private bool Match(ProjectPropertyGroup group) + { + switch (this.Type) + { + case ConfigurationType.All: + return true; + case ConfigurationType.Global: + return group.Global; + case ConfigurationType.Release: + return group.Release; + case ConfigurationType.Debug: + return group.Debug; + default: + throw new ArgumentOutOfRangeException(); + } + } + + public string ConventionReason + { + get + { + return + "Make sure projects have a specific value defined in all release configuration sections"; + } + } + } +} \ No newline at end of file diff --git a/TestStack.ConventionTests/TestStack.ConventionTests.csproj b/TestStack.ConventionTests/TestStack.ConventionTests.csproj index bca2fa0..a026429 100644 --- a/TestStack.ConventionTests/TestStack.ConventionTests.csproj +++ b/TestStack.ConventionTests/TestStack.ConventionTests.csproj @@ -1,136 +1,139 @@ - - - - - Debug - AnyCPU - {955B0236-089F-434D-BA02-63A1E24C2B7C} - Library - Properties - TestStack.ConventionTests - TestStack.ConventionTests - v4.0 - 512 - 9ee5ac36 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - true - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - true - - - - ..\packages\ApprovalTests.3.0.01\lib\net40\ApprovalTests.dll - - - ..\packages\ApprovalUtilities.3.0.01\lib\net35\ApprovalUtilities.dll - - - ..\packages\Mono.Cecil.0.9.5.4\lib\net40\Mono.Cecil.dll - - - ..\packages\Mono.Cecil.0.9.5.4\lib\net40\Mono.Cecil.Mdb.dll - - - ..\packages\Mono.Cecil.0.9.5.4\lib\net40\Mono.Cecil.Pdb.dll - - - ..\packages\Mono.Cecil.0.9.5.4\lib\net40\Mono.Cecil.Rocks.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Designer - - - - - - - + + + + + Debug + AnyCPU + {955B0236-089F-434D-BA02-63A1E24C2B7C} + Library + Properties + TestStack.ConventionTests + TestStack.ConventionTests + v4.0 + 512 + 9ee5ac36 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + true + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + true + + + + ..\packages\ApprovalTests.3.0.01\lib\net40\ApprovalTests.dll + + + ..\packages\ApprovalUtilities.3.0.01\lib\net35\ApprovalUtilities.dll + + + ..\packages\Mono.Cecil.0.9.5.4\lib\net40\Mono.Cecil.dll + + + ..\packages\Mono.Cecil.0.9.5.4\lib\net40\Mono.Cecil.Mdb.dll + + + ..\packages\Mono.Cecil.0.9.5.4\lib\net40\Mono.Cecil.Pdb.dll + + + ..\packages\Mono.Cecil.0.9.5.4\lib\net40\Mono.Cecil.Rocks.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Designer + + + + + + + \ No newline at end of file From 2fcdc783d4a92e08f54549c0244b57c4fc1b4b77 Mon Sep 17 00:00:00 2001 From: Edward Wilde Date: Tue, 28 Oct 2014 09:23:15 +0000 Subject: [PATCH 2/3] Fix package references in sample app --- Samples/SampleApp/SampleApp.csproj | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Samples/SampleApp/SampleApp.csproj b/Samples/SampleApp/SampleApp.csproj index b5dbae1..a19899c 100644 --- a/Samples/SampleApp/SampleApp.csproj +++ b/Samples/SampleApp/SampleApp.csproj @@ -32,23 +32,23 @@ - ..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll + ..\..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll - ..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.dll + ..\..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.dll - ..\packages\Microsoft.AspNet.WebApi.Client.4.0.30506.0\lib\net40\System.Net.Http.Formatting.dll + ..\..\packages\Microsoft.AspNet.WebApi.Client.4.0.30506.0\lib\net40\System.Net.Http.Formatting.dll - ..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.WebRequest.dll + ..\..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.WebRequest.dll - ..\packages\Microsoft.AspNet.WebApi.Core.4.0.30506.0\lib\net40\System.Web.Http.dll + ..\..\packages\Microsoft.AspNet.WebApi.Core.4.0.30506.0\lib\net40\System.Web.Http.dll From 52e054c049787eb61554085bfa1a3db6dc0a34b8 Mon Sep 17 00:00:00 2001 From: Edward Wilde Date: Tue, 28 Oct 2014 10:00:25 +0000 Subject: [PATCH 3/3] Update MVC to use nuget 4.0.40804. Closes issue #57 --- .../SampleApp.Tests/SampleApp.Tests.csproj | 30 ++++++++++++++++++- Samples/SampleApp.Tests/app.config | 11 +++++++ Samples/SampleApp.Tests/packages.config | 4 +++ Samples/SampleApp/SampleApp.csproj | 29 +++++++++++++++++- Samples/SampleApp/packages.config | 4 +++ TestAssembly/TestAssembly.csproj | 25 +++++++++++++++- TestAssembly/packages.config | 3 ++ .../TestStack.ConventionTests.Tests.csproj | 1 + TestStack.ConventionTests.Tests/app.config | 11 +++++++ 9 files changed, 115 insertions(+), 3 deletions(-) create mode 100644 Samples/SampleApp.Tests/app.config create mode 100644 TestStack.ConventionTests.Tests/app.config diff --git a/Samples/SampleApp.Tests/SampleApp.Tests.csproj b/Samples/SampleApp.Tests/SampleApp.Tests.csproj index f28ee96..42d6a55 100644 --- a/Samples/SampleApp.Tests/SampleApp.Tests.csproj +++ b/Samples/SampleApp.Tests/SampleApp.Tests.csproj @@ -31,6 +31,10 @@ 4 + + True + ..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll + False ..\..\packages\Mono.Cecil.0.9.5.4\lib\net40\Mono.Cecil.dll @@ -65,10 +69,33 @@ ..\..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.WebRequest.dll + + True + ..\..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.Helpers.dll + ..\..\packages\Microsoft.AspNet.WebApi.Core.4.0.30506.0\lib\net40\System.Web.Http.dll - + + True + ..\..\packages\Microsoft.AspNet.Mvc.4.0.40804.0\lib\net40\System.Web.Mvc.dll + + + True + ..\..\packages\Microsoft.AspNet.Razor.2.0.20710.0\lib\net40\System.Web.Razor.dll + + + True + ..\..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.dll + + + True + ..\..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.Deployment.dll + + + True + ..\..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.Razor.dll + @@ -96,6 +123,7 @@ + diff --git a/Samples/SampleApp.Tests/app.config b/Samples/SampleApp.Tests/app.config new file mode 100644 index 0000000..a1f8173 --- /dev/null +++ b/Samples/SampleApp.Tests/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Samples/SampleApp.Tests/packages.config b/Samples/SampleApp.Tests/packages.config index bf58b37..2ea364b 100644 --- a/Samples/SampleApp.Tests/packages.config +++ b/Samples/SampleApp.Tests/packages.config @@ -1,8 +1,12 @@  + + + + diff --git a/Samples/SampleApp/SampleApp.csproj b/Samples/SampleApp/SampleApp.csproj index a19899c..8540b3b 100644 --- a/Samples/SampleApp/SampleApp.csproj +++ b/Samples/SampleApp/SampleApp.csproj @@ -31,6 +31,10 @@ 4 + + True + ..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll + ..\..\packages\Newtonsoft.Json.4.5.11\lib\net40\Newtonsoft.Json.dll @@ -47,10 +51,33 @@ ..\..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.WebRequest.dll + + True + ..\..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.Helpers.dll + ..\..\packages\Microsoft.AspNet.WebApi.Core.4.0.30506.0\lib\net40\System.Web.Http.dll - + + True + ..\..\packages\Microsoft.AspNet.Mvc.4.0.40804.0\lib\net40\System.Web.Mvc.dll + + + True + ..\..\packages\Microsoft.AspNet.Razor.2.0.20710.0\lib\net40\System.Web.Razor.dll + + + True + ..\..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.dll + + + True + ..\..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.Deployment.dll + + + True + ..\..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.Razor.dll + diff --git a/Samples/SampleApp/packages.config b/Samples/SampleApp/packages.config index 3d90b39..c80e0a0 100644 --- a/Samples/SampleApp/packages.config +++ b/Samples/SampleApp/packages.config @@ -1,7 +1,11 @@  + + + + \ No newline at end of file diff --git a/TestAssembly/TestAssembly.csproj b/TestAssembly/TestAssembly.csproj index 26869f4..d88df18 100644 --- a/TestAssembly/TestAssembly.csproj +++ b/TestAssembly/TestAssembly.csproj @@ -49,13 +49,36 @@ ..\packages\Microsoft.Net.Http.2.0.20710.0\lib\net40\System.Net.Http.WebRequest.dll + + True + ..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.Helpers.dll + ..\packages\Microsoft.AspNet.WebApi.Core.4.0.30506.0\lib\net40\System.Web.Http.dll ..\packages\Microsoft.AspNet.WebApi.WebHost.4.0.30506.0\lib\net40\System.Web.Http.WebHost.dll - + + True + ..\packages\Microsoft.AspNet.Mvc.4.0.40804.0\lib\net40\System.Web.Mvc.dll + + + True + ..\packages\Microsoft.AspNet.Razor.2.0.20710.0\lib\net40\System.Web.Razor.dll + + + True + ..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.dll + + + True + ..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.Deployment.dll + + + True + ..\packages\Microsoft.AspNet.WebPages.2.0.20710.0\lib\net40\System.Web.WebPages.Razor.dll + diff --git a/TestAssembly/packages.config b/TestAssembly/packages.config index 58856ec..b054d95 100644 --- a/TestAssembly/packages.config +++ b/TestAssembly/packages.config @@ -1,9 +1,12 @@  + + + diff --git a/TestStack.ConventionTests.Tests/TestStack.ConventionTests.Tests.csproj b/TestStack.ConventionTests.Tests/TestStack.ConventionTests.Tests.csproj index fd63170..e1e14c0 100644 --- a/TestStack.ConventionTests.Tests/TestStack.ConventionTests.Tests.csproj +++ b/TestStack.ConventionTests.Tests/TestStack.ConventionTests.Tests.csproj @@ -77,6 +77,7 @@ + diff --git a/TestStack.ConventionTests.Tests/app.config b/TestStack.ConventionTests.Tests/app.config new file mode 100644 index 0000000..a1f8173 --- /dev/null +++ b/TestStack.ConventionTests.Tests/app.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file