From ec07a68751dc894407703059b3e53a3490798385 Mon Sep 17 00:00:00 2001 From: igorsych Date: Fri, 19 May 2017 18:03:05 +0300 Subject: [PATCH] Newtonsoft.Json and MediatR with fixes of all based on MediatR classes also from csproj files excluded direct specification of runtime to make compile happy if on a system we have higher version. --- src/BuildingBlocks/EventBus/EventBus/EventBus.csproj | 3 +-- .../EventBusRabbitMQ/EventBusRabbitMQ.csproj | 5 ++--- .../IntegrationEventLogEF.csproj | 3 +-- .../Microsoft.Extensions.HealthChecks.csproj | 2 +- .../Resilience.Http/Resilience.Http.csproj | 4 ++-- src/Services/Basket/Basket.API/Basket.API.csproj | 7 +------ src/Services/Catalog/Catalog.API/Catalog.API.csproj | 7 +------ .../Identity/Identity.API/Identity.API.csproj | 5 ----- .../Application/Commands/CreateOrderCommand.cs | 2 +- .../Application/Commands/IdentifiedCommand.cs | 7 ++----- .../Application/Commands/IdentifierCommandHandler.cs | 4 ++-- .../Application/Decorators/LogDecorator.cs | 2 +- .../Application/Decorators/ValidatorDecorator.cs | 2 +- .../Ordering.API/Controllers/OrdersController.cs | 4 ++-- .../Ordering/Ordering.API/Ordering.API.csproj | 9 ++------- .../Events/BuyerPaymentMethodVerifiedDomainEvent.cs | 5 +---- .../Events/OrderStartedDomainEvent.cs | 2 +- .../Ordering/Ordering.Domain/Ordering.Domain.csproj | 4 ++-- .../Ordering/Ordering.Domain/SeedWork/Entity.cs | 12 ++++++------ .../Ordering.Infrastructure/MediatorExtension.cs | 2 +- src/Web/WebMVC/WebMVC.csproj | 7 +------ src/Web/WebSPA/WebSPA.csproj | 6 +----- src/Web/WebStatus/WebStatus.csproj | 1 - test/Services/FunctionalTests/FunctionalTests.csproj | 1 - .../IntegrationTests/IntegrationTests.csproj | 1 - .../Application/IdentifierCommandHandlerTest.cs | 8 ++++---- .../Ordering/Application/OrdersWebApiTest.cs | 4 ++-- test/Services/UnitTest/UnitTest.csproj | 5 +---- 28 files changed, 40 insertions(+), 84 deletions(-) diff --git a/src/BuildingBlocks/EventBus/EventBus/EventBus.csproj b/src/BuildingBlocks/EventBus/EventBus/EventBus.csproj index ad6867741..37aeb8d1f 100644 --- a/src/BuildingBlocks/EventBus/EventBus/EventBus.csproj +++ b/src/BuildingBlocks/EventBus/EventBus/EventBus.csproj @@ -2,7 +2,6 @@ netcoreapp1.1 - 1.1.0 Microsoft.eShopOnContainers.BuildingBlocks.EventBus @@ -11,7 +10,7 @@ - + \ No newline at end of file diff --git a/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj b/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj index 18a6e9767..0c2a7a4df 100644 --- a/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj +++ b/src/BuildingBlocks/EventBus/EventBusRabbitMQ/EventBusRabbitMQ.csproj @@ -2,14 +2,13 @@ netcoreapp1.1 - 1.1.0 Microsoft.eShopOnContainers.BuildingBlocks.EventBusRabbitMQ - - + + diff --git a/src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj b/src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj index 1b36a9e55..cc3d51f6a 100644 --- a/src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj +++ b/src/BuildingBlocks/EventBus/IntegrationEventLogEF/IntegrationEventLogEF.csproj @@ -2,7 +2,6 @@ netcoreapp1.1 - 1.1.0 Microsoft.eShopOnContainers.BuildingBlocks.IntegrationEventLogEF @@ -13,7 +12,7 @@ - + diff --git a/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj index b4e18b12e..c0a9c571a 100644 --- a/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj +++ b/src/BuildingBlocks/HealthChecks/src/Microsoft.Extensions.HealthChecks/Microsoft.Extensions.HealthChecks.csproj @@ -10,7 +10,7 @@ - + diff --git a/src/BuildingBlocks/Resilience/Resilience.Http/Resilience.Http.csproj b/src/BuildingBlocks/Resilience/Resilience.Http/Resilience.Http.csproj index 3b5f54ee5..e472bb7a5 100644 --- a/src/BuildingBlocks/Resilience/Resilience.Http/Resilience.Http.csproj +++ b/src/BuildingBlocks/Resilience/Resilience.Http/Resilience.Http.csproj @@ -7,8 +7,8 @@ - - + + \ No newline at end of file diff --git a/src/Services/Basket/Basket.API/Basket.API.csproj b/src/Services/Basket/Basket.API/Basket.API.csproj index 5145213df..362f7002b 100644 --- a/src/Services/Basket/Basket.API/Basket.API.csproj +++ b/src/Services/Basket/Basket.API/Basket.API.csproj @@ -2,12 +2,7 @@ netcoreapp1.1 - portable - true - Basket.API Exe - Basket.API - 1.1.0 $(PackageTargetFallback);netstandard1.6.1;dnxcore50;portable-net451+win8 ..\..\..\..\docker-compose.dcproj @@ -35,7 +30,7 @@ - + diff --git a/src/Services/Catalog/Catalog.API/Catalog.API.csproj b/src/Services/Catalog/Catalog.API/Catalog.API.csproj index 55affd7f8..fb2e228d7 100644 --- a/src/Services/Catalog/Catalog.API/Catalog.API.csproj +++ b/src/Services/Catalog/Catalog.API/Catalog.API.csproj @@ -2,13 +2,8 @@ netcoreapp1.1 - portable - true - Catalog.API Exe - Catalog.API aspnet-Catalog.API-20161122013618 - 1.1.0 $(PackageTargetFallback);dotnet5.6;portable-net45+win8 ..\..\..\..\docker-compose.dcproj @@ -47,7 +42,7 @@ - + diff --git a/src/Services/Identity/Identity.API/Identity.API.csproj b/src/Services/Identity/Identity.API/Identity.API.csproj index 095b3e138..003b5cb30 100644 --- a/src/Services/Identity/Identity.API/Identity.API.csproj +++ b/src/Services/Identity/Identity.API/Identity.API.csproj @@ -2,13 +2,8 @@ netcoreapp1.1 - portable - true - Identity.API Exe - Identity.API aspnet-eShopOnContainers.Identity-90487118-103c-4ff0-b9da-e5e26f7ab0c5 - 1.1.0 $(PackageTargetFallback);dotnet5.6;portable-net45+win8 ..\..\..\..\docker-compose.dcproj diff --git a/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommand.cs b/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommand.cs index 950c4bdc5..f2cdf6892 100644 --- a/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommand.cs +++ b/src/Services/Ordering/Ordering.API/Application/Commands/CreateOrderCommand.cs @@ -17,7 +17,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands [DataContract] public class CreateOrderCommand - :IAsyncRequest + : IRequest { [DataMember] private readonly List _orderItems; diff --git a/src/Services/Ordering/Ordering.API/Application/Commands/IdentifiedCommand.cs b/src/Services/Ordering/Ordering.API/Application/Commands/IdentifiedCommand.cs index 823e10b69..9486cd143 100644 --- a/src/Services/Ordering/Ordering.API/Application/Commands/IdentifiedCommand.cs +++ b/src/Services/Ordering/Ordering.API/Application/Commands/IdentifiedCommand.cs @@ -1,13 +1,10 @@ using MediatR; using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands { - public class IdentifiedCommand : IAsyncRequest - where T : IAsyncRequest + public class IdentifiedCommand : IRequest + where T : IRequest { public T Command { get; } public Guid Id { get; } diff --git a/src/Services/Ordering/Ordering.API/Application/Commands/IdentifierCommandHandler.cs b/src/Services/Ordering/Ordering.API/Application/Commands/IdentifierCommandHandler.cs index 529c1aa05..3fe07c124 100644 --- a/src/Services/Ordering/Ordering.API/Application/Commands/IdentifierCommandHandler.cs +++ b/src/Services/Ordering/Ordering.API/Application/Commands/IdentifierCommandHandler.cs @@ -11,7 +11,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands /// Type of the command handler that performs the operation if request is not duplicated /// Return value of the inner command handler public class IdentifierCommandHandler : IAsyncRequestHandler, R> - where T : IAsyncRequest + where T : IRequest { private readonly IMediator _mediator; private readonly IRequestManager _requestManager; @@ -48,7 +48,7 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Application.Commands { await _requestManager.CreateRequestForCommandAsync(message.Id); - var result = await _mediator.SendAsync(message.Command); + var result = await _mediator.Send(message.Command); return result; } diff --git a/src/Services/Ordering/Ordering.API/Application/Decorators/LogDecorator.cs b/src/Services/Ordering/Ordering.API/Application/Decorators/LogDecorator.cs index 1b292297d..cd0ca70ab 100644 --- a/src/Services/Ordering/Ordering.API/Application/Decorators/LogDecorator.cs +++ b/src/Services/Ordering/Ordering.API/Application/Decorators/LogDecorator.cs @@ -6,7 +6,7 @@ public class LogDecorator : IAsyncRequestHandler - where TRequest : IAsyncRequest + where TRequest : IRequest { private readonly IAsyncRequestHandler _inner; private readonly ILogger> _logger; diff --git a/src/Services/Ordering/Ordering.API/Application/Decorators/ValidatorDecorator.cs b/src/Services/Ordering/Ordering.API/Application/Decorators/ValidatorDecorator.cs index 20318adf8..293ad6eb0 100644 --- a/src/Services/Ordering/Ordering.API/Application/Decorators/ValidatorDecorator.cs +++ b/src/Services/Ordering/Ordering.API/Application/Decorators/ValidatorDecorator.cs @@ -10,7 +10,7 @@ namespace Ordering.API.Application.Decorators { public class ValidatorDecorator : IAsyncRequestHandler - where TRequest : IAsyncRequest + where TRequest : IRequest { private readonly IAsyncRequestHandler _inner; private readonly IValidator[] _validators; diff --git a/src/Services/Ordering/Ordering.API/Controllers/OrdersController.cs b/src/Services/Ordering/Ordering.API/Controllers/OrdersController.cs index 902eb007b..d386ea699 100644 --- a/src/Services/Ordering/Ordering.API/Controllers/OrdersController.cs +++ b/src/Services/Ordering/Ordering.API/Controllers/OrdersController.cs @@ -34,13 +34,13 @@ namespace Microsoft.eShopOnContainers.Services.Ordering.API.Controllers if (Guid.TryParse(requestId, out Guid guid) && guid != Guid.Empty) { var requestCreateOrder = new IdentifiedCommand(command, guid); - commandResult = await _mediator.SendAsync(requestCreateOrder); + commandResult = await _mediator.Send(requestCreateOrder); } else { // If no x-requestid header is found we process the order anyway. This is just temporary to not break existing clients // that aren't still updated. When all clients were updated this could be removed. - commandResult = await _mediator.SendAsync(command); + commandResult = await _mediator.Send(command); } return commandResult ? (IActionResult)Ok() : (IActionResult)BadRequest(); diff --git a/src/Services/Ordering/Ordering.API/Ordering.API.csproj b/src/Services/Ordering/Ordering.API/Ordering.API.csproj index acb310ed4..7fa449679 100644 --- a/src/Services/Ordering/Ordering.API/Ordering.API.csproj +++ b/src/Services/Ordering/Ordering.API/Ordering.API.csproj @@ -2,13 +2,8 @@ netcoreapp1.1 - portable - true - Ordering.API Exe - Ordering.API aspnet-Ordering.API-20161122013547 - 1.1.0 $(PackageTargetFallback);netstandard1.6.1;dnxcore50;portable-net451+win8 ..\..\..\..\docker-compose.dcproj @@ -36,7 +31,7 @@ - + @@ -56,7 +51,7 @@ - + diff --git a/src/Services/Ordering/Ordering.Domain/Events/BuyerPaymentMethodVerifiedDomainEvent.cs b/src/Services/Ordering/Ordering.Domain/Events/BuyerPaymentMethodVerifiedDomainEvent.cs index 86c828f7c..70adeefad 100644 --- a/src/Services/Ordering/Ordering.Domain/Events/BuyerPaymentMethodVerifiedDomainEvent.cs +++ b/src/Services/Ordering/Ordering.Domain/Events/BuyerPaymentMethodVerifiedDomainEvent.cs @@ -1,13 +1,10 @@ using MediatR; using Microsoft.eShopOnContainers.Services.Ordering.Domain.AggregatesModel.BuyerAggregate; -using System; -using System.Collections.Generic; -using System.Text; namespace Ordering.Domain.Events { public class BuyerAndPaymentMethodVerifiedDomainEvent - : IAsyncNotification + : INotification { public Buyer Buyer { get; private set; } public PaymentMethod Payment { get; private set; } diff --git a/src/Services/Ordering/Ordering.Domain/Events/OrderStartedDomainEvent.cs b/src/Services/Ordering/Ordering.Domain/Events/OrderStartedDomainEvent.cs index 439a5d9ab..699361428 100644 --- a/src/Services/Ordering/Ordering.Domain/Events/OrderStartedDomainEvent.cs +++ b/src/Services/Ordering/Ordering.Domain/Events/OrderStartedDomainEvent.cs @@ -10,7 +10,7 @@ namespace Ordering.Domain.Events /// Event used when an order is created /// public class OrderStartedDomainEvent - : IAsyncNotification + : INotification { public int CardTypeId { get; private set; } public string CardNumber { get; private set; } diff --git a/src/Services/Ordering/Ordering.Domain/Ordering.Domain.csproj b/src/Services/Ordering/Ordering.Domain/Ordering.Domain.csproj index ac887b0d4..528f5e27a 100644 --- a/src/Services/Ordering/Ordering.Domain/Ordering.Domain.csproj +++ b/src/Services/Ordering/Ordering.Domain/Ordering.Domain.csproj @@ -12,8 +12,8 @@ - - + + diff --git a/src/Services/Ordering/Ordering.Domain/SeedWork/Entity.cs b/src/Services/Ordering/Ordering.Domain/SeedWork/Entity.cs index 086fbc904..823019d13 100644 --- a/src/Services/Ordering/Ordering.Domain/SeedWork/Entity.cs +++ b/src/Services/Ordering/Ordering.Domain/SeedWork/Entity.cs @@ -9,8 +9,8 @@ int? _requestedHashCode; int _Id; - - private List _domainEvents; + + private List _domainEvents; public virtual int Id { @@ -24,14 +24,14 @@ } } - public List DomainEvents => _domainEvents; - public void AddDomainEvent(IAsyncNotification eventItem) + public List DomainEvents => _domainEvents; + public void AddDomainEvent(INotification eventItem) { - _domainEvents = _domainEvents ?? new List(); + _domainEvents = _domainEvents ?? new List(); _domainEvents.Add(eventItem); } - public void RemoveDomainEvent(IAsyncNotification eventItem) + public void RemoveDomainEvent(INotification eventItem) { if (_domainEvents is null) return; _domainEvents.Remove(eventItem); diff --git a/src/Services/Ordering/Ordering.Infrastructure/MediatorExtension.cs b/src/Services/Ordering/Ordering.Infrastructure/MediatorExtension.cs index 9135188cf..521f85ae8 100644 --- a/src/Services/Ordering/Ordering.Infrastructure/MediatorExtension.cs +++ b/src/Services/Ordering/Ordering.Infrastructure/MediatorExtension.cs @@ -23,7 +23,7 @@ namespace Ordering.Infrastructure var tasks = domainEvents .Select(async (domainEvent) => { - await mediator.PublishAsync(domainEvent); + await mediator.Publish(domainEvent); }); await Task.WhenAll(tasks); diff --git a/src/Web/WebMVC/WebMVC.csproj b/src/Web/WebMVC/WebMVC.csproj index 109dc5865..b3bab559d 100644 --- a/src/Web/WebMVC/WebMVC.csproj +++ b/src/Web/WebMVC/WebMVC.csproj @@ -2,13 +2,8 @@ netcoreapp1.1 - portable - true - WebMVC Exe - WebMVC aspnet-Microsoft.eShopOnContainers-946ae052-8305-4a99-965b-ec8636ddbae3 - 1.1.0 $(PackageTargetFallback);dotnet5.6;portable-net45+win8 ..\..\..\docker-compose.dcproj @@ -38,7 +33,7 @@ All - + diff --git a/src/Web/WebSPA/WebSPA.csproj b/src/Web/WebSPA/WebSPA.csproj index 2e40d424d..2e10f7720 100644 --- a/src/Web/WebSPA/WebSPA.csproj +++ b/src/Web/WebSPA/WebSPA.csproj @@ -2,13 +2,9 @@ netcoreapp1.1 - portable - true - WebSPA Exe eShopOnContainers.WebSPA aspnetcorespa-c23d27a4-eb88-4b18-9b77-2a93f3b15119 - 1.1.0 $(PackageTargetFallback);dotnet5.6;portable-net45+win8 ..\..\..\docker-compose.dcproj false @@ -38,7 +34,7 @@ - + diff --git a/src/Web/WebStatus/WebStatus.csproj b/src/Web/WebStatus/WebStatus.csproj index 70090cd60..5b2ef60e8 100644 --- a/src/Web/WebStatus/WebStatus.csproj +++ b/src/Web/WebStatus/WebStatus.csproj @@ -4,7 +4,6 @@ - 1.1.0 $(PackageTargetFallback);portable-net45+win8+wp8+wpa81; ..\..\..\docker-compose.dcproj diff --git a/test/Services/FunctionalTests/FunctionalTests.csproj b/test/Services/FunctionalTests/FunctionalTests.csproj index 23ec8c228..2b8ee1f44 100644 --- a/test/Services/FunctionalTests/FunctionalTests.csproj +++ b/test/Services/FunctionalTests/FunctionalTests.csproj @@ -2,7 +2,6 @@ netcoreapp1.1 - 1.1.0 diff --git a/test/Services/IntegrationTests/IntegrationTests.csproj b/test/Services/IntegrationTests/IntegrationTests.csproj index c5ccfa11e..b71e1d4c4 100644 --- a/test/Services/IntegrationTests/IntegrationTests.csproj +++ b/test/Services/IntegrationTests/IntegrationTests.csproj @@ -5,7 +5,6 @@ IntegrationTests FunctionalTests true - 1.1.0 $(PackageTargetFallback);netstandard1.6.1;dnxcore50;portable-net451+win8 false false diff --git a/test/Services/UnitTest/Ordering/Application/IdentifierCommandHandlerTest.cs b/test/Services/UnitTest/Ordering/Application/IdentifierCommandHandlerTest.cs index 2a4a356ec..76db4b4aa 100644 --- a/test/Services/UnitTest/Ordering/Application/IdentifierCommandHandlerTest.cs +++ b/test/Services/UnitTest/Ordering/Application/IdentifierCommandHandlerTest.cs @@ -33,7 +33,7 @@ namespace UnitTest.Ordering.Application _requestManager.Setup(x => x.ExistAsync(It.IsAny())) .Returns(Task.FromResult(false)); - _mediator.Setup(x => x.SendAsync(It.IsAny>())) + _mediator.Setup(x => x.Send(It.IsAny>(),default(System.Threading.CancellationToken))) .Returns(Task.FromResult(true)); //Act @@ -42,7 +42,7 @@ namespace UnitTest.Ordering.Application //Assert Assert.True(result); - _mediator.Verify(x => x.SendAsync(It.IsAny>()), Times.Once()); + _mediator.Verify(x => x.Send(It.IsAny>(), default(System.Threading.CancellationToken)), Times.Once()); } [Fact] @@ -55,7 +55,7 @@ namespace UnitTest.Ordering.Application _requestManager.Setup(x => x.ExistAsync(It.IsAny())) .Returns(Task.FromResult(true)); - _mediator.Setup(x => x.SendAsync(It.IsAny>())) + _mediator.Setup(x => x.Send(It.IsAny>(), default(System.Threading.CancellationToken))) .Returns(Task.FromResult(true)); //Act @@ -64,7 +64,7 @@ namespace UnitTest.Ordering.Application //Assert Assert.False(result); - _mediator.Verify(x => x.SendAsync(It.IsAny>()), Times.Never()); + _mediator.Verify(x => x.Send(It.IsAny>(), default(System.Threading.CancellationToken)), Times.Never()); } private CreateOrderCommand FakeOrderRequest(Dictionary args = null) diff --git a/test/Services/UnitTest/Ordering/Application/OrdersWebApiTest.cs b/test/Services/UnitTest/Ordering/Application/OrdersWebApiTest.cs index c0656f050..c3fb0d95e 100644 --- a/test/Services/UnitTest/Ordering/Application/OrdersWebApiTest.cs +++ b/test/Services/UnitTest/Ordering/Application/OrdersWebApiTest.cs @@ -29,7 +29,7 @@ namespace UnitTest.Ordering.Application public async Task Create_order_with_requestId_success() { //Arrange - _mediatorMock.Setup(x => x.SendAsync(It.IsAny>())) + _mediatorMock.Setup(x => x.Send(It.IsAny>(), default(System.Threading.CancellationToken))) .Returns(Task.FromResult(true)); //Act @@ -45,7 +45,7 @@ namespace UnitTest.Ordering.Application public async Task Create_order_bad_request() { //Arrange - _mediatorMock.Setup(x => x.SendAsync(It.IsAny>())) + _mediatorMock.Setup(x => x.Send(It.IsAny>(), default(System.Threading.CancellationToken))) .Returns(Task.FromResult(true)); //Act diff --git a/test/Services/UnitTest/UnitTest.csproj b/test/Services/UnitTest/UnitTest.csproj index 019d94c97..3a80e594b 100644 --- a/test/Services/UnitTest/UnitTest.csproj +++ b/test/Services/UnitTest/UnitTest.csproj @@ -2,10 +2,7 @@ netcoreapp1.1 - UnitTest - UnitTest true - 1.1.0 $(PackageTargetFallback);netstandard1.6.1;dnxcore50;portable-net451+win8 false false @@ -25,7 +22,7 @@ - +