Skip to content

Commit

Permalink
[Quality] as per SonarQube suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
samatrhea committed Apr 14, 2024
1 parent ca423b6 commit aaab95a
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions DEH-REQIF.Tests/Services/ExportSettingsReaderTestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,21 @@ public async Task Verify_that_a_settings_File_is_correctly_read()
{
var exportSettings = await this.exportSettingsReader.ReadFile((this.settingsFilePath));

Assert.That(exportSettings.Title, Is.EqualTo("This is a test ReqIF document"));
Assert.Multiple(() => {
Assert.That(exportSettings.Title, Is.EqualTo("This is a test ReqIF document"));

Assert.That(exportSettings.RequirementAttributeDefinitions.TextAttributeDefinitionId, Is.EqualTo("OBJECTTEXT"));
Assert.That(exportSettings.RequirementAttributeDefinitions.ForeignDeletedAttributeDefinitionId, Is.EqualTo("Pseudo-ForeignDeleted"));
Assert.That(exportSettings.RequirementAttributeDefinitions.NameAttributeDefinitionId, Is.EqualTo("OBJECTSHORTTEXT"));
Assert.That(exportSettings.RequirementAttributeDefinitions.ForeignModifiedOnAttributeDefinitionId, Is.EqualTo("LASTMODIFIEDON"));
Assert.That(exportSettings.RequirementAttributeDefinitions.TextAttributeDefinitionId, Is.EqualTo("OBJECTTEXT"));
Assert.That(exportSettings.RequirementAttributeDefinitions.ForeignDeletedAttributeDefinitionId, Is.EqualTo("Pseudo-ForeignDeleted"));
Assert.That(exportSettings.RequirementAttributeDefinitions.NameAttributeDefinitionId, Is.EqualTo("OBJECTSHORTTEXT"));
Assert.That(exportSettings.RequirementAttributeDefinitions.ForeignModifiedOnAttributeDefinitionId, Is.EqualTo("LASTMODIFIEDON"));

Assert.That(exportSettings.SpecificationAttributeDefinitions.NameAttributeDefinitionId, Is.EqualTo("NAME-DOORS-MODULE"));
Assert.That(exportSettings.SpecificationAttributeDefinitions.NameAttributeDefinitionId, Is.EqualTo("NAME-DOORS-MODULE"));

Assert.That(exportSettings.ExternalIdentifierMap, Is.Not.Null);
Assert.That(exportSettings.ExternalIdentifierMap.Correspondence, Has.Count.EqualTo(1));
Assert.That(exportSettings.ExternalIdentifierMap.Correspondence.First().ExternalId, Is.EqualTo("EXTERNAL_ID"));
Assert.That(exportSettings.ExternalIdentifierMap.Correspondence.First().InternalThing, Is.EqualTo(Guid.Parse("7d936326-544e-4990-96cf-54f67f7aa365")));
Assert.That(exportSettings.ExternalIdentifierMap, Is.Not.Null);
Assert.That(exportSettings.ExternalIdentifierMap.Correspondence, Has.Count.EqualTo(1));
Assert.That(exportSettings.ExternalIdentifierMap.Correspondence.First().ExternalId, Is.EqualTo("EXTERNAL_ID"));
Assert.That(exportSettings.ExternalIdentifierMap.Correspondence.First().InternalThing, Is.EqualTo(Guid.Parse("7d936326-544e-4990-96cf-54f67f7aa365")));
});
}

[Test]
Expand Down Expand Up @@ -106,16 +108,18 @@ public void Verify_that_a_settings_File_can_be_created_and_correctly_read()

var deserializedExportSettings = this.exportSettingsReader.Read(json);

Assert.That(deserializedExportSettings.Title, Is.EqualTo(title));
Assert.That(deserializedExportSettings.RequirementAttributeDefinitions.TextAttributeDefinitionId, Is.EqualTo(requirementTextDataTypeDefinitionId));
Assert.That(deserializedExportSettings.RequirementAttributeDefinitions.ForeignDeletedAttributeDefinitionId, Is.EqualTo(requirementForeignDeletedAttributeDefinitionId));
Assert.That(deserializedExportSettings.RequirementAttributeDefinitions.NameAttributeDefinitionId, Is.EqualTo(requirementNameAttributeDefinitionId));
Assert.That(deserializedExportSettings.RequirementAttributeDefinitions.ForeignModifiedOnAttributeDefinitionId, Is.EqualTo(requirementForeignModifiedOnAttributeDefinitionId));
Assert.That(deserializedExportSettings.SpecificationAttributeDefinitions.NameAttributeDefinitionId, Is.EqualTo(specificationNameAttributeDefinitionId));
Assert.That(deserializedExportSettings.ExternalIdentifierMap, Is.Not.Null);
Assert.That(deserializedExportSettings.ExternalIdentifierMap.Correspondence, Has.Count.EqualTo(1));
Assert.That(deserializedExportSettings.ExternalIdentifierMap.Correspondence.First().ExternalId, Is.EqualTo(externalId));
Assert.That(deserializedExportSettings.ExternalIdentifierMap.Correspondence.First().InternalThing, Is.EqualTo(internalThing));
Assert.Multiple(() => {
Assert.That(deserializedExportSettings.Title, Is.EqualTo(title));
Assert.That(deserializedExportSettings.RequirementAttributeDefinitions.TextAttributeDefinitionId, Is.EqualTo(requirementTextDataTypeDefinitionId));
Assert.That(deserializedExportSettings.RequirementAttributeDefinitions.ForeignDeletedAttributeDefinitionId, Is.EqualTo(requirementForeignDeletedAttributeDefinitionId));
Assert.That(deserializedExportSettings.RequirementAttributeDefinitions.NameAttributeDefinitionId, Is.EqualTo(requirementNameAttributeDefinitionId));
Assert.That(deserializedExportSettings.RequirementAttributeDefinitions.ForeignModifiedOnAttributeDefinitionId, Is.EqualTo(requirementForeignModifiedOnAttributeDefinitionId));
Assert.That(deserializedExportSettings.SpecificationAttributeDefinitions.NameAttributeDefinitionId, Is.EqualTo(specificationNameAttributeDefinitionId));
Assert.That(deserializedExportSettings.ExternalIdentifierMap, Is.Not.Null);
Assert.That(deserializedExportSettings.ExternalIdentifierMap.Correspondence, Has.Count.EqualTo(1));
Assert.That(deserializedExportSettings.ExternalIdentifierMap.Correspondence.First().ExternalId, Is.EqualTo(externalId));
Assert.That(deserializedExportSettings.ExternalIdentifierMap.Correspondence.First().InternalThing, Is.EqualTo(internalThing));
});
}
}
}

0 comments on commit aaab95a

Please sign in to comment.