private void ValidateRanges(List <Department> departments, Department department) { if (!DepartmentValidations.IsValidWeightRanges(departments, department)) { throw new DomainException("The value is confliting with the existing Weights."); } if (!DepartmentValidations.IsValidValueRanges(departments, department)) { throw new DomainException("The value is confliting with the existing Minimum Parcel Values."); } }
public void Add_department_overlapping_weight_existent_must_returns_false( double newDepartmentMinWeight, double newDepartmentMaxWeight, double departmentMinWeight, double departmentMaxWeight) { //Arrange var _departments = new List <Department> { new Department(newDepartmentMinWeight, newDepartmentMaxWeight, 0, 0, _validName) }; var newDepartment = new Department(departmentMinWeight, departmentMaxWeight, 0, 0, "New Department"); //Act _departments.Add(newDepartment); var result = DepartmentValidations.IsValidWeightRanges(_departments, newDepartment); //Assert Assert.False(result); }