public void GetInclusioncriteria() { //Arrange uut = new ManageStudyHandler(mockContext.Object); //Act Inclusioncriteria inclusioncriteria = uut.GetInclusioncriteriaDB(1); //Assert Assert.That(inclusioncriteria == inclusionCriteriaCollection[1]); }
public Inclusioncriteria ConvertInclusioncriteria(CreateStudyModel csmodel) { var inclusioncriteria = new Inclusioncriteria { English = csmodel.inclusioncriteria.English, Female = csmodel.inclusioncriteria.IsFemale, Male = csmodel.inclusioncriteria.IsMale, MaxAge = (int)csmodel.inclusioncriteria.MaxAge, MinAge = (int)csmodel.inclusioncriteria.MinAge }; return(inclusioncriteria); }
public CreateStudyModel ErrorHandle(Inclusioncriteria inclusioncriteria, CreateStudyModel csmodel, Study study) { //Handle inclusioncriteria csmodel.inclusioncriteria.MaxAge = inclusioncriteria.MaxAge; csmodel.inclusioncriteria.MinAge = inclusioncriteria.MinAge; //Handle Study csmodel.currentStudy.Abstract = study.Abstract; csmodel.currentStudy.Description = study.Description; csmodel.currentStudy.DirecetStudyLink = study.DirectStudyLink; csmodel.currentStudy.Duration = study.Duration; csmodel.currentStudy.EligibilityRequirements = study.EligibilityRequirements; csmodel.currentStudy.Name = study.Name; csmodel.currentStudy.Pay = (int)study.Pay; csmodel.currentStudy.Preparation = study.Preparation; return(csmodel); }
public CreateStudyModel CreateEditStudyModel(int StudyID) { //Creates a CreateStudyModel containing information about the Study that should be edited. CreateStudyModel cs = new CreateStudyModel(); ManageStudyHandler msh = new ManageStudyHandler(new bachelordbContext()); Study study = msh.GetStudyDB(StudyID); Inclusioncriteria inc = msh.GetInclusioncriteriaDB(StudyID); cs.currentStudy = new StudyModel() { Name = study.Name, Abstract = study.Abstract, Description = study.Description, Duration = study.Duration, DateCreated = study.DateCreated, Location = study.Location, Isdraft = study.Isdraft, Pay = (int?)study.Pay, EligibilityRequirements = study.EligibilityRequirements, Preparation = study.Preparation, DirecetStudyLink = study.DirectStudyLink, IdStudy = study.IdStudy }; cs.inclusioncriteria = new InclusioncriteriaModel() { IsMale = inc.Male, IsFemale = inc.Female, English = inc.English, MaxAge = inc.MaxAge, MinAge = inc.MinAge, IdInclusionCriteria = inc.IdInclusionCriteria, IdStudy = inc.IdStudy }; return(cs); }
public void EditStudy() { //Arrange Study studyEdited = new Study { Name = "Edited name", IdStudy = 1, Description = "Ladies and gentlemen, this is study no. 5, edited", Isdraft = false, IdResearcher = 1, Abstract = "The abstract", Pay = 1000, Duration = "2 sessions of 10 min", DirectStudyLink = "ThisIsTheLink", DateCreated = DateTime.Now, Location = "Right here", }; Inclusioncriteria inclusioncriteriaEdited = new Inclusioncriteria { Male = false, Female = false, English = false, MinAge = 10, MaxAge = 100, }; //Act uut = new ManageStudyHandler(mockContext.Object); uut.EditStudyDB(studyEdited, inclusioncriteriaEdited); Study study = mockStudySet.Object.FirstOrDefault(s => s.IdStudy == 1); Inclusioncriteria inclusioncriteria = mockInclusionCriteriaSet.Object.FirstOrDefault(inc => inc.IdStudy == 1); //Assert Assert.That(study.Name == "Edited name"); Assert.That(study.Description == "Ladies and gentlemen, this is study no. 5, edited"); Assert.That(inclusioncriteria.Male == false); Assert.That(inclusioncriteria.Female == false); Assert.That(inclusioncriteria.English == false); }
public void CreateStudy() { //Arrange uut = new ManageStudyHandler(mockContext.Object); //New study to be created Study newStudy = new Study { Name = "New study", Description = "The newest study!", Isdraft = false, IdResearcher = 1, Abstract = "The abstract", Pay = 1000, Duration = "2 sessions of 10 min", DirectStudyLink = "ThisIsTheLink", DateCreated = DateTime.Now, Location = "Right here", IdStudy = 10, }; //Inclusion criteria to be created Inclusioncriteria newInclusioncriteria = new Inclusioncriteria { Male = true, Female = false, English = false, MinAge = 10, MaxAge = 100, }; //Act uut.CreateStudyDB(newStudy, newInclusioncriteria); Study study = mockStudySet.Object.FirstOrDefault(stud => stud.IdStudy == newStudy.IdStudy); Inclusioncriteria inclusioncriteria = mockInclusionCriteriaSet.Object.FirstOrDefault(inc => inc.IdStudy == newStudy.IdStudy); //Assert Assert.That(study == newStudy); Assert.That(inclusioncriteria == newInclusioncriteria); }