public void AddGroupFunctionTest_ShouldBeSuccess() { var group = new GroupExtendedProxy { GroupName = "nameOfGroup" }; RunServer(new AddGroupFunction(DatabaseAuthorizer, databaseGroupEditor)); SendRequest("AddGroup", GetDefaultParameters(), group.ToJson()); A.CallTo(() => databaseGroupEditor.Add(group)).MustHaveHappened(Repeated.Exactly.Once); }
public void Edit(GroupExtendedProxy oldExtendedProxy, GroupExtendedProxy newExtendedProxy) { var foundGroup = ModelDatabase.GetGroup(oldExtendedProxy); foundGroup.GroupName = newExtendedProxy.GroupName; foundGroup.SpecialtyName = newExtendedProxy.SpecialtyName; foundGroup.SpecialtyNumber = newExtendedProxy.SpecialtyNumber; foundGroup.FacultyName = newExtendedProxy.FacultyName; ModelDatabase.SaveChanges(); }
public void Add(GroupExtendedProxy extendedProxy) { ModelDatabase.Groups.Add(new Group { GroupName = extendedProxy.GroupName, SpecialtyName = extendedProxy.SpecialtyName, SpecialtyNumber = extendedProxy.SpecialtyNumber, FacultyName = extendedProxy.FacultyName, Students = new List <Student>(), Disciplines = new List <Discipline>() }); ModelDatabase.SaveChanges(); }
public void EditGroupFunctionTest_ShouldBeSuccess() { var firstGroup = new GroupExtendedProxy { GroupName = "firstNameOfGroup" }; var secondGroup = new GroupExtendedProxy { GroupName = "secondNameOfGroup" }; RunServer(new EditGroupFunction(DatabaseAuthorizer, databaseGroupEditor)); SendRequest("EditGroup", GetDefaultParameters(), Tuple.Create(firstGroup, secondGroup).ToJson()); A.CallTo(() => databaseGroupEditor.Edit(firstGroup, secondGroup)).MustHaveHappened(Repeated.Exactly.Once); }
public void GetExtendedGroupFunctionTest_ShouldBeSuccess() { var inputBasedGroup = new GroupBasedProxy { GroupName = "firstGroup" }; var inputExtendedGroup = new GroupExtendedProxy { GroupName = "firstGroup" }; A.CallTo(() => databaseGroupReader.GetExtendedProxy(inputBasedGroup)).Returns(inputExtendedGroup); RunServer(new GetExtendedGroupFunction(DatabaseAuthorizer, databaseGroupReader)); var receivedGroup = SendRequest <GroupExtendedProxy>("GetExtendedGroup", GetDefaultParameters(), inputBasedGroup.ToJson()); A.CallTo(() => databaseGroupReader.GetExtendedProxy(inputBasedGroup)).MustHaveHappened(Repeated.Exactly.Once); Assert.That(receivedGroup, Is.EqualTo(inputExtendedGroup)); }
protected abstract Content CreateContent(StudentExtendedProxy student, DisciplineExtendedProxy[] disciplines, GroupExtendedProxy group);
private void LoadNewData() { var group = new GroupExtendedProxy { GroupName = "Б08-191-2", SpecialtyNumber = 231000, SpecialtyName = "Программная инженерия", FacultyName = "Информатика и вычислительная техника" }; databaseGroupEditor.Add(group); databaseDisciplineEditor.Add(new DisciplineExtendedProxy { DisciplineName = "Английский язык", ControlType = ControlType.Exam, GroupName = group.GroupName, ClassHours = 32, TotalHours = 48 }); databaseDisciplineEditor.Add(new DisciplineExtendedProxy { DisciplineName = "Архитектура ЭВМ", ControlType = ControlType.CourseWork, GroupName = group.GroupName, ClassHours = 0, TotalHours = 0 }); databaseDisciplineEditor.Add(new DisciplineExtendedProxy { DisciplineName = "Физика", ControlType = ControlType.Credit, GroupName = group.GroupName, ClassHours = 32, TotalHours = 48 }); databaseDisciplineEditor.Add(new DisciplineExtendedProxy { DisciplineName = "Вычислительная математика", ControlType = ControlType.Credit, GroupName = group.GroupName, ClassHours = 16, TotalHours = 16 }); databaseDisciplineEditor.Add(new DisciplineExtendedProxy { DisciplineName = "Инженерная графика", ControlType = ControlType.CourseWork, GroupName = group.GroupName, ClassHours = 0, TotalHours = 0 }); databaseDisciplineEditor.Add(new DisciplineExtendedProxy { DisciplineName = "Производственно-технологическая", ControlType = ControlType.Practice, GroupName = group.GroupName, ClassHours = 4, TotalHours = 0 }); databaseDisciplineEditor.Add(new DisciplineExtendedProxy { DisciplineName = "Междисциплинарный экзамен по направлению", ControlType = ControlType.StateExam, GroupName = group.GroupName, ClassHours = 0, TotalHours = 0 }); databaseStudentEditor.Add(new StudentExtendedProxy { FirstName = "Владимир", SecondName = "Новоселов", ThirdName = "Олегович", DateOfBirth = new DateTime(1995, 8, 9), PreviousEducationName = "аттестат о среднем (полном) общем образовании", PreviousEducationYear = 2011, EnrollmentName = "государственное образовательное учреждение высшего профессионального образования \"Ижевский государственный технический университет\" (очная форма)", EnrollmentYear = 2011, ExpulsionName = "федеральном государственном бюджетном образовательном учреждении высшего профессионального образования \"Ижевский государственный технический университет\" (очная форма)", ExpulsionYear = 2015, ExpulsionOrderDate = new DateTime(2015, 1, 1), ExpulsionOrderNumber = 3764, DiplomaTopic = "Эта программа", DiplomaAssessment = Assessment.Excellent, ProtectionDate = DateTime.Now, ProtocolNumber = "2015-231000-28", RegistrationNumber = "76 004", RegistrationDate = DateTime.Now, GroupName = group.GroupName, AssessmentByDisciplines = new[] { new AssessmentByDiscipline { NameOfDiscipline = "Английский язык", Assessment = Assessment.Good }, new AssessmentByDiscipline { NameOfDiscipline = "Архитектура ЭВМ", Assessment = Assessment.Excellent }, new AssessmentByDiscipline { NameOfDiscipline = "Физика", Assessment = Assessment.Credited }, new AssessmentByDiscipline { NameOfDiscipline = "Вычислительная математика", Assessment = Assessment.Credited }, new AssessmentByDiscipline { NameOfDiscipline = "Инженерная графика", Assessment = Assessment.Excellent }, new AssessmentByDiscipline { NameOfDiscipline = "Производственно-технологическая", Assessment = Assessment.Excellent }, new AssessmentByDiscipline { NameOfDiscipline = "Междисциплинарный экзамен по направлению", Assessment = Assessment.Excellent } } }); }
protected override Content CreateContent(StudentExtendedProxy student, DisciplineExtendedProxy[] disciplines, GroupExtendedProxy group) { return(new Content( new FieldContent("FirstName", student.FirstName), new FieldContent("SecondName", student.SecondName), new FieldContent("ThirdName", student.ThirdName), new FieldContent("DateOfBirth", student.DateOfBirth.ToString("dd MMMM yyyy", CultureInfo.CreateSpecificCulture("ru-RU"))), new FieldContent("PreviousEducationName", student.PreviousEducationName), new FieldContent("PreviousEducationYear", student.PreviousEducationYear.ToString()), new FieldContent("EnrollmentYear", student.EnrollmentYear.ToString()), new FieldContent("EnrollmentName", student.EnrollmentName), new FieldContent("ExpulsionName", student.ExpulsionName), new FieldContent("ExpulsionYear", student.ExpulsionYear.ToString()), new FieldContent("ExpulsionOrderDate", student.ExpulsionOrderDate.ToString("dd.mm.yyyy")), new FieldContent("ExpulsionOrderNumber", student.ExpulsionOrderNumber.ToString()), new FieldContent("NormativePeriodOfStudy", (student.ExpulsionYear - student.EnrollmentYear).ToString()), new FieldContent("SpecialtyNumber", group.SpecialtyNumber.ToString()), new FieldContent("FacultyName", group.FacultyName), new FieldContent("SpecialtyName", group.SpecialtyName), CreateCourceWorksTable(student.AssessmentByDisciplines), CreateAssessmentByDisciplinesTable1(student.AssessmentByDisciplines, disciplines), CreateAssessmentByDisciplinesTable2(student.AssessmentByDisciplines, disciplines), CreateAssessmentByDisciplinesTable3(student.AssessmentByDisciplines), new FieldContent("SumTotalHours", disciplines.Sum(discipline => discipline.TotalHours).ToString()), new FieldContent("SumClassHours", disciplines.Sum(discipline => discipline.ClassHours).ToString()) )); }
public void Edit(GroupExtendedProxy oldExtendedProxy, GroupExtendedProxy newExtendedProxy) { SendRequest("EditGroup", GetDefaultParameters(), Tuple.Create(oldExtendedProxy, newExtendedProxy).ToJson()); }
public void Add(GroupExtendedProxy extendedProxy) { SendRequest("AddGroup", GetDefaultParameters(), extendedProxy.ToJson()); }
protected override Content CreateContent(StudentExtendedProxy student, DisciplineExtendedProxy[] disciplines, GroupExtendedProxy group) { var registrationDate = student.RegistrationDate.ToString("dd MMMM yyyy", CultureInfo.CreateSpecificCulture("ru-RU")).Split(); return(new Content( new FieldContent("RegistrationNumber", student.RegistrationNumber), new FieldContent("ProtectionDate", student.ProtectionDate.ToString("dd MMMM yyyy", CultureInfo.CreateSpecificCulture("ru-RU"))), new FieldContent("RegistrationNumber", student.RegistrationNumber), new FieldContent("FirstName", student.FirstName), new FieldContent("SecondName", student.SecondName), new FieldContent("ThirdName", student.ThirdName), new FieldContent("SpecialtyNumber", group.SpecialtyNumber.ToString()), new FieldContent("FacultyName", group.FacultyName), new FieldContent("ProtocolNumber", student.ProtocolNumber), new FieldContent("RegistrationDateDay", registrationDate[0]), new FieldContent("RegistrationDateMonth", registrationDate[1]), new FieldContent("RegistrationDateYear", registrationDate[2]))); }
protected override Content CreateContent(StudentExtendedProxy student, DisciplineExtendedProxy[] disciplines, GroupExtendedProxy group) { var content = new Content( CreateCourceWorksTable(student.AssessmentByDisciplines), new FieldContent("FirstName", student.FirstName), new FieldContent("SecondName", student.SecondName), new FieldContent("ThirdName", student.ThirdName), new FieldContent("DateOfBirth", student.DateOfBirth.ToString("dd MMMM yyyy", CultureInfo.CreateSpecificCulture("ru-RU"))), new FieldContent("PreviousEducationName", student.PreviousEducationName), new FieldContent("PreviousEducationYear", student.PreviousEducationYear.ToString()), new FieldContent("SpecialtyNumber", group.SpecialtyNumber.ToString()), new FieldContent("FacultyName", group.FacultyName), new FieldContent("RegistrationNumber", student.RegistrationNumber), new FieldContent("ProtectionDate", student.ProtectionDate.ToString("dd MMMM yyyy", CultureInfo.CreateSpecificCulture("ru-RU"))), new FieldContent("NormativePeriodOfStudy", (student.ExpulsionYear - student.EnrollmentYear).ToString()), CreateAssessmentByDisciplinesTable1(student.AssessmentByDisciplines, disciplines), CreateAssessmentByDisciplinesTable2(student.AssessmentByDisciplines, disciplines), CreateAssessmentByDisciplinesTable3(student.AssessmentByDisciplines), new FieldContent("SumPracticeWeeks", disciplines.Where(discipline => discipline.ControlType == ControlType.Practice).Sum(discipline => discipline.ClassHours).ToString()), new FieldContent("DiplomaTopic", student.DiplomaTopic), new FieldContent("DiplomaAssessment", typeof(Assessment).GetField(student.DiplomaAssessment.ToString()).GetCustomAttribute <NameEnumValueAttribute>().NameEnumValue.ToLower()), new FieldContent("SumTotalWeeks", (disciplines.Sum(discipline => discipline.TotalHours) / 7).ToString()), new FieldContent("SumClassHours", disciplines.Sum(discipline => discipline.ClassHours).ToString()) ); return(content); }