Ejemplo n.º 1
0
        public UnitTestProfissionalCQRS()
        {
            var mockProfissionalRepository = new Mock <IProfissionalRepository>();

            mockProfissionalRepository.Setup(x => x.Add(It.IsAny <Profissional>(), It.IsAny <string>()));

            var serviceProvider = new ServiceCollection()
                                  .AddMediatR(typeof(RegistraProfissionalCommandHandlerAsync))
                                  .AddScoped <IHandleNotification, ProfissionalCommandNotification>()
                                  .AddSingleton(mockProfissionalRepository.Object)
                                  .BuildServiceProvider();

            _mediator = serviceProvider.GetService(typeof(IMediator)) as IMediator;

            _notification = serviceProvider.GetService(typeof(IHandleNotification)) as IHandleNotification;
        }
Ejemplo n.º 2
0
 public TipoProfissoesController(IMediator mediator, IHandleNotification notification)
 {
     _mediator     = mediator;
     _notification = notification;
 }
 public ProfissionaisController(IMediator mediator, IHandleNotification notification)
 {
     _mediator     = mediator;
     _notification = notification;
 }
 public RegistraProfissionalCommandHandlerAsync(IProfissionalRepository repository, IHandleNotification notification)
 {
     _repository   = repository;
     _notification = notification;
 }