Ejemplo n.º 1
0
 public UnitOfWork(ApplicationDbContext context)
 {
     _context          = context;
     UserAvailability  = new UserAvailabilityRepository(context);
     Appointment       = new AppointmentRepository(context);
     AppointmentType   = new AppointmentTypeRepository(context);
     Notifications     = new NotificationRepository(context);
     UserNotifications = new UserNotificationRepository(context);
     ApplicationUsers  = new ApplicationUserRepository(context);
 }
Ejemplo n.º 2
0
        public void GetDefault_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var repository = new AppointmentTypeRepository(context);

            // Act
            appointmentType result = repository.GetDefault();

            // Assert
            Assert.IsNotNull(result);
            Assert.IsTrue((bool)result.isDefault);
        }
Ejemplo n.º 3
0
        public void GetAll_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var repository = new AppointmentTypeRepository(context);

            // Act
            IEnumerable <appointmentType> result = repository.GetAll();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(context.appointmentType.Count(), result.Count());
        }
Ejemplo n.º 4
0
 public AppointmentController(
     AppointmentRepository context,
     AppointmentTypeRepository appointmentTypeContext,
     ReasonCodeRepository reasonCodeContext,
     IAvailabilitySearch availabilityContext,
     IExceptionHandler exceptionHandler)
 {
     this.context = context;
     this.appointmentTypeContext    = appointmentTypeContext;
     this.reasonCodeContext         = reasonCodeContext;
     this.availabilitySearchContext = availabilityContext;
     this.exceptionHandler          = exceptionHandler;
 }
Ejemplo n.º 5
0
        public void AddAppointmentType_InvalidData_BadRequest_Test()
        {
            //Arrage
            IDbContext  dbContext            = new MedicalAppointmentContext();
            IRepository repository           = new AppointmentTypeRepository(dbContext);
            var         sut                  = new AppointmentTypesController(repository);
            var         appointmentTypeToAdd = new AppointmentType();

            //Act
            var result = sut.Add(appointmentTypeToAdd);

            //Assert
            Assert.IsTrue(result is BadRequestErrorMessageResult);
        }
Ejemplo n.º 6
0
        public void GetById_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var repository = new AppointmentTypeRepository(context);
            int id         = 1;

            // Act
            appointmentType result = repository.GetById(id);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(id, result.id);
        }
        public void GetDefault_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var repository = new AppointmentTypeRepository(context);
            var service    = new AppointmentTypeService(repository);

            // Act
            AppointmentTypeModel result = service.GetDefault();

            // Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.IsDefault);
        }
Ejemplo n.º 8
0
        public void GetAppointmentTypeById_NotNullResponse_Test()
        {
            //Arrage
            IDbContext  dbContext  = new MedicalAppointmentContext();
            IRepository repository = new AppointmentTypeRepository(dbContext);
            var         sut        = new AppointmentTypesController(repository);

            //Act
            var result = sut.Get(1) as OkNegotiatedContentResult <IAppointmentType>;
            var appointmentTypeResult = result.Content as AppointmentType;

            //Assert
            Assert.IsNotNull(result);
            Assert.IsNotNull(appointmentTypeResult);
        }
Ejemplo n.º 9
0
        public void GetAllAppointmentTypes_Count_PatientsResponse_Test()
        {
            //Arrage
            IDbContext  dbContext      = new MedicalAppointmentContext();
            IRepository repository     = new AppointmentTypeRepository(dbContext);
            var         sut            = new AppointmentTypesController(repository);
            var         expectedResult = 4;

            //Act
            var result = sut.GetAll() as OkNegotiatedContentResult <IEnumerable <IAppointmentType> >;
            var appointmentTypeListResult = result.Content as List <AppointmentType>;

            //Assert
            Assert.AreEqual(expectedResult, appointmentTypeListResult.Count);
        }
        public void GetAllFilterByCurrent_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var repository = new AppointmentTypeRepository(context);
            var service    = new AppointmentTypeService(repository);

            // Act
            IEnumerable <AppointmentTypeModel> result = service.GetAllFilterByCurrent();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(context.appointmentType.Where(x => x.isCurrent).Count(), result.Count());
            Assert.AreEqual(result.Where(x => x.IsCurrent).Count(), result.Count());
        }
Ejemplo n.º 11
0
        public void GetAppointmentTypeById_ValidDataResponse_Test()
        {
            //Arrage
            IDbContext  dbContext      = new MedicalAppointmentContext();
            IRepository repository     = new AppointmentTypeRepository(dbContext);
            var         sut            = new AppointmentTypesController(repository);
            var         expectedResult = new AppointmentType()
            {
                Id = 1, Name = "Medicina General"
            };

            //Act
            var result = sut.Get(1) as OkNegotiatedContentResult <IAppointmentType>;
            var appointmentTypeResult = result.Content as AppointmentType;

            //Assert
            Assert.AreEqual(expectedResult.Id, appointmentTypeResult.Id);
            Assert.AreEqual(expectedResult.Name, appointmentTypeResult.Name);
        }