public void IsValidStudentSuccess() { Student aStudent = new Student(); int intTest = 47801236; string testStrings = "thisIsATest"; aStudent.Id = intTest; aStudent.Name = testStrings; aStudent.LastName = testStrings; Coordinate aCoordinate = new Coordinate(); aCoordinate.X = intTest; aCoordinate.Y = intTest; aStudent.Coordinates = aCoordinate; aStudent.Ci = intTest; aStudent.StudentNumber = intTest; List <Subject> subjectList = new List <Subject>(); Subject newSubject = new Subject(); subjectList.Add(newSubject); aStudent.Subjects = subjectList; StudentValidator validator = new StudentValidator(); Assert.IsTrue(validator.IsValid(aStudent)); }
public void IsValidDifferentObjectFail() { StudentValidator validator = new StudentValidator(); int testInt = 5; Assert.IsFalse(validator.IsValid(testInt)); }
public void IsValidStudentFail() { Student aStudent = new Student(); StudentValidator validator = new StudentValidator(); Assert.IsFalse(validator.IsValid(aStudent)); }
private IEnumerable <StudentDTO> GetValidStudentsWrongWay() { return(_context.Students.Where( x => x.Name.Length > 2 && StudentValidator.IsValid(x)) .Select(x => x.ToDtoStudent())); }
private bool CanIAdd(Object anObject) { StudentValidator validator = new StudentValidator(); bool domainValidations = validator.IsValid(anObject); bool validation = domainValidations && IsNewUser(anObject); return(validation); }
private bool ModifyValidation(Object anObject, Object anotherObject) { StudentValidator validator = new StudentValidator(); bool domainValidation = validator.IsValid(anotherObject); bool nonExists = !Exists(anotherObject); bool sameId = anObject.Equals(anotherObject); Student aStudent = anObject as Student; Student anotherStudent = anotherObject as Student; bool sameCI = aStudent.Ci.Equals(anotherStudent.Ci); return(domainValidation && (nonExists || IsTheSameIdWithNewNonExistenCi(anObject, anotherObject))); }