private static Lazy<ModelInspector> createDefaultModelInspector() { return new Lazy<ModelInspector>(() => { var result = new ModelInspector(); #if PORTABLE45 result.Import(typeof(Resource).GetTypeInfo().Assembly); #else result.Import(typeof(Resource).Assembly); #endif return result; }); }
public void TestAssemblyInspection() { var inspector = new ModelInspector(); // Inspect the HL7.Fhir.Model assembly inspector.Import(typeof(Resource).Assembly); // Check for presence of some basic ingredients Assert.IsNotNull(inspector.FindClassMappingForResource("patient")); Assert.IsNotNull(inspector.FindClassMappingForFhirDataType("HumanName")); Assert.IsNotNull(inspector.FindClassMappingForFhirDataType("code")); Assert.IsNotNull(inspector.FindClassMappingForFhirDataType("boolean")); // Verify presence of nested enumerations Assert.IsNotNull(inspector.FindEnumMappingByType(typeof(Address.AddressUse))); // Should have skipped abstract classes Assert.IsNull(inspector.FindClassMappingForResource("ComplexElement")); Assert.IsNull(inspector.FindClassMappingForResource("Element")); Assert.IsNull(inspector.FindClassMappingForResource("Resource")); // The open generic Code<> should not be there var codeOfT = inspector.FindClassMappingByType(typeof(Code<>)); Assert.IsNull(codeOfT); }