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); }
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); }
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()); }
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; }
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); }
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); }
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); }
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()); }
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); }