public void StoreLookUpAttributeWithLookupAttributeMetadataButEmptyTargetList() { var attributeLogicalName = "contactId"; string primaryAttribute = "contactId"; var crmField = new Capgemini.Xrm.DataMigration.Model.CrmField() { PrimaryKey = false, FieldName = primaryAttribute, FieldType = "entityreference" }; var attribute = new LookupAttributeMetadata { LogicalName = attributeLogicalName, DisplayName = new Label { UserLocalizedLabel = new LocalizedLabel { Label = attributeLogicalName } } }; NotificationServiceMock.Setup(x => x.DisplayFeedback("The supplied attribute is null. Expecting an Entity Reference!")) .Verifiable(); FluentActions.Invoking(() => systemUnderTest.StoreLookUpAttribute(attribute, crmField, NotificationServiceMock.Object)) .Should() .NotThrow(); NotificationServiceMock.Verify(x => x.DisplayFeedback("The supplied attribute is null. Expecting an Entity Reference!"), Times.Never); crmField.LookupType.Should().BeNull(); }
public void StoreAttributePrimaryKeyWithWrongPrimaryAttributeName() { string primaryAttribute = "contactId"; var crmField = new Capgemini.Xrm.DataMigration.Model.CrmField() { PrimaryKey = false, FieldName = "contactId2" }; FluentActions.Invoking(() => systemUnderTest.StoreAttributePrimaryKey(primaryAttribute, crmField)) .Should() .NotThrow(); crmField.PrimaryKey.Should().BeFalse(); }
public void StoreLookUpAttributeLookupAttributeMetadataIsNull() { string primaryAttribute = "contactId"; var crmField = new Capgemini.Xrm.DataMigration.Model.CrmField() { PrimaryKey = false, FieldName = primaryAttribute, FieldType = "entityreference" }; NotificationServiceMock.Setup(x => x.DisplayFeedback("The supplied attribute is null. Expecting an Entity Reference!")) .Verifiable(); FluentActions.Invoking(() => systemUnderTest.StoreLookUpAttribute(null, crmField, NotificationServiceMock.Object)) .Should() .NotThrow(); NotificationServiceMock.Verify(x => x.DisplayFeedback("The supplied attribute is null. Expecting an Entity Reference!"), Times.Once); }
public void StoreLookUpAttributeNotLookupAttributeMetadata() { var attributeLogicalName = "contactId"; string primaryAttribute = "contactId"; var crmField = new Capgemini.Xrm.DataMigration.Model.CrmField() { PrimaryKey = false, FieldName = primaryAttribute, FieldType = "entityreference" }; var attribute = new AttributeMetadata { LogicalName = attributeLogicalName, DisplayName = new Label { UserLocalizedLabel = new LocalizedLabel { Label = attributeLogicalName } } }; var attributeTypeName = attribute.GetType().GetRuntimeFields().First(a => a.Name == "_attributeTypeDisplayName"); attributeTypeName.SetValue(attribute, new AttributeTypeDisplayName { Value = attributeLogicalName }); NotificationServiceMock.Setup(x => x.DisplayFeedback("The supplied attribute is null. Expecting an Entity Reference!")) .Verifiable(); FluentActions.Invoking(() => systemUnderTest.StoreLookUpAttribute(attribute, crmField, NotificationServiceMock.Object)) .Should() .NotThrow(); NotificationServiceMock.Verify(x => x.DisplayFeedback("The supplied attribute is null. Expecting an Entity Reference!"), Times.Once); }