Esempio n. 1
0
        public void SoftDeleteResponsibleProject_Exists()
        {
            List <ResponsibleProject>    responsiblesProject = new List <ResponsibleProject>();
            DbSet <ResponsibleProject>   mockSet             = DbContextMock.GetQueryableMockDbSet(responsiblesProject, r => r.EmailAddress);
            ProfessionalPracticesContext mockContext         = DbContextMock.GetContext(mockSet);
            UnitOfWork         unitOfWork         = DbContextMock.GetUnitOfWork(mockContext);
            ResponsibleProject responsibleProject = new ResponsibleProject
            {
                IdResponsibleProject = 1,
                Name         = "Gustavo Antonio",
                LastName     = "Ruiz Zapata",
                EmailAddress = "*****@*****.**",
                Charge       = "Jefe de departamento de Tecnología Educativa"
            };

            responsiblesProject.Add(responsibleProject);
            ResponsibleProject responsobleProjectCurrent = unitOfWork.ResponsibleProjects.Get(responsibleProject.IdResponsibleProject);

            if (responsobleProjectCurrent != null)
            {
                responsobleProjectCurrent.ResponsibleProjectStatus = ResponsibleProjectStatus.INACTIVE;
            }
            responsiblesProject.Remove(responsibleProject);
            int expected = 0;
            int actual   = responsiblesProject.Count;

            Assert.AreEqual(expected, actual);
        }
Esempio n. 2
0
        public void TestInitialize()
        {
            _teacherValidator = new TeacherValidator(true);
            _teachers         = new List <Teacher> {
                new Teacher
                {
                    StaffNumber      = "54321",
                    RegistrationDate = DateTime.Now,
                    User             = new User
                    {
                        IdUser         = 1,
                        Name           = "Alejandra",
                        LastName       = "Luna Ceballos",
                        Gender         = Gender.FEMALE,
                        UserStatus     = UserStatus.ACTIVE,
                        Email          = "*****@*****.**",
                        AlternateEmail = "*****@*****.**",
                        PhoneNumber    = "2281213456"
                    }
                }
            };

            _mockSet     = DbContextMock.GetQueryableMockDbSet(_teachers, t => t.StaffNumber);
            _mockContext = DbContextMock.GetContext(_mockSet);
            _unitOfWork  = DbContextMock.GetUnitOfWork(_mockContext);
        }
Esempio n. 3
0
        public void AddActivityCorrect()
        {
            List <Activity>              actvities   = new List <Activity>();
            DbSet <Activity>             mockSet     = DbContextMock.GetQueryableMockDbSet(actvities, a => a.IdActivity);
            ProfessionalPracticesContext mockContext = DbContextMock.GetContext(mockSet);
            UnitOfWork unitOfWork  = DbContextMock.GetUnitOfWork(mockContext);
            string     date        = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            Activity   newActivity = new Activity
            {
                IdGroup        = 1,
                Name           = "Actividad  2 reporte mensual",
                ActivityType   = ActivityType.MonthlyReport,
                ActivityStatus = ActivityStatus.ACTIVE,
                IdActivity     = 2,
                Description    = " Deberan de subir su primer reporte mensual",
                ValueActivity  = 100,
                StartDate      = Convert.ToDateTime(date),
                FinishDate     = Convert.ToDateTime(date),
                teacher        = new Teacher
                {
                    StaffNumber = "12345"
                }
            };

            unitOfWork.Activities.Add(newActivity);

            int expected = 1;
            int actual   = actvities.Count;

            Assert.AreEqual(expected, actual);
        }
Esempio n. 4
0
        public void RegisterSchedulingActivities_Exists()
        {
            List <SchedulingActivity> schedulingActivities = new List <SchedulingActivity>()
            {
                new SchedulingActivity
                {
                    Month     = "Febrero",
                    Activity  = "Análisis de requerimientos, recopilación de información, documentación y revisión de procedimientos.Capacitación en el IDE de desarrollo y metodología.",
                    IdProject = 3
                },
                new SchedulingActivity
                {
                    Month     = "Mayo",
                    Activity  = "Pruebas y ajustes",
                    IdProject = 3
                }
            };
            DbSet <SchedulingActivity>   mockSet     = DbContextMock.GetQueryableMockDbSet(schedulingActivities, s => s.IdSchedulingActivity);
            ProfessionalPracticesContext mockContext = DbContextMock.GetContext(mockSet);
            UnitOfWork unitOfWork = DbContextMock.GetUnitOfWork(mockContext);

            unitOfWork.SchedulingActivities.AddRange(schedulingActivities);
            int expected = 4;
            int actual   = schedulingActivities.Count;

            Assert.AreEqual(expected, actual);
        }
        public void RegisterActivitiesMade_Exists()
        {
            DateTime                     localDate       = DateTime.Now;
            List <ActivityMade>          activitiesMades = new List <ActivityMade>();
            DbSet <ActivityMade>         mockSet         = DbContextMock.GetQueryableMockDbSet(activitiesMades, p => p.IdActivity);
            ProfessionalPracticesContext mockContext     = DbContextMock.GetContext(mockSet);
            UnitOfWork                   unitOfWork      = DbContextMock.GetUnitOfWork(mockContext);
            List <ActivityMade>          newActivities   = new List <ActivityMade>
            {
                new ActivityMade
                {
                    Name            = "Pruebas",
                    IdPartialReport = 1,
                    PlannedWeek     = "S1 S2 S3",
                    RealWeek        = "S1 S2 S3"
                },
                new ActivityMade
                {
                    Name            = "Modelo de dominio",
                    IdPartialReport = 1,
                    PlannedWeek     = "S1 S2 S3",
                    RealWeek        = "S1 S2 S3"
                }
            };

            unitOfWork.ActivityMades.AddRange(newActivities);
            int expected = 2;
            int actual   = newActivities.Count;

            Assert.AreEqual(expected, actual);
        }
Esempio n. 6
0
 public void TestInitialize()
 {
     _data = new List <Teacher>
     {
         new Teacher {
             StaffNumber      = "XGC16215",
             RegistrationDate = DateTime.Now,
             DischargeDate    = null,
             User             = new User
             {
                 IdUser         = 1,
                 Name           = "Eduardo Aldair",
                 LastName       = "Hernández Solís",
                 Gender         = Gender.MALE,
                 UserStatus     = UserStatus.ACTIVE,
                 Email          = "*****@*****.**",
                 AlternateEmail = "*****@*****.**",
                 PhoneNumber    = "2298046218",
                 Account        = new Account
                 {
                     Username   = "******",
                     Password   = "******",
                     FirstLogin = true
                 }
             }
         }
     };
     _mockSet        = DbContextMock.GetQueryableMockDbSet(_data, t => t.StaffNumber);
     _mockContext    = DbContextMock.GetContext(_mockSet);
     _mockUnitOfWork = DbContextMock.GetUnitOfWork(_mockContext);
 }
Esempio n. 7
0
        public void TestInitialize()
        {
            _practicionerValidator = new PracticionerValidator();
            _practicioners         = new List <Practicioner> {
                new Practicioner
                {
                    Enrollment = "zS18012124",
                    Term       = "FEBRERO - JULIO 2021",
                    Credits    = 288,
                    User       = new User
                    {
                        IdUser         = 1,
                        Name           = "Anahi del Carmen",
                        LastName       = "Lune Herrera",
                        Gender         = Gender.FEMALE,
                        UserStatus     = UserStatus.ACTIVE,
                        Email          = "*****@*****.**",
                        AlternateEmail = "*****@*****.**",
                        PhoneNumber    = "2281564676",
                        Account        = new Account
                        {
                            Username   = "******",
                            Password   = "******",
                            FirstLogin = true
                        }
                    }
                }
            };

            _mockSet     = DbContextMock.GetQueryableMockDbSet(_practicioners, p => p.Enrollment);
            _mockContext = DbContextMock.GetContext(_mockSet);
            _unitOfWork  = DbContextMock.GetUnitOfWork(_mockContext);
        }
        public void TestInitialize()
        {
            _practicionerValidator = new PracticionerValidator();
            _practicioners         = new List <Practicioner> {
                new Practicioner
                {
                    Enrollment = "zS19012344",
                    Term       = "FEBRERO - JULIO 2021",
                    Credits    = 285,
                    User       = new User
                    {
                        IdUser         = 1,
                        Name           = "Isamel",
                        LastName       = "Luna Ceballos",
                        Gender         = Gender.MALE,
                        UserStatus     = UserStatus.ACTIVE,
                        Email          = "*****@*****.**",
                        AlternateEmail = "*****@*****.**",
                        PhoneNumber    = "2289123456",
                        Account        = new Account
                        {
                            Username   = "******",
                            Password   = "******",
                            FirstLogin = true
                        }
                    }
                }
            };

            _mockSet     = DbContextMock.GetQueryableMockDbSet(_practicioners, p => p.Enrollment);
            _mockContext = DbContextMock.GetContext(_mockSet);
            _unitOfWork  = DbContextMock.GetUnitOfWork(_mockContext);
        }
Esempio n. 9
0
        public void TestInitialize()
        {
            _groupValidator = new GroupValidator();
            _group          = new List <Group>
            {
                new Group
                {
                    IdGroup     = 1,
                    Nrc         = "12341",
                    GroupStatus = GroupStatus.ACTIVE,
                    Term        = "FEBRERO-JUNIO 2021",
                    StaffNumber = "65245"
                }
            };
            _mockSetGroup = DbContextMock.GetQueryableMockDbSet(_group, g => g.IdGroup);
            _mockContext  = DbContextMock.GetContext(_mockSetGroup);

            _unitOfWork = DbContextMock.GetUnitOfWork(_mockContext);
        }
Esempio n. 10
0
        public void RegisterResponsibleProject_Exists()
        {
            List <ResponsibleProject>    responsiblesProject = new List <ResponsibleProject>();
            DbSet <ResponsibleProject>   mockSet             = DbContextMock.GetQueryableMockDbSet(responsiblesProject, r => r.EmailAddress);
            ProfessionalPracticesContext mockContext         = DbContextMock.GetContext(mockSet);
            UnitOfWork         unitOfWork            = DbContextMock.GetUnitOfWork(mockContext);
            ResponsibleProject newResponsibleProject = new ResponsibleProject
            {
                Name         = "Gustavo Antonio",
                LastName     = "Ruiz Zapata",
                EmailAddress = "*****@*****.**",
                Charge       = "Jefe de departamento de Tecnología Educativa"
            };

            unitOfWork.ResponsibleProjects.Add(newResponsibleProject);
            int expected = 1;
            int actual   = responsiblesProject.Count;

            Assert.AreEqual(expected, actual);
        }
Esempio n. 11
0
        public void TestInitialize()
        {
            _monthlyReports = new List <MonthlyReport>
            {
                new MonthlyReport
                {
                    IdMonthlyReport     = 2,
                    DeliveryDate        = DateTime.Now,
                    PerformedActivities = "Acordar con la organización vinculada las tareas que se realizarán",
                    ResultsObtained     = "Documento de calendario de actividades",
                    HoursReported       = 20,
                    HoursCumulative     = 20,
                    Enrollment          = "zS18012124",
                    IdProject           = 1
                }
            };

            _mockSet     = DbContextMock.GetQueryableMockDbSet(_monthlyReports, p => p.IdMonthlyReport);
            _mockContext = DbContextMock.GetContext(_mockSet);
            _unitOfWork  = DbContextMock.GetUnitOfWork(_mockContext);
        }
Esempio n. 12
0
        public void RegisterProject_Exists()
        {
            List <Project>  projects = new List <Project>();
            DbSet <Project> mockSet  = DbContextMock.GetQueryableMockDbSet(projects, p => p.NameProject);
            ProfessionalPracticesContext mockContext = DbContextMock.GetContext(mockSet);
            UnitOfWork unitOfWork = DbContextMock.GetUnitOfWork(mockContext);
            Project    newProject = new Project
            {
                NameProject        = "Sistema Integral Académico",
                Description        = "Desarrollar un Sistema Web que gestione los procesos académicos que realizan las diferentes áreas dentro de la Universidad Veracruzana dentro de un mismo portal.",
                ObjectiveGeneral   = "Optimizar los procesos de consulta y seguimiento de los académicos.",
                ObjectiveImmediate = "Revisión, análisis y documentación de requerimientos académicos con las áreas involucradas durante este desarrollo. " +
                                     "Revisión y análisis de la arquitectura." +
                                     "Desarrollo de prototipo.",
                ObjectiveMediate = "Modificación de documentación y Modificación de prototipos.",
                Methodology      = "Proceso de desarrollo iterativo y Design Sprint, SCRUM",
                Resources        = "1 Ingeniero de software/programador Web " +
                                   "Recursos materiales: " +
                                   "Computadoras de escritorio " +
                                   "IDE para programación(Visual Studio con C#) " +
                                   "Acceso a Internet " +
                                   "Documentación de procesos",
                Activities       = "Realizar a cabo la documentación del desarrollo del proyecto de la primera fase del proyecto, mediante el modelado de casos de uso, la descripción de los mismos y modelo de dominio, desarrollar sobre lenguaje C# y servicios dentro de un API, además de trabajar en equipo dentro del departamento.",
                Responsibilities = "Cumplir con las funciones y actividades que sean asignadas " +
                                   "Cumplir en tiempo y forma con las entregas de prototipos y productos " +
                                   "Desarrollar en un ambiente colaborativo " +
                                   "Trabajar de acuerdo a los estándares establecidos",
                DaysHours              = "A acordar con el estudiante (en horario de oficina)",
                Duration               = 480,
                Term                   = "FEBRERO-JULIO 2021",
                QuantityPracticing     = 3,
                StaffNumberCoordinator = "1515151"
            };

            unitOfWork.Projects.Add(newProject);
            int expected = 1;
            int actual   = projects.Count;

            Assert.AreEqual(expected, actual);
        }
Esempio n. 13
0
        public void CoordinatorRegisteredTest()
        {
            List <Coordinator>           coordinators = new List <Coordinator>();
            DbSet <Coordinator>          mockSet      = DbContextMock.GetQueryableMockDbSet(coordinators, c => c.StaffNumber);
            ProfessionalPracticesContext mockContext  =
                DbContextMock.GetContext(mockSet);
            UnitOfWork unitOfWork = DbContextMock.GetUnitOfWork(mockContext);

            Coordinator newlyCreatedCoordinator = new Coordinator
            {
                StaffNumber      = "XGC16215",
                RegistrationDate = DateTime.Now,
                DischargeDate    = null,
                User             = new User
                {
                    IdUser         = 1,
                    Name           = "Eduardo Aldair",
                    LastName       = "Hernández Solís",
                    Gender         = Gender.MALE,
                    UserStatus     = UserStatus.ACTIVE,
                    Email          = "*****@*****.**",
                    AlternateEmail = "*****@*****.**",
                    PhoneNumber    = "2298046218",
                    Account        = new Account
                    {
                        Username   = "******",
                        Password   = "******",
                        FirstLogin = true
                    }
                }
            };

            unitOfWork.Coordinators.Add(newlyCreatedCoordinator);

            int expected = 1;
            int actual   = coordinators.Count;

            Assert.AreEqual(expected, actual);
        }
Esempio n. 14
0
        public void SoftDeleteTeacher_Exists()
        {
            List <Teacher>  teachers = new List <Teacher>();
            DbSet <Teacher> mockSet  = DbContextMock.GetQueryableMockDbSet(teachers, t => t.StaffNumber);
            ProfessionalPracticesContext mockContext = DbContextMock.GetContext(mockSet);
            UnitOfWork unitOfWork = DbContextMock.GetUnitOfWork(mockContext);
            Teacher    newTeacher = new Teacher
            {
                StaffNumber = "124987",
                User        = new User
                {
                    Name           = "Jorge Octavio",
                    LastName       = "Ocharan Hernandez",
                    Gender         = Gender.MALE,
                    UserStatus     = UserStatus.ACTIVE,
                    PhoneNumber    = "2284564791",
                    UserType       = UserType.Teacher,
                    Email          = "*****@*****.**",
                    AlternateEmail = "*****@*****.**",
                    Account        = new Account
                    {
                        Username   = "******",
                        Password   = "******",
                        FirstLogin = true
                    }
                }
            };

            teachers.Add(newTeacher);
            Teacher deleteTeacher = unitOfWork.Teachers.Get(newTeacher.StaffNumber);

            deleteTeacher.User.UserStatus = UserStatus.ACTIVE;
            teachers.Remove(newTeacher);
            int expected = 0;
            int actual   = teachers.Count;

            Assert.AreEqual(expected, actual);
        }
Esempio n. 15
0
        public void RegisterPartialReport_Exists()
        {
            DateTime                     localDate        = DateTime.Now;
            List <PartialReport>         partialReports   = new List <PartialReport>();
            DbSet <PartialReport>        mockSet          = DbContextMock.GetQueryableMockDbSet(partialReports, p => p.IdParcialReport);
            ProfessionalPracticesContext mockContext      = DbContextMock.GetContext(mockSet);
            UnitOfWork                   unitOfWork       = DbContextMock.GetUnitOfWork(mockContext);
            PartialReport                newPartialReport = new PartialReport
            {
                NumberReport    = "PRIMERO",
                ResultsObtained = "Actividades completas",
                HoursCovered    = 240,
                Observations    = "Falto una actividad",
                DeliveryDate    = localDate,
                IdProject       = 1,
                Enrollment      = "zS18012149"
            };

            unitOfWork.PartialReports.Add(newPartialReport);
            int expected = 1;
            int actual   = partialReports.Count;

            Assert.AreEqual(expected, actual);
        }
Esempio n. 16
0
        public void TestInitialize()
        {
            _groupValidator = new GroupValidator();
            _practicioners  = new List <Practicioner> {
                new Practicioner
                {
                    Enrollment = "zS18012124",
                    Term       = "FEBRERO - JULIO 2021",
                    Credits    = 288,
                    User       = new User
                    {
                        IdUser         = 1,
                        Name           = "Pedro",
                        LastName       = "Lopez",
                        Gender         = Gender.MALE,
                        UserStatus     = UserStatus.ACTIVE,
                        Email          = "*****@*****.**",
                        AlternateEmail = "*****@*****.**",
                        PhoneNumber    = "2281456785",
                        Account        = new Account
                        {
                            Username   = "******",
                            Password   = "******",
                            FirstLogin = true
                        }
                    }
                },

                new Practicioner
                {
                    Enrollment = "zS18012125",
                    Term       = "FEBRERO - JULIO 2021",
                    Credits    = 288,
                    User       = new User
                    {
                        IdUser         = 2,
                        Name           = "Priscila",
                        LastName       = "Luna",
                        Gender         = Gender.FEMALE,
                        UserStatus     = UserStatus.ACTIVE,
                        Email          = "*****@*****.**",
                        AlternateEmail = "*****@*****.**",
                        PhoneNumber    = "2281456784",
                        Account        = new Account
                        {
                            Username   = "******",
                            Password   = "******",
                            FirstLogin = true
                        }
                    }
                },

                new Practicioner
                {
                    Enrollment = "zS18012126",
                    Term       = "FEBRERO - JULIO 2021",
                    Credits    = 288,
                    User       = new User
                    {
                        IdUser         = 3,
                        Name           = "Pablo",
                        LastName       = "Lara",
                        Gender         = Gender.MALE,
                        UserStatus     = UserStatus.ACTIVE,
                        Email          = "*****@*****.**",
                        AlternateEmail = "*****@*****.**",
                        PhoneNumber    = "2281456783",
                        Account        = new Account
                        {
                            Username   = "******",
                            Password   = "******",
                            FirstLogin = true
                        }
                    }
                },

                new Practicioner
                {
                    Enrollment = "zS18012127",
                    Term       = "FEBRERO - JULIO 2021",
                    Credits    = 288,
                    User       = new User
                    {
                        IdUser         = 4,
                        Name           = "Patricio",
                        LastName       = "Lourdes",
                        Gender         = Gender.MALE,
                        UserStatus     = UserStatus.ACTIVE,
                        Email          = "*****@*****.**",
                        AlternateEmail = "*****@*****.**",
                        PhoneNumber    = "2281456782",
                        Account        = new Account
                        {
                            Username   = "******",
                            Password   = "******",
                            FirstLogin = true
                        }
                    }
                },

                new Practicioner
                {
                    Enrollment = "zS18012128",
                    Term       = "FEBRERO - JULIO 2021",
                    Credits    = 288,
                    User       = new User
                    {
                        IdUser         = 5,
                        Name           = "Patricia",
                        LastName       = "Lozcano",
                        Gender         = Gender.FEMALE,
                        UserStatus     = UserStatus.ACTIVE,
                        Email          = "*****@*****.**",
                        AlternateEmail = "*****@*****.**",
                        PhoneNumber    = "2281456781",
                        Account        = new Account
                        {
                            Username   = "******",
                            Password   = "******",
                            FirstLogin = true
                        }
                    }
                }
            };

            _teacher = new List <Teacher>
            {
                new Teacher
                {
                    StaffNumber      = "65245",
                    RegistrationDate = DateTime.Now,
                    DischargeDate    = null,
                    User             = new User
                    {
                        IdUser         = 6,
                        Name           = "Tamara",
                        LastName       = "Lopez",
                        Gender         = Gender.FEMALE,
                        UserStatus     = UserStatus.ACTIVE,
                        Email          = "*****@*****.**",
                        AlternateEmail = "*****@*****.**",
                        PhoneNumber    = "2281456789",
                        Account        = new Account
                        {
                            Username   = "******",
                            Password   = "******",
                            FirstLogin = true
                        }
                    }
                }
            };

            _group = new List <Group>
            {
                new Group
                {
                    IdGroup     = 1,
                    Nrc         = "12341",
                    GroupStatus = GroupStatus.ACTIVE,
                    Term        = "FEBRERO-JUNIO 2021",
                    StaffNumber = "65245"
                }
            };

            _mockSetPracticioner = DbContextMock.GetQueryableMockDbSet(_practicioners, p => p.Enrollment);
            _mockContext         = DbContextMock.GetContext(_mockSetPracticioner);
            _mockSetTeacher      = DbContextMock.GetQueryableMockDbSet(_teacher, t => t.StaffNumber);
            _mockContext         = DbContextMock.GetContext(_mockSetTeacher);
            _mockSetGroup        = DbContextMock.GetQueryableMockDbSet(_group, g => g.IdGroup);
            _mockContext         = DbContextMock.GetContext(_mockSetGroup);

            _unitOfWork = DbContextMock.GetUnitOfWork(_mockContext);
        }