diff --git a/src/NuGetGallery.Backend.Poller/NuGetGallery.Backend.Poller.csproj b/src/NuGetGallery.Backend.Poller/NuGetGallery.Backend.Poller.csproj index f086cbf5b8..df33cabaf9 100644 --- a/src/NuGetGallery.Backend.Poller/NuGetGallery.Backend.Poller.csproj +++ b/src/NuGetGallery.Backend.Poller/NuGetGallery.Backend.Poller.csproj @@ -35,21 +35,19 @@ 4 - + False - ..\..\packages\Dapper.1.12.1\lib\net40\Dapper.dll + ..\..\packages\Dapper.1.13\lib\net45\Dapper.dll False ..\..\packages\HalfOgre.DbExecutor.0.2.0.0\lib\net40\DbExecutor.dll - - False - ..\..\packages\Microsoft.Data.Edm.5.5.0\lib\net40\Microsoft.Data.Edm.dll + + ..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll - - False - ..\..\packages\Microsoft.Data.OData.5.5.0\lib\net40\Microsoft.Data.OData.dll + + ..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll ..\..\packages\Microsoft.WindowsAzure.ConfigurationManager.2.0.1.0\lib\net40\Microsoft.WindowsAzure.Configuration.dll @@ -96,9 +94,8 @@ False ..\..\packages\Rx-PlatformServices.2.1.30214.0\lib\Net45\System.Reactive.PlatformServices.dll - - False - ..\..\packages\System.Spatial.5.5.0\lib\net40\System.Spatial.dll + + ..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll diff --git a/src/NuGetGallery.Backend.Poller/packages.config b/src/NuGetGallery.Backend.Poller/packages.config index 199b68cc4e..4e2f0c47fb 100644 --- a/src/NuGetGallery.Backend.Poller/packages.config +++ b/src/NuGetGallery.Backend.Poller/packages.config @@ -1,9 +1,9 @@  - + - - + + @@ -12,6 +12,6 @@ - + \ No newline at end of file diff --git a/src/NuGetGallery.Backend/NuGetGallery.Backend.csproj b/src/NuGetGallery.Backend/NuGetGallery.Backend.csproj index 42d18c0649..e705ea690a 100644 --- a/src/NuGetGallery.Backend/NuGetGallery.Backend.csproj +++ b/src/NuGetGallery.Backend/NuGetGallery.Backend.csproj @@ -34,11 +34,11 @@ 4 - - ..\packages\Microsoft.Data.Edm.5.2.0\lib\net40\Microsoft.Data.Edm.dll + + ..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll - - ..\packages\Microsoft.Data.OData.5.2.0\lib\net40\Microsoft.Data.OData.dll + + ..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll ..\..\packages\EnterpriseLibrary.SemanticLogging.1.0.1304.0\lib\NET45\Microsoft.Practices.EnterpriseLibrary.SemanticLogging.dll @@ -74,8 +74,8 @@ ..\..\packages\Rx-Linq.2.1.30214.0\lib\Net45\System.Reactive.Linq.dll - - ..\packages\System.Spatial.5.2.0\lib\net40\System.Spatial.dll + + ..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll diff --git a/src/NuGetGallery.Backend/packages.config b/src/NuGetGallery.Backend/packages.config index 78a2cea397..ce8af92a50 100644 --- a/src/NuGetGallery.Backend/packages.config +++ b/src/NuGetGallery.Backend/packages.config @@ -2,13 +2,13 @@ - - + + - + \ No newline at end of file diff --git a/src/NuGetGallery.Core/NuGetGallery.Core.csproj b/src/NuGetGallery.Core/NuGetGallery.Core.csproj index 208e33078a..5d7e2ae30f 100644 --- a/src/NuGetGallery.Core/NuGetGallery.Core.csproj +++ b/src/NuGetGallery.Core/NuGetGallery.Core.csproj @@ -37,18 +37,17 @@ ..\..\packages\EntityFramework.5.0.0\lib\net45\EntityFramework.dll - - ..\..\packages\Microsoft.Data.Edm.5.2.0\lib\net40\Microsoft.Data.Edm.dll + + ..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll - - ..\..\packages\Microsoft.Data.OData.5.2.0\lib\net40\Microsoft.Data.OData.dll + + ..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll ..\..\packages\Microsoft.Web.Xdt.1.0.0\lib\net40\Microsoft.Web.XmlTransform.dll - - False - ..\..\packages\Microsoft.WindowsAzure.ConfigurationManager.1.8.0.0\lib\net35-full\Microsoft.WindowsAzure.Configuration.dll + + ..\..\packages\Microsoft.WindowsAzure.ConfigurationManager.2.0.1.0\lib\net40\Microsoft.WindowsAzure.Configuration.dll ..\..\packages\WindowsAzure.Storage.2.0.6.1\lib\net40\Microsoft.WindowsAzure.Storage.dll @@ -70,8 +69,8 @@ - - ..\..\packages\System.Spatial.5.2.0\lib\net40\System.Spatial.dll + + ..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll diff --git a/src/NuGetGallery.Core/packages.config b/src/NuGetGallery.Core/packages.config index 4f726c66d5..3108b258d3 100644 --- a/src/NuGetGallery.Core/packages.config +++ b/src/NuGetGallery.Core/packages.config @@ -1,12 +1,12 @@  - - + + - + - + diff --git a/src/NuGetGallery.Operations/NuGetGallery.Operations.csproj b/src/NuGetGallery.Operations/NuGetGallery.Operations.csproj index 34456b9449..b28a824d5d 100644 --- a/src/NuGetGallery.Operations/NuGetGallery.Operations.csproj +++ b/src/NuGetGallery.Operations/NuGetGallery.Operations.csproj @@ -47,13 +47,11 @@ ..\..\packages\EntityFramework.5.0.0\lib\net45\EntityFramework.dll - - False - ..\..\packages\Microsoft.Data.Edm.5.5.0\lib\net40\Microsoft.Data.Edm.dll + + ..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll - - False - ..\..\packages\Microsoft.Data.OData.5.5.0\lib\net40\Microsoft.Data.OData.dll + + ..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll True @@ -97,9 +95,8 @@ - - False - ..\..\packages\System.Spatial.5.5.0\lib\net40\System.Spatial.dll + + ..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll diff --git a/src/NuGetGallery.Operations/packages.config b/src/NuGetGallery.Operations/packages.config index 2db24da583..3f770884dd 100644 --- a/src/NuGetGallery.Operations/packages.config +++ b/src/NuGetGallery.Operations/packages.config @@ -5,8 +5,8 @@ - - + + @@ -14,6 +14,6 @@ - + diff --git a/src/NuGetGallery/NuGetGallery.csproj b/src/NuGetGallery/NuGetGallery.csproj index 0c5884d027..ef9320bba9 100644 --- a/src/NuGetGallery/NuGetGallery.csproj +++ b/src/NuGetGallery/NuGetGallery.csproj @@ -261,7 +261,6 @@ - diff --git a/src/galops/galops.csproj b/src/galops/galops.csproj index a9d16faaa0..8718ec3e7e 100644 --- a/src/galops/galops.csproj +++ b/src/galops/galops.csproj @@ -39,13 +39,11 @@ false - - False - ..\..\packages\Microsoft.Data.Edm.5.5.0\lib\net40\Microsoft.Data.Edm.dll + + ..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll - - False - ..\..\packages\Microsoft.Data.OData.5.5.0\lib\net40\Microsoft.Data.OData.dll + + ..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll ..\..\packages\Microsoft.WindowsAzure.ConfigurationManager.2.0.1.0\lib\net40\Microsoft.WindowsAzure.Configuration.dll @@ -66,9 +64,8 @@ - - False - ..\..\packages\System.Spatial.5.5.0\lib\net40\System.Spatial.dll + + ..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll diff --git a/src/galops/packages.config b/src/galops/packages.config index b0cda06c7b..7f711904dc 100644 --- a/src/galops/packages.config +++ b/src/galops/packages.config @@ -1,9 +1,9 @@  - - + + - + \ No newline at end of file diff --git a/tests/NuGetGallery.Backend.Facts/Common/AssertEx.cs b/tests/NuGetGallery.Backend.Facts/Common/AssertEx.cs new file mode 100644 index 0000000000..089ecca22b --- /dev/null +++ b/tests/NuGetGallery.Backend.Facts/Common/AssertEx.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Xunit +{ + /// + /// Extra asserters + /// + public static class AssertEx + { + public static async Task Throws(Func action) + where TException : Exception + { + TException captured = null; + try + { + await action(); + } + catch (TException ex) + { + captured = ex; + } + + Assert.NotNull(captured); + return captured; + } + } +} diff --git a/tests/NuGetGallery.Backend.Facts/JobDispatcherFacts.cs b/tests/NuGetGallery.Backend.Facts/JobDispatcherFacts.cs index 7f4fe8cdd2..27a4fa3ca2 100644 --- a/tests/NuGetGallery.Backend.Facts/JobDispatcherFacts.cs +++ b/tests/NuGetGallery.Backend.Facts/JobDispatcherFacts.cs @@ -4,6 +4,7 @@ using System.Text; using System.Threading.Tasks; using Moq; +using NuGetGallery.Jobs; using Xunit; namespace NuGetGallery.Backend @@ -13,63 +14,58 @@ public class JobDispatcherFacts public class TheDispatchMethod { [Fact] - public void GivenNoJobWithName_ItThrowsUnknownJobException() + public async Task GivenNoJobWithName_ItThrowsUnknownJobException() { // Arrange var dispatcher = new JobDispatcher(BackendConfiguration.Create(), Enumerable.Empty()); - var request = new JobRequest("flarg", new Dictionary()); + var request = new JobRequest("flarg", "test", new Dictionary()); + var invocation = new JobInvocation(Guid.NewGuid(), request, DateTimeOffset.UtcNow); // Act/Assert - var ex = Assert.Throws(() => dispatcher.Dispatch(request)); + var ex = await AssertEx.Throws(() => dispatcher.Dispatch(invocation)); Assert.Equal("flarg", ex.JobName); } [Fact] - public void GivenJobWithName_ItCreatesAnInvocationAndInvokesJob() + public async Task GivenJobWithName_ItCreatesAnInvocationAndInvokesJob() { // Arrange var job = new Mock(); - JobInvocation invocation = null; job.Setup(j => j.Name).Returns("Test"); - job.Setup(j => j.Invoke(It.IsAny())) - .Returns(i => - { - invocation = i; - return JobResult.Completed(); - }); - + var dispatcher = new JobDispatcher(BackendConfiguration.Create(), new[] { job.Object }); - var request = new JobRequest("Test", new Dictionary()); + var request = new JobRequest("Test", "test", new Dictionary()); + var invocation = new JobInvocation(Guid.NewGuid(), request, DateTimeOffset.UtcNow); + + job.Setup(j => j.Invoke(invocation, dispatcher.Config)) + .Returns(Task.FromResult(JobResult.Completed())); + // Act - dispatcher.Dispatch(request); + var response = await dispatcher.Dispatch(invocation); // Assert - Assert.NotNull(invocation); - Assert.Same(request, invocation.Request); - Assert.Equal("Dispatcher", invocation.Source); + Assert.Same(invocation, response.Invocation); + Assert.Equal(JobResult.Completed(), response.Result); } [Fact] - public void GivenJobWithName_ItReturnsResponseContainingInvocationAndResult() + public async Task GivenJobWithName_ItReturnsResponseContainingInvocationAndResult() { // Arrange var job = new Mock(); - var ex = new Exception(); - JobInvocation invocation = null; job.Setup(j => j.Name).Returns("Test"); - job.Setup(j => j.Invoke(It.IsAny())) - .Returns(i => - { - invocation = i; - return JobResult.Faulted(ex); - }); - + + var ex = new Exception(); var dispatcher = new JobDispatcher(BackendConfiguration.Create(), new[] { job.Object }); - var request = new JobRequest("Test", new Dictionary()); + var request = new JobRequest("Test", "test", new Dictionary()); + var invocation = new JobInvocation(Guid.NewGuid(), request, DateTimeOffset.UtcNow); + + job.Setup(j => j.Invoke(invocation, dispatcher.Config)) + .Returns(Task.FromResult(JobResult.Faulted(ex))); // Act - var response = dispatcher.Dispatch(request); + var response = await dispatcher.Dispatch(invocation); // Assert Assert.Same(invocation, response.Invocation); diff --git a/tests/NuGetGallery.Backend.Facts/JobFacts.cs b/tests/NuGetGallery.Backend.Facts/JobFacts.cs index ccf9d4f400..e5976304e2 100644 --- a/tests/NuGetGallery.Backend.Facts/JobFacts.cs +++ b/tests/NuGetGallery.Backend.Facts/JobFacts.cs @@ -6,6 +6,7 @@ using System.Text; using System.Threading.Tasks; using Moq; +using NuGetGallery.Jobs; using Xunit; namespace NuGetGallery.Backend @@ -28,8 +29,9 @@ public void GivenAJobWithClassNameNotEndingJob_ItReturnsTheWholeTypeName() public class ATestJerb : Job { - protected internal override void Execute() + protected internal override Task Execute() { + return Task.FromResult(null); } public override EventSource GetEventSource() @@ -42,7 +44,7 @@ public override EventSource GetEventSource() public class TheExecuteMethod { [Fact] - public void GivenAnInvocation_ItSetsTheInvocationProperty() + public async Task GivenAnInvocation_ItSetsTheInvocationProperty() { // Arrange var job = new TestJob(); @@ -52,19 +54,17 @@ public void GivenAnInvocation_ItSetsTheInvocationProperty() "Test", "Test", new Dictionary()), - DateTimeOffset.UtcNow, - "test", - BackendConfiguration.Create()); + DateTimeOffset.UtcNow); // Act - job.Invoke(invocation); + await job.Invoke(invocation, BackendConfiguration.Create()); // Assert Assert.Same(invocation, job.Invocation); } [Fact] - public void GivenParametersThatMatchPropertyNames_ItSetsPropertiesToThoseValues() + public async Task GivenParametersThatMatchPropertyNames_ItSetsPropertiesToThoseValues() { // Arrange var job = new TestJob(); @@ -78,19 +78,17 @@ public void GivenParametersThatMatchPropertyNames_ItSetsPropertiesToThoseValues( {"TestParameter", "frob"}, {"NotMapped", "bar"} }), - DateTimeOffset.UtcNow, - "test", - BackendConfiguration.Create()); + DateTimeOffset.UtcNow); // Act - job.Invoke(invocation); + await job.Invoke(invocation, BackendConfiguration.Create()); // Assert Assert.Equal("frob", job.TestParameter); } [Fact] - public void GivenPropertiesWithConverters_ItUsesTheConverterToChangeTheValue() + public async Task GivenPropertiesWithConverters_ItUsesTheConverterToChangeTheValue() { // Arrange var job = new TestJob(); @@ -103,19 +101,17 @@ public void GivenPropertiesWithConverters_ItUsesTheConverterToChangeTheValue() { {"ConvertValue", "frob"}, }), - DateTimeOffset.UtcNow, - "test", - BackendConfiguration.Create()); + DateTimeOffset.UtcNow); // Act - job.Invoke(invocation); + await job.Invoke(invocation, BackendConfiguration.Create()); // Assert Assert.Equal("http://it.was.a.string/frob", job.ConvertValue.AbsoluteUri); } [Fact] - public void GivenAJobExecutesWithoutException_ItReturnsCompletedJobResult() + public async Task GivenAJobExecutesWithoutException_ItReturnsCompletedJobResult() { // Arrange var job = new Mock() { CallBase = true }; @@ -125,19 +121,17 @@ public void GivenAJobExecutesWithoutException_ItReturnsCompletedJobResult() "Jerb", "Test", new Dictionary()), - DateTimeOffset.UtcNow, - "test", - BackendConfiguration.Create()); + DateTimeOffset.UtcNow); // Act - var result = job.Object.Invoke(invocation); + var result = await job.Object.Invoke(invocation, BackendConfiguration.Create()); // Assert Assert.Equal(JobResult.Completed(), result); } [Fact] - public void GivenAJobThrows_ItReturnsFaultedJobResult() + public async Task GivenAJobThrows_ItReturnsFaultedJobResult() { // Arrange var job = new Mock() { CallBase = true }; @@ -147,14 +141,12 @@ public void GivenAJobThrows_ItReturnsFaultedJobResult() "Jerb", "Test", new Dictionary()), - DateTimeOffset.UtcNow, - "test", - BackendConfiguration.Create()); + DateTimeOffset.UtcNow); var ex = new NotImplementedException("Broked!"); job.Setup(j => j.Execute()).Throws(ex); // Act - var result = job.Object.Invoke(invocation); + var result = await job.Object.Invoke(invocation, BackendConfiguration.Create()); // Assert Assert.Equal(JobResult.Faulted(ex), result); @@ -168,8 +160,9 @@ public class TestJob : Job [TypeConverter(typeof(TestUriConverter))] public Uri ConvertValue { get; set; } - protected internal override void Execute() + protected internal override Task Execute() { + return Task.FromResult(null); } public override EventSource GetEventSource() diff --git a/tests/NuGetGallery.Backend.Facts/NuGetGallery.Backend.Facts.csproj b/tests/NuGetGallery.Backend.Facts/NuGetGallery.Backend.Facts.csproj index a33b42dafc..09837d0c1d 100644 --- a/tests/NuGetGallery.Backend.Facts/NuGetGallery.Backend.Facts.csproj +++ b/tests/NuGetGallery.Backend.Facts/NuGetGallery.Backend.Facts.csproj @@ -43,16 +43,15 @@ - - False + ..\..\packages\xunit.1.9.2\lib\net20\xunit.dll - - False + ..\..\packages\xunit.extensions.1.9.2\lib\net20\xunit.extensions.dll + @@ -65,6 +64,10 @@ {125152b4-8520-4719-8778-939f3b97a6fb} NuGetGallery.Backend + + {097b2cdd-9623-4c34-93c2-d373d51f5b4e} + NuGetGallery.Core + diff --git a/tests/NuGetGallery.Core.Facts/NuGetGallery.Core.Facts.csproj b/tests/NuGetGallery.Core.Facts/NuGetGallery.Core.Facts.csproj index 242c8c4c5b..a511ebcf49 100644 --- a/tests/NuGetGallery.Core.Facts/NuGetGallery.Core.Facts.csproj +++ b/tests/NuGetGallery.Core.Facts/NuGetGallery.Core.Facts.csproj @@ -68,12 +68,10 @@ - - False + ..\..\packages\xunit.1.9.2\lib\net20\xunit.dll - - False + ..\..\packages\xunit.extensions.1.9.2\lib\net20\xunit.extensions.dll @@ -110,4 +108,4 @@ --> - + \ No newline at end of file diff --git a/tests/NuGetGallery.Facts/NuGetGallery.Facts.csproj b/tests/NuGetGallery.Facts/NuGetGallery.Facts.csproj index 9e21516e89..96e6054b24 100644 --- a/tests/NuGetGallery.Facts/NuGetGallery.Facts.csproj +++ b/tests/NuGetGallery.Facts/NuGetGallery.Facts.csproj @@ -65,21 +65,17 @@ ..\..\packages\MarkdownSharp.1.13.0.0\lib\35\MarkdownSharp.dll - - False - ..\..\packages\Microsoft.Data.Edm.5.5.0\lib\net40\Microsoft.Data.Edm.dll + + ..\..\packages\Microsoft.Data.Edm.5.6.0\lib\net40\Microsoft.Data.Edm.dll - - False - ..\..\packages\Microsoft.Data.OData.5.5.0\lib\net40\Microsoft.Data.OData.dll + + ..\..\packages\Microsoft.Data.OData.5.6.0\lib\net40\Microsoft.Data.OData.dll - - False - ..\..\packages\Microsoft.Data.Services.5.5.0\lib\net40\Microsoft.Data.Services.dll + + ..\..\packages\Microsoft.Data.Services.5.6.0\lib\net40\Microsoft.Data.Services.dll - - False - ..\..\packages\Microsoft.Data.Services.Client.5.5.0\lib\net40\Microsoft.Data.Services.Client.dll + + ..\..\packages\Microsoft.Data.Services.Client.5.6.0\lib\net40\Microsoft.Data.Services.Client.dll ..\..\packages\Microsoft.Owin.2.0.0\lib\net45\Microsoft.Owin.dll @@ -157,9 +153,8 @@ - - False - ..\..\packages\System.Spatial.5.5.0\lib\net40\System.Spatial.dll + + ..\..\packages\System.Spatial.5.6.0\lib\net40\System.Spatial.dll @@ -203,11 +198,9 @@ ..\..\packages\xunit.1.9.2\lib\net20\xunit.dll - True ..\..\packages\xunit.extensions.1.9.2\lib\net20\xunit.extensions.dll - True diff --git a/tests/NuGetGallery.Facts/packages.config b/tests/NuGetGallery.Facts/packages.config index e2e7b168dd..7a348b20bc 100644 --- a/tests/NuGetGallery.Facts/packages.config +++ b/tests/NuGetGallery.Facts/packages.config @@ -9,10 +9,10 @@ - - - - + + + + @@ -33,7 +33,7 @@ - +