This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Sum : IStrategy<int, StrcNumeros> | |
{ | |
public int Execute(StrcNumeros numeros) | |
{ | |
return numeros.Numero1 + numeros.Numero2; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IStrategy<out TResponse, in TRequest> | |
{ | |
TResponse Execute(TRequest request); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Collections.Generic; | |
namespace Strategy | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Strategy | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.Write("Escolha a operação: (sum, sub, mult, div): "); | |
string operacao = Console.ReadLine(); | |
Console.Write("Digite o primeiro número: "); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Strategy | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
Context context1 = new Context(new ConcreteStrategyA()); | |
context1.ContextInterface(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.Extensions.Logging; | |
using System.Threading.Tasks; | |
using TestMediator.Event; | |
namespace TestMediator.Controllers | |
{ | |
[Route("api/[controller]")] | |
[ApiController] | |
public class PagamentoController : ControllerBase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.Extensions.Logging; | |
using System.Threading.Tasks; | |
using TestMediator.Command; | |
namespace TestMediator.Controllers | |
{ | |
[Route("api/[controller]")] | |
[ApiController] | |
public class EnderecoController : ControllerBase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Threading; | |
using System.Threading.Tasks; | |
using TestMediator.Event; | |
using TestMediator.Interfaces; | |
namespace TestMediator.EventHandle | |
{ | |
public class PagamentoEventHandle : IEventHandle<PagamentoEvent> | |
{ | |
public async Task Handle(PagamentoEvent notification, CancellationToken cancellationToken) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace TestMediator.Event | |
{ | |
public class PagamentoEvent : Interfaces.IEvent | |
{ | |
public int Id { get; private set; } | |
public int IdPedido { get; private set; } | |
public int IdCliente { get; private set; } | |
public string Cartao { get; private set; } | |
public PagamentoEvent(int id, int idPedido, int idCliente, string cartao) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Threading; | |
using System.Threading.Tasks; | |
using TestMediator.Command; | |
using TestMediator.Interfaces; | |
namespace TestMediator.CommandHandle | |
{ | |
public class CadastrarEnderecoHandle : ICommandHandle<CadastrarEnderecoCommand, string> | |
{ | |
public async Task<string> Handle(CadastrarEnderecoCommand request, CancellationToken cancellationToken) |