public void Verify_that_when_a_DefinedThing_contains_non_unique_NaturalLanguageDefinitions_a_result_is_returned() { var english_def_1 = new CDP4Common.CommonData.Definition { Iid = Guid.Parse("e9a80cab-680b-4b2c-98bb-47de59e49e25"), LanguageCode = "en-GB" }; var english_def_2 = new CDP4Common.CommonData.Definition { Iid = Guid.Parse("19f45e4c-7c54-4653-9ccc-13580413768b"), LanguageCode = "en-GB" }; var french_def_1 = new CDP4Common.CommonData.Definition { Iid = Guid.Parse("bb71b34e-cabd-424a-9318-81553338012e"), LanguageCode = "fr" }; this.requirement.Definition.Add(english_def_1); this.requirement.Definition.Add(english_def_2); this.requirement.Definition.Add(french_def_1); var result = this.definedThingRuleChecker.CheckWhetherADefinedThingHasAtMostOneDefinitionPerNaturalLanguage(requirement).Single(); Assert.That(result.Id, Is.EqualTo("MA-0400")); Assert.That(result.Description, Is.EqualTo("The DefinedThing contains Definitions with non-unique language codes: e9a80cab-680b-4b2c-98bb-47de59e49e25,19f45e4c-7c54-4653-9ccc-13580413768b; with LanguageCodes: en-GB,en-GB")); Assert.That(result.Thing, Is.EqualTo(this.requirement)); Assert.That(result.Severity, Is.EqualTo(SeverityKind.Error)); }
public void Verify_that_when_a_DefinedThing_contains_language_unique_NaturalLanguageDefinitions_null_is_returned() { var english_def_1 = new CDP4Common.CommonData.Definition { Iid = Guid.Parse("e9a80cab-680b-4b2c-98bb-47de59e49e25"), LanguageCode = "en-GB" }; var french_def_1 = new CDP4Common.CommonData.Definition { Iid = Guid.Parse("bb71b34e-cabd-424a-9318-81553338012e"), LanguageCode = "fr" }; this.requirement.Definition.Add(english_def_1); this.requirement.Definition.Add(french_def_1); var result = this.definedThingRuleChecker.CheckWhetherADefinedThingHasAtMostOneDefinitionPerNaturalLanguage(requirement); Assert.That(result, Is.Empty); }