Exemple #1
0
        public void Checks_field_linked_types()
        {
            CodeModelFactory factory = new CodeModelFactory();

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

            var dateRange      = 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"));
            var otherDoctor    = otherClasses.Find(c => c.Name.Equals("Doctor"));
            var otherDateRange = otherClasses.Find(c => c.Name.Equals("DateRange"));

            dateRange.FindField("testDictionary").GetLinkedTypes().ShouldContain(doctor);
            dateRange.FindField("testDictionary").GetLinkedTypes().ShouldNotContain(otherDoctor);
            dateRange.FindField("testDictionary").GetLinkedTypes().ShouldContain(doctorService);
            doctor.FindField("TestDR").GetLinkedTypes().ShouldContain(dateRange);
            doctor.FindField("TestDR").GetLinkedTypes().ShouldNotContain(otherDateRange);
            doctorService.FindField("_doctors").GetLinkedTypes().ShouldContain(doctor);
        }