예제 #1
0
        public void TestResourceNameResolving()
        {
            var inspector = new ModelInspector();

            inspector.ImportType(typeof(Road));
            inspector.ImportType(typeof(Way));
            inspector.ImportType(typeof(ProfiledWay));
            inspector.ImportType(typeof(NewStreet));
            //inspector.Process();

            var road = inspector.FindClassMappingForResource("roAd");
            Assert.IsNotNull(road);
            Assert.AreEqual(road.NativeType, typeof(Road));

            var way = inspector.FindClassMappingForResource("Way");
            Assert.IsNotNull(way);
            Assert.AreEqual(way.NativeType, typeof(Way));

            var pway = inspector.FindClassMappingForResource("way", "http://nu.nl/profile#street");
            Assert.IsNotNull(pway);
            Assert.AreEqual(pway.NativeType, typeof(ProfiledWay));

            var pway2 = inspector.FindClassMappingForResource("way", "http://nux.nl/profile#street");
            Assert.IsNotNull(pway2);
            Assert.AreEqual(pway2.NativeType, typeof(Way));

            var street = inspector.FindClassMappingForResource("Street");
            Assert.IsNotNull(street);
            Assert.AreEqual(street.NativeType, typeof(NewStreet));

            var noway = inspector.FindClassMappingForResource("nonexistent");
            Assert.IsNull(noway);
        }
예제 #2
0
        public void TypeDataTypeNameResolving()
        {
            var inspector = new ModelInspector();

            inspector.ImportType(typeof(AnimalName));
            inspector.ImportType(typeof(NewAnimalName));

            var result = inspector.FindClassMappingForFhirDataType("animalname");
            Assert.IsNotNull(result);
            Assert.AreEqual(result.NativeType, typeof(NewAnimalName));

            // Validate a mapping for a type will return the newest registration
            result = inspector.FindClassMappingByType(typeof(AnimalName));
            Assert.IsNotNull(result);
            Assert.AreEqual(result.NativeType, typeof(NewAnimalName));
        }