public void MustNoCreateACourseWithTheSameNameAsAnother() { var existingCourse = CourseBuilder.Builder().WithName(_courseVM.Name).Build(); _courseRepository.Setup(x => x.GetCourse(_courseVM.Name)).Returns(existingCourse); Assert.Throws <ArgumentException>(() => _courseService.Store(_courseVM)) .WithMessage("Course already exists"); }
public static CourseBuilder Builder() { var facker = new Faker(); var courseBuilder = new CourseBuilder(); courseBuilder._name = facker.Name.FullName(); courseBuilder._description = facker.Lorem.Paragraph(); courseBuilder._workload = facker.Random.Double(1, 100000); courseBuilder._targetAudience = TargetAudience.Universitário; courseBuilder._value = facker.Finance.Random.Double(0, 100000); return(courseBuilder); }
public void MustNotCourseHaveValueGreaterThan0(double value) { Assert.Throws <ArgumentException>(() => CourseBuilder.Builder().WithValue(value).Build()) .WithMessage("Property 'Value' must be a positive value."); }
public void MustNotCourseHaveWorkloadSmallerThan1(double workload) { Assert.Throws <ArgumentException>(() => CourseBuilder.Builder().WithWorkload(workload).Build()) .WithMessage("Property 'Workload' must need to be greater than zero."); }
public void MustNotCourseHaveInvalidName(string name) { Assert.Throws <ArgumentException>(() => CourseBuilder.Builder().WithName(name).Build()) .WithMessage("Property 'Name' is Invalid."); }