< Summary

Information
Class: IRINormalizatorTests.IriExpansionTests
Assembly: irinormalizatortests.dll
File(s): C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\Tests\IRINormalizatorTests\IriExpansionTests.cs
Line coverage
100%
Covered lines: 16
Uncovered lines: 0
Coverable lines: 16
Total lines: 51
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

File(s)

C:\skola_karlovka\RP\code\csv-validator\CSV_Validator\Tests\IRINormalizatorTests\IriExpansionTests.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using System.Linq;
 4using System.Text;
 5using System.Threading.Tasks;
 6using Newtonsoft.Json.Linq;
 7using ValidateLib.Metadata.Properties;
 8using ValidateLib.ErrorsAndWarnings.Warnings.SpecificWarnings;
 9
 10namespace IRINormalizatorTests
 11{
 12    public  class IriExpansionTests
 13    {
 14        [Theory]
 15        [InlineData("dcat:info", "http://www.w3.org/ns/dcat#info")]
 16        [InlineData("og:info", "http://ogp.me/ns#info")]
 17        [InlineData("rev:info", "http://purl.org/stuff/rev#info")]
 18        [InlineData("owl:info", "http://www.w3.org/2002/07/owl#info")]
 19        [InlineData("v:info", "http://rdf.data-vocabulary.org/#info")]
 20        public void CorrectIriToBeExpanded(string commonPropertyIri,string expetedOutput)
 121        {
 122            CommonProperty property = new CommonProperty(commonPropertyIri, JValue.CreateNull());
 123            var result = property.ExpandIRI();
 124            Assert.Equal(expetedOutput, property.IRI);
 125            Assert.Null(result);
 26
 127        }
 28
 29        [Theory]
 30        [InlineData("xx::xx::x")]
 31        [InlineData("xxxxxxx")]
 32        public void UknownPropertyShouldReturnWarning(string commonPropertyIri)
 133        {
 134            CommonProperty property = new CommonProperty(commonPropertyIri, JValue.CreateNull());
 135            var result = property?.ExpandIRI()?[0];
 136            Assert.Equal(typeof(DoubleDotOrUknownPropertyWarning), result?.GetType());
 37
 138        }
 39
 40        [Theory]
 41        [InlineData("x:x")]
 42        [InlineData("notcorrectprefix:suffix")]
 43        public void IncorrectPrefixShouldReturnError(string commonPropertyIri)
 144        {
 145            CommonProperty property = new CommonProperty(commonPropertyIri, JValue.CreateNull());
 146            var result = property?.ExpandIRI()?[0];
 147            Assert.Equal(typeof(UnkownPrefixWarning), result?.GetType());
 48
 149        }
 50    }
 51}