Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

30 changes: 0 additions & 30 deletions TransactionProcessor.BusinessLogic.Tests/Commands/CommandTests.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
namespace TransactionProcessor.BusinessLogic.Tests.CommandHandler
{
using System.Threading;
using BusinessLogic.Commands;
using BusinessLogic.Services;
using CommandHandlers;
using Commands;
using MediatR;
using Moq;
using RequestHandlers;
using Requests;
using Services;
using Shared.DomainDrivenDesign.CommandHandling;
using Shouldly;
using Testing;
using Xunit;

public class TransactionCommandHandlerTests
public class TransactionRequestHandlerTests
{
[Fact]
public void EstateCommandHandler_CreateEstateCommand_IsHandled()
public void TransactionRequestHandler_ProcessLogonTransactionRequest_IsHandled()
{
Mock<ITransactionDomainService> transactionDomainService = new Mock<ITransactionDomainService>();
ICommandHandler handler = new TransactionCommandHandler(transactionDomainService.Object);
TransactionRequestHandler handler = new TransactionRequestHandler(transactionDomainService.Object);

ProcessLogonTransactionCommand command = TestData.ProcessLogonTransactionCommand;
ProcessLogonTransactionRequest command = TestData.ProcessLogonTransactionRequest;

Should.NotThrow(async () =>
{
Expand Down
29 changes: 29 additions & 0 deletions TransactionProcessor.BusinessLogic.Tests/Requests/RequestTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace TransactionProcessor.BusinessLogic.Tests.Commands
{
using Requests;
using Shouldly;
using Testing;
using Xunit;

public class RequestTests
{
[Fact]
public void ProcessLogonTransactionRequest_CanBeCreated_IsCreated()
{
ProcessLogonTransactionRequest processLogonTransactionRequest = ProcessLogonTransactionRequest.Create(TestData.TransactionId, TestData.EstateId, TestData.MerchantId, TestData.DeviceIdentifier,TestData.TransactionType, TestData.TransactionDateTime,
TestData.TransactionNumber);

processLogonTransactionRequest.ShouldNotBeNull();
processLogonTransactionRequest.EstateId.ShouldBe(TestData.EstateId);
processLogonTransactionRequest.MerchantId.ShouldBe(TestData.MerchantId);
processLogonTransactionRequest.DeviceIdentifier.ShouldBe(TestData.DeviceIdentifier);
processLogonTransactionRequest.TransactionType.ShouldBe(TestData.TransactionType);
processLogonTransactionRequest.TransactionDateTime.ShouldBe(TestData.TransactionDateTime);
processLogonTransactionRequest.TransactionNumber.ShouldBe(TestData.TransactionNumber);
}
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
namespace TransactionProcessor.BusinessLogic.RequestHandlers
{
using System.Threading;
using System.Threading.Tasks;
using MediatR;
using Models;
using Requests;
using Services;

/// <summary>
///
/// </summary>
/// <seealso cref="MediatR.IRequestHandler{TransactionProcessor.BusinessLogic.Requests.ProcessLogonTransactionRequest, TransactionProcessor.Models.ProcessLogonTransactionResponse}" />
/// <seealso cref="" />
public class TransactionRequestHandler : IRequestHandler<ProcessLogonTransactionRequest, ProcessLogonTransactionResponse>
{
#region Fields

/// <summary>
/// The transaction domain service
/// </summary>
private readonly ITransactionDomainService TransactionDomainService;

#endregion

#region Constructors

public TransactionRequestHandler(ITransactionDomainService transactionDomainService)
{
this.TransactionDomainService = transactionDomainService;
}

#endregion

#region Methods

public async Task<ProcessLogonTransactionResponse> Handle(ProcessLogonTransactionRequest request,
CancellationToken cancellationToken)
{
ProcessLogonTransactionResponse logonResponse =
await this.TransactionDomainService.ProcessLogonTransaction(request.TransactionId,
request.EstateId,
request.MerchantId,
request.TransactionDateTime,
request.TransactionNumber,
request.DeviceIdentifier,
cancellationToken);

return logonResponse;
}

#endregion
}
}
Loading