Example #1
0
        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");
        }
Example #2
0
        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);
        }
Example #3
0
 public void MustNotCourseHaveValueGreaterThan0(double value)
 {
     Assert.Throws <ArgumentException>(() => CourseBuilder.Builder().WithValue(value).Build())
     .WithMessage("Property 'Value' must be a positive value.");
 }
Example #4
0
 public void MustNotCourseHaveWorkloadSmallerThan1(double workload)
 {
     Assert.Throws <ArgumentException>(() => CourseBuilder.Builder().WithWorkload(workload).Build())
     .WithMessage("Property 'Workload' must need to be greater than zero.");
 }
Example #5
0
 public void MustNotCourseHaveInvalidName(string name)
 {
     Assert.Throws <ArgumentException>(() => CourseBuilder.Builder().WithName(name).Build())
     .WithMessage("Property 'Name' is Invalid.");
 }