예제 #1
0
        public void GetContactIdFromEntityMetadata()
        {
            var actual = systemUnderTest.GetAttributeDotNetType("contact", "contactid");

            Assert.AreEqual(typeof(Guid), actual);
        }
        public void GetAttributeDotNetTypeBool()
        {
            string entityName    = "contactadntbool";
            string attributeName = "contactadntbool";

            var attributeMetaDataItem = new AttributeMetadata {
                LogicalName = attributeName
            };

            SetFieldValue(attributeMetaDataItem, "_attributeType", AttributeTypeCode.Boolean);

            var attributes = new List <AttributeMetadata> {
                attributeMetaDataItem
            };

            RetrieveEntityResponse response = InjectMetaDataToResponse(new RetrieveEntityResponse(), attributes);

            MockOrganizationService.Setup(a => a.Execute(It.IsAny <OrganizationRequest>())).Returns(response);

            Type actual = null;

            FluentActions.Invoking(() => actual = systemUnderTest.GetAttributeDotNetType(entityName, attributeName))
            .Should()
            .NotThrow();

            MockOrganizationService.VerifyAll();
            Assert.AreEqual(typeof(bool), actual);
        }