Пример #1
0
        public void Gets_all_phases_for_study_valid_input()
        {
            var study = new StudyDTO
            {
                Id                     = 0,
                Name                   = "test",
                Description            = "for testing",
                ActivePhase            = null,
                ExclusionCriteria      = null,
                ClassificationCriteria = null,
                Users                  = null,
                Publications           = null,
                Phases                 = null
            };


            var listOfPhases = new List <PhaseDTO>
            {
                new PhaseDTO
                {
                    Id            = 0, Purpose = "something", Participants = null, TaskDelegations = null,
                    DisplayFields = null, InputFields = null, OverlapPercentage = 50,
                    IsAutomatic   = true, ConflictManager = null, StudyId = study.Id
                },
                new PhaseDTO
                {
                    Id            = 1, Purpose = "something1", Participants = null, TaskDelegations = null,
                    DisplayFields = null, InputFields = null, OverlapPercentage = 50,
                    IsAutomatic   = true, ConflictManager = null, StudyId = study.Id
                },
                new PhaseDTO
                {
                    Id            = 5, Purpose = "something", Participants = null, TaskDelegations = null,
                    DisplayFields = null, InputFields = null, OverlapPercentage = 50,
                    IsAutomatic   = true, ConflictManager = null, StudyId = study.Id
                }
            };

            study.Phases = listOfPhases.ToList();

            _phaseDtoRepository.Setup(a => a.ReadAsync()).Returns(Task.FromResult(listOfPhases.AsQueryable()));


            var result = _phaseLogic.GetAllForStudy(study.Id).Result;

            var phase1 = listOfPhases.ElementAt(0);
            var res1   = result.ElementAt(0);

            Assert.Equal(listOfPhases.Count(), result.Count());
            Assert.Equal(phase1.Id, res1.Id);
        }
Пример #2
0
        public async void Gets_all_phases_for_study_valid_input_integration()
        {
            var study = new StudyDTO {
                Id                     = 0,
                Name                   = "test",
                Description            = "for testing",
                ActivePhase            = null,
                ExclusionCriteria      = null,
                ClassificationCriteria = null,
                Users                  = null,
                Publications           = null,
                Phases                 = null
            };


            var listOfPhases = new Collection <PhaseDTO>
            {
                new PhaseDTO
                {
                    Id            = 0, Purpose = "something", Participants = null, TaskDelegations = null,
                    DisplayFields = null, InputFields = null, OverlapPercentage = 50,
                    IsAutomatic   = true, ConflictManager = null
                },
                new PhaseDTO
                {
                    Id            = 1, Purpose = "something1", Participants = null, TaskDelegations = null,
                    DisplayFields = null, InputFields = null, OverlapPercentage = 50,
                    IsAutomatic   = true, ConflictManager = null
                },
                new PhaseDTO
                {
                    Id            = 5, Purpose = "something", Participants = null, TaskDelegations = null,
                    DisplayFields = null, InputFields = null, OverlapPercentage = 50,
                    IsAutomatic   = true, ConflictManager = null
                }
            };

            study.Phases = listOfPhases;

            var result = await _phaseLogic.GetAllForStudy(study.Id);

            var phase1 = listOfPhases.ElementAt(0);
            var res1   = result.ElementAt(0);

            Assert.Equal(listOfPhases.Count(), result.Count());
            Assert.Equal(phase1.Id, res1.Id);
        }