コード例 #1
0
        public virtual void TestNullCode()
        {
            TrivialCodeResolver trivialCodeResolver = new TrivialCodeResolver();

            trivialCodeResolver.AddDomainValue(null, typeof(MockCharacters));
            Assert.IsNull(trivialCodeResolver.Lookup <MockCharacters>(MOCK_CHARACTERS_TYPE, "foo"), "null");
            trivialCodeResolver.AddDomainValue(CreateMockCharactersCode("foo"), typeof(MockCharacters));
            Assert.IsNotNull(trivialCodeResolver.Lookup <MockCharacters>(MOCK_CHARACTERS_TYPE, "foo"), "not null");
        }
コード例 #2
0
        public virtual T Lookup <T>(Type type, string code, string codeSystemOid, bool ignoreCase) where T : Code
        {
            CdaCodeResolver.ValueSet valueSet = valueSetsByTypeName.SafeGet(type.Name);
            if (valueSet != null)
            {
                CdaCodeResolver.CodedValue codedValue = valueSet.GetCode(code, codeSystemOid, ignoreCase);
                if (codedValue != null)
                {
                    return(CreateCode <T>(type, codedValue));
                }
            }
            else if (fallbackResolver != null)
            {
                return(fallbackResolver.Lookup <T>(type, code, codeSystemOid, ignoreCase));
            }

            return(default(T));
        }