예제 #1
0
        public void GetMetadataFromCache()
        {
            StatePropertyReflector reflector = new StatePropertyReflector();

            reflector.GetMetadata(typeof(PaperFile).GetProperty("Confidentiality"), _cache);
            reflector.GetMetadata(typeof(File).GetProperty("Confidentiality"), _cache);

            StatePropertyInfo paperFileConfidentialityInfo = _cache.GetStatePropertyInfo(typeof(PaperFile).GetProperty("Confidentiality"));

            Assert.That(paperFileConfidentialityInfo, Is.Not.Null);
            Assert.That(paperFileConfidentialityInfo.Name, Is.EqualTo("Confidentiality"));
            Assert.That(_cache.GetStatePropertyInfo(typeof(File).GetProperty("Confidentiality")), Is.SameAs(paperFileConfidentialityInfo));
        }
예제 #2
0
        public void GetMetadata()
        {
            Dictionary <Enum, EnumValueInfo> values = new Dictionary <Enum, EnumValueInfo> ();

            values.Add(Confidentiality.Normal, PropertyStates.ConfidentialityNormal);
            values.Add(Confidentiality.Confidential, PropertyStates.ConfidentialityConfidential);
            values.Add(Confidentiality.Private, PropertyStates.ConfidentialityPrivate);

            Expect.Call(_enumeratedTypeReflectorMock.GetValues(typeof(Confidentiality), _cache)).Return(values);
            _mocks.ReplayAll();

            StatePropertyInfo info = _statePropertyReflector.GetMetadata(typeof(PaperFile).GetProperty("Confidentiality"), _cache);

            _mocks.VerifyAll();

            Assert.That(info, Is.Not.Null);
            Assert.That(info.Name, Is.EqualTo("Confidentiality"));
            Assert.That(info.ID, Is.EqualTo("00000000-0000-0000-0001-000000000001"));

            Assert.That(info.Values, Is.Not.Null);
            Assert.That(info.Values.Count, Is.EqualTo(3));
            Assert.That(info.Values, Has.Member(PropertyStates.ConfidentialityNormal));
            Assert.That(info.Values, Has.Member(PropertyStates.ConfidentialityPrivate));
            Assert.That(info.Values, Has.Member(PropertyStates.ConfidentialityConfidential));
        }