/// <summary>
 /// Construtor com dependency injection
 /// </summary>
 /// <param name="internamentoServices"></param>
 public InternamentoController(
     IInternamentoServices internamentoServices,
     IDoenteServices doenteServices,
     IHospitalServices hospitalServices,
     IUtilizadoresServices utilizadorServices
     )
 {
     _internamentoServices = internamentoServices;
     _doenteServices       = doenteServices;
     _hospitalServices     = hospitalServices;
     _utilizadorServices   = utilizadorServices;
 }
Example #2
0
        public void Setup()
        {
            #region Mocks - comportamentos ficticios para a lógica de negócio
            Mock <IRepository <Internamento> > internamentoRepository = new Mock <IRepository <Internamento> >();
            //Comportamento para criar o Doente
            internamentoRepository.Setup(x => x.CreateAsync(
                                             It.IsAny <Internamento>(),
                                             CancellationToken.None
                                             )).ReturnsAsync(new Internamento()
            {
                Id_Doente = 12345
            });

            internamentoRepository.Setup(x => x.UpdateAsync(
                                             It.IsAny <Internamento>(),
                                             CancellationToken.None
                                             )).ReturnsAsync(new Internamento()
            {
                Id_Doente = 12345
            });

            internamentoRepository.Setup(x => x.GetAsync(
                                             It.IsAny <int>(),
                                             CancellationToken.None
                                             )).ReturnsAsync(new Internamento()
            {
                Id_Doente = 12345
            });

            internamentoRepository.Setup(x => x.GetAllAsync(
                                             CancellationToken.None
                                             )).ReturnsAsync(new List <Internamento>()
            {
                new Internamento()
                {
                    Id_Doente = 12345
                }
            });

            internamentoRepository.Setup(x => x.DeleteAsync(
                                             It.IsAny <Internamento>(),
                                             CancellationToken.None
                                             ));

            #endregion
            business = new InternamentoServices(internamentoRepository.Object);
        }