Ejemplo n.º 1
0
        public void Create()
        {
            Project           project           = GetProject();
            EvaluationService evaluationService = new EvaluationService(fixture.context);

            int nEvaluationsBefore = evaluationService.GetAll().Count();

            evaluationService.Create("some_name", project, "");
            int nEvaluationsAfter = evaluationService.GetAll().Count();

            Assert.Equal(nEvaluationsBefore + 1, nEvaluationsAfter);
        }
        public void Create()
        {
            ProjectService projectService = new ProjectService(_context);
            Project        project        = projectService.GetAll().First();

            EvaluationService evaluationService = new EvaluationService(_context);

            int nEvaluationsBefore = evaluationService.GetAll().Count();

            evaluationService.Create("some_name", project);
            int nEvaluationsAfter = evaluationService.GetAll().Count();

            Assert.Equal(nEvaluationsBefore + 1, nEvaluationsAfter);
        }
Ejemplo n.º 3
0
        public void GetQueryable()
        {
            EvaluationService evaluationService = new EvaluationService(fixture.context);

            IQueryable <Evaluation> evaluationQueryable = evaluationService.GetAll();

            Assert.True(evaluationQueryable.Count() > 0);
        }
Ejemplo n.º 4
0
        public void GetAzureIdNotExists()
        {
            EvaluationService evaluationService = new EvaluationService(_context);
            Evaluation        evaluation        = evaluationService.GetAll().First();

            ParticipantService participantService = new ParticipantService(_context);
            string             azureUniqueId      = "get_azure_unique_id_not_exists";

            Assert.Throws <NotFoundInDBException>(() => participantService.GetParticipant(azureUniqueId, evaluation));
        }
Ejemplo n.º 5
0
        public void CreateGetsCorrectEvaluationId()
        {
            ParticipantService participantService = new ParticipantService(_context);
            EvaluationService  evaluationService  = new EvaluationService(_context);
            Evaluation         evaluation         = evaluationService.GetAll().First();

            string      evaluationIdBefore = evaluation.Id;
            Participant participant        = participantService.Create("CreateGetsCorrectEvaluationId_id", evaluation, Organization.Engineering, Role.Participant);
            string      evaluationIdAfter  = participant.Evaluation.Id;

            Assert.Equal(evaluationIdBefore, evaluationIdAfter);
        }
Ejemplo n.º 6
0
        public void GetExist()
        {
            EvaluationService evaluationService = new EvaluationService(_context);
            Evaluation        evaluation        = evaluationService.GetAll().First();

            ParticipantService participantService = new ParticipantService(_context);
            Participant        participantCreate  = participantService.Create("GetExist_id", evaluation, Organization.Engineering, Role.Participant);

            Participant participantGet = participantService.GetParticipant(participantCreate.Id);

            Assert.Equal(participantCreate, participantGet);
        }
Ejemplo n.º 7
0
        public void GetAzureId()
        {
            EvaluationService evaluationService = new EvaluationService(_context);
            Evaluation        evaluation        = evaluationService.GetAll().First();

            ParticipantService participantService = new ParticipantService(_context);
            string             azureUniqueId      = "GetAzureId_id";
            Participant        participantCreated = participantService.Create(azureUniqueId, evaluation, Organization.Engineering, Role.Participant);

            Participant participantGet = participantService.GetParticipant(azureUniqueId, evaluation);

            Assert.Equal(participantCreated, participantGet);
        }
Ejemplo n.º 8
0
        public void ParticipantAddedToEvaluation()
        {
            EvaluationService  evaluationService  = new EvaluationService(_context);
            Evaluation         evaluation         = evaluationService.GetAll().First();
            ParticipantService participantService = new ParticipantService(_context);

            int participantsBefore = evaluation.Participants.Count;

            participantService.Create("ParticipantAddedToEvaluation_id", evaluation, Organization.Engineering, Role.Participant);
            int participantsAfter = evaluation.Participants.Count;

            Assert.Equal(participantsBefore + 1, participantsAfter);
        }
Ejemplo n.º 9
0
        public void Delete()
        {
            EvaluationService evaluationService = new EvaluationService(_context);
            Evaluation        evaluation        = evaluationService.GetAll().First();

            ParticipantService participantService = new ParticipantService(_context);

            Participant participantCreate = participantService.Create("Delete_id", evaluation, Organization.Engineering, Role.Participant);

            participantService.Remove(participantCreate.Id);

            Assert.Throws <NotFoundInDBException>(() => participantService.GetParticipant(participantCreate.Id));
        }
Ejemplo n.º 10
0
        public void Create()
        {
            EvaluationService evaluationService = new EvaluationService(_context);
            Evaluation        evaluation        = evaluationService.GetAll().First();

            ParticipantService participantService = new ParticipantService(_context);

            int nParticipantsBefore = participantService.GetAll().Count();

            participantService.Create("Create_id", evaluation, Organization.Engineering, Role.Participant);
            int nParticipantsAfter = participantService.GetAll().Count();

            Assert.Equal(nParticipantsBefore + 1, nParticipantsAfter);
        }
Ejemplo n.º 11
0
        public void ParticipantDeletedFromEvaluation()
        {
            EvaluationService  evaluationService  = new EvaluationService(fixture.context);
            Evaluation         evaluation         = evaluationService.GetAll().First();
            ParticipantService participantService = new ParticipantService(fixture.context);
            Participant        participant        = participantService.Create("ParticipantDeletedFromEvaluation_id", evaluation, Organization.Engineering, Role.Participant);

            int participantsBefore = evaluation.Participants.Count;

            participantService.Remove(participant.Id);
            int participantsAfter = evaluation.Participants.Count;

            Assert.Equal(participantsBefore - 1, participantsAfter);
        }
Ejemplo n.º 12
0
        public void GetFromQuestionNotExists()
        {
            EvaluationService evaluationService = new EvaluationService(_context);
            Evaluation        evaluation        = evaluationService.GetAll().First();

            ParticipantService participantService = new ParticipantService(_context);
            Participant        participant        = participantService.Create("GetFromQuestionNotExists_id", evaluation, Organization.All, Role.ReadOnly);

            QuestionService questionService = new QuestionService(_context);
            Question        question        = questionService.GetAll().First();

            AnswerService answerService = new AnswerService(_context);

            Assert.Throws <NotFoundInDBException>(() => answerService.GetAnswer(question, participant, Progression.Nomination));
        }
Ejemplo n.º 13
0
        public void GetExists()
        {
            QuestionTemplateService questionTemplateService = new QuestionTemplateService(_context);
            QuestionTemplate        questionTemplate        = questionTemplateService.GetAll().First();

            EvaluationService evaluationService = new EvaluationService(_context);
            Evaluation        evaluation        = evaluationService.GetAll().First();

            QuestionService questionService = new QuestionService(_context);
            Question        questionCreate  = questionService.Create(questionTemplate, evaluation);

            Question questionGet = questionService.GetQuestion(questionCreate.Id).First();

            Assert.Equal(questionCreate, questionGet);
        }
Ejemplo n.º 14
0
        public void ParticipantUnique()
        {
            DbContextOptionsBuilder <BmtDbContext> builder = new DbContextOptionsBuilder <BmtDbContext>();

            builder.UseSqlite(_connection);

            // This is done because bug in xunit making Dbcontext dispose never being called when exception is thrown
            using (var _context = new BmtDbContext(builder.Options))
            {
                EvaluationService evaluationService = new EvaluationService(_context);
                Evaluation        evaluation        = evaluationService.GetAll().First();

                ParticipantService participantService = new ParticipantService(_context);
                participantService.Create("azure_unique_id", evaluation, Organization.All, Role.OrganizationLead);
                Assert.Throws <DbUpdateException>(() => participantService.Create("azure_unique_id", evaluation, Organization.All, Role.OrganizationLead));
            }
        }
Ejemplo n.º 15
0
        public void CreateBulk()
        {
            QuestionTemplateService questionTemplateService = new QuestionTemplateService(_context);
            List <QuestionTemplate> questionTemplates       = questionTemplateService.GetAll().ToList();

            EvaluationService evaluationService = new EvaluationService(_context);
            Evaluation        evaluation        = evaluationService.GetAll().First();

            QuestionService questionService = new QuestionService(_context);

            int nQuestionBefore = questionService.GetAll().Count();

            questionService.CreateBulk(questionTemplates, evaluation);
            int nQuestionsAfter = questionService.GetAll().Count();

            Assert.Equal(nQuestionBefore + 11, nQuestionsAfter);
        }
Ejemplo n.º 16
0
        // GET: Evaluation
        public async Task <ActionResult> Index()
        {
            List <Evaluation> evaluations = new List <Evaluation>();

            evaluations = await _evaluationService.GetAll();

            List <Evaluation> eval1 = new List <Evaluation>();

            foreach
            (var v in evaluations)
            {
                var e = new Evaluation();
                e          = v;
                e.employee = await _employeeService.Get(v.Id.EmpId);
            }

            return(View(evaluations));
        }
Ejemplo n.º 17
0
        public void GetFromQuestionExists()
        {
            QuestionTemplateService questionTemplateService = new QuestionTemplateService(_context);
            QuestionTemplate        questionTemplate        = questionTemplateService.GetAll().First();

            EvaluationService evaluationService = new EvaluationService(_context);
            Evaluation        evaluation        = evaluationService.GetAll().First();

            ParticipantService participantService = new ParticipantService(_context);
            Participant        participant        = participantService.GetAll().ToList()[0];

            QuestionService questionService = new QuestionService(_context);
            Question        question        = questionService.Create(questionTemplate, evaluation);

            AnswerService answerService = new AnswerService(_context);
            Answer        answerCreate  = answerService.Create(participant, question, Severity.High, "test_answer");

            Answer answerGet = answerService.GetAnswer(question, participant, question.Evaluation.Progression);

            Assert.Equal(answerCreate, answerGet);
        }
Ejemplo n.º 18
0
 public IQueryable <Evaluation> GetEvaluations()
 {
     return(_evaluationService.GetAll());
 }