public void Calculates_number_of_dependencies_in_class()
        {
            CodeModelFactory factory = new CodeModelFactory();

            List <CaDETClass> classes = factory.CreateProject(_testDataFactory.GetMultipleClassTexts()).Classes;

            var dataRange     = classes.Find(c => c.Name.Equals("DateRange"));
            var doctor        = classes.Find(c => c.Name.Equals("Doctor"));
            var doctorService = classes.Find(c => c.Name.Equals("DoctorService"));

            dataRange.Metrics[CaDETMetric.CBO].ShouldBe(2);
            doctor.Metrics[CaDETMetric.CBO].ShouldBe(2);
            doctorService.Metrics[CaDETMetric.CBO].ShouldBe(2);
        }
示例#2
0
        public void Checks_method_signature()
        {
            CodeModelFactory factory = new CodeModelFactory();

            List <CaDETClass> classes = factory.CreateProject(_testDataFactory.GetMultipleClassTexts()).Classes;

            var doctor       = classes.Find(c => c.Name.Equals("Doctor"));
            var dateRange    = classes.Find(c => c.Name.Equals("DateRange"));
            var service      = classes.Find(c => c.Name.Equals("DoctorService"));
            var holidayDates = doctor.FindMember("HolidayDates");
            var overlapsWith = dateRange.FindMember("OverlapsWith");
            var findDoctors  = service.FindMember("FindAvailableDoctor");

            holidayDates.Signature().Equals("HolidayDates");
            overlapsWith.Signature().Equals("OverlapsWith(DoctorApp.Model.Data.DateR.DateRange)");
            findDoctors.Signature().Equals("FindAvailableDoctor(DoctorApp.Model.Data.DateR.DateRange)");
        }