public void SaveSchemaNoEntityAttributeSelected() { NotificationServiceMock.Setup(x => x.DisplayFeedback("Please select at least one attribute for each selected entity!")) .Verifiable(); using (var schemaPathTextBox = new System.Windows.Forms.TextBox()) { var serviceParameters = GenerateMigratorParameters(); var inputAttributeMapping = new AttributeTypeMapping(); var inputCrmSchemaConfiguration = new DataMigration.Config.CrmSchemaConfiguration(); FluentActions.Invoking(() => systemUnderTest.SaveSchema(serviceParameters, inputCheckedEntity, inputEntityRelationships, inputEntityAttributes, inputAttributeMapping, inputCrmSchemaConfiguration, schemaPathTextBox)) .Should() .NotThrow(); } NotificationServiceMock.Verify(x => x.DisplayFeedback("Please select at least one attribute for each selected entity!"), Times.Once); }
public void SaveSchemaEntityAttributeSelected() { NotificationServiceMock.Setup(x => x.DisplayFeedback("Please select at least one attribute for each selected entity!")) .Verifiable(); var entityLogicalName = "contact"; var entityMetadata = InstantiateEntityMetaData(entityLogicalName); InsertAttributeList(entityMetadata, new List <string> { "contactId", "firstname", "lastname" }); inputCheckedEntity.Add(entityLogicalName); var attributeSet = new HashSet <string>() { "contactId", "firstname", "lastname" }; inputEntityAttributes.Add(entityLogicalName, attributeSet); var inputAttributeMapping = new AttributeTypeMapping(); var serviceParameters = GenerateMigratorParameters(); MetadataServiceMock.Setup(x => x.RetrieveEntities(It.IsAny <string>(), It.IsAny <IOrganizationService>(), It.IsAny <IExceptionService>())) .Returns(entityMetadata) .Verifiable(); using (var schemaPathTextBox = new System.Windows.Forms.TextBox()) { var inputCrmSchemaConfiguration = new DataMigration.Config.CrmSchemaConfiguration(); FluentActions.Invoking(() => systemUnderTest.SaveSchema(serviceParameters, inputCheckedEntity, inputEntityRelationships, inputEntityAttributes, inputAttributeMapping, inputCrmSchemaConfiguration, schemaPathTextBox)) .Should() .NotThrow(); } MetadataServiceMock.VerifyAll(); NotificationServiceMock.Verify(x => x.DisplayFeedback("Please select at least one attribute for each selected entity!"), Times.Never); }