Skip to content

Commit

Permalink
Merge pull request #2647 from hassanhabib/users/glhays/coderub-studen…
Browse files Browse the repository at this point in the history
…tservice-validate

CODE RUB: Rule Parameter Fix Indentations
  • Loading branch information
hassanhabib authored Jul 23, 2023
2 parents 253f013 + e33b26a commit 109e492
Showing 1 changed file with 27 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,15 @@ private void ValidateStudentOnRegister(Student student)
(Rule: IsInvalidX(student.UpdatedDate), Parameter: nameof(Student.UpdatedDate)),
(Rule: IsNotRecent(student.CreatedDate), Parameter: nameof(Student.CreatedDate)),

(Rule: IsNotSame(
firstId: student.UpdatedBy,
secondId: student.CreatedBy,
secondIdName: nameof(Student.CreatedBy)),
Parameter: nameof(Student.UpdatedBy)),

(Rule: IsNotSame(
firstDate: student.UpdatedDate,
secondDate: student.CreatedDate,
secondDateName: nameof(Student.CreatedDate)),
Parameter: nameof(Student.UpdatedDate))
(Rule: IsNotSame(firstId: student.UpdatedBy,
secondId: student.CreatedBy,
secondIdName: nameof(Student.CreatedBy)),
Parameter: nameof(Student.UpdatedBy)),

(Rule: IsNotSame(firstDate: student.UpdatedDate,
secondDate: student.CreatedDate,
secondDateName: nameof(Student.CreatedDate)),
Parameter: nameof(Student.UpdatedDate))
);
}

Expand Down Expand Up @@ -127,33 +125,33 @@ private void ValidateStudentOnModify(Student student)
(Rule: IsNotRecent(student.UpdatedDate), Parameter: nameof(Student.UpdatedDate)),

(Rule: IsSame(
firstDate: student.UpdatedDate,
secondDate: student.CreatedDate,
secondDateName: nameof(Student.CreatedDate)),
Parameter: nameof(Student.UpdatedDate))
firstDate: student.UpdatedDate,
secondDate: student.CreatedDate,
secondDateName: nameof(Student.CreatedDate)),
Parameter: nameof(Student.UpdatedDate))
);
}

public void ValidateAgainstStorageStudentOnModify(Student inputStudent, Student storageStudent)
{
Validate(
(Rule: IsNotSame(
firstDate: inputStudent.CreatedDate,
secondDate: storageStudent.CreatedDate,
secondDateName: nameof(Student.CreatedDate)),
Parameter: nameof(Student.CreatedDate)),
firstDate: inputStudent.CreatedDate,
secondDate: storageStudent.CreatedDate,
secondDateName: nameof(Student.CreatedDate)),
Parameter: nameof(Student.CreatedDate)),

(Rule: IsSame(
firstDate: inputStudent.UpdatedDate,
secondDate: storageStudent.UpdatedDate,
secondDateName: nameof(Student.UpdatedDate)),
Parameter: nameof(Student.UpdatedDate)),
firstDate: inputStudent.UpdatedDate,
secondDate: storageStudent.UpdatedDate,
secondDateName: nameof(Student.UpdatedDate)),
Parameter: nameof(Student.UpdatedDate)),

(Rule: IsNotSame(
firstId: inputStudent.CreatedBy,
secondId: storageStudent.CreatedBy,
secondIdName: nameof(Student.CreatedBy)),
Parameter: nameof(Student.CreatedBy))
firstId: inputStudent.CreatedBy,
secondId: storageStudent.CreatedBy,
secondIdName: nameof(Student.CreatedBy)),
Parameter: nameof(Student.CreatedBy))
);
}

Expand All @@ -167,7 +165,7 @@ private bool IsDateNotRecent(DateTimeOffset date)

return timeDifference.Duration() > oneMinute;
}

private static void ValidateStudent(Student student)
{
if (student is null)
Expand Down

0 comments on commit 109e492

Please sign in to comment.