public void GivenANormalizerWithDefaultOptionsWhenNormalizedSectionCollectionThenEmptyMustBeRemoved() { var normalizer = new IniNormalizer(); var source = SectionsWithEmptyContent; var destination = new List <IniSection>(); normalizer.NormalizeInto(source, destination); Assert.NotEmpty(destination); Assert.False(destination.Any(e => e.IsEmpty)); }
public void GivenANormalizerMergingSectionsWhenNormalizedSectionCollectionThenDuplicatedWillPass() { var normalizer = new IniNormalizer(new IniNormalizationOptions { MergeOnDuplicatedSections = true }); var source = SectionsWithDuplicatedCaseInsensitiveNames; var destination = new List <IniSection>(); normalizer.NormalizeInto(source, destination); Assert.Equal(1, destination.Count); }
public void GivenANormalizerCaseSensitiveWhenNormalizedSectionCollectionThenCaseSensitiveKeysWillPass() { var normalizer = new IniNormalizer(new IniNormalizationOptions { IsCaseSensitive = true }); var source = SectionsWithDuplicatedCaseInsensitiveNames; var destination = new List <IniSection>(); normalizer.NormalizeInto(source, destination); Assert.Equal(source.Length, destination.Count); }
public void GivenANormalizerWithDefaultOptionsWhenNormalizedSectionCollectionThenDuplicatedMustFaild() { var normalizer = new IniNormalizer(); var source = SectionsWithDuplicatedCaseInsensitiveNames; var destination = new List <IniSection>(); var ex = Assert.Throws <DuplicatedSection>(() => { normalizer.NormalizeInto(source, destination); }); Assert.NotNull(ex.SectionName); }
public void GivenANormalizerIgnoringExceptionsWhenNormalizedPropertyCollectionThenDuplicatedWillPass() { var normalizer = new IniNormalizer(new IniNormalizationOptions { ThrowExceptions = false }); var source = PropertiesWithDuplicatedCaseInsensitiveKeys; var destination = new List <IniProperty>(); normalizer.NormalizeInto(source, destination); Assert.Equal(source.Length / 2, destination.Count); }
public void GivenANormalizerIncludingEmptyPropertiesWhenNormalizedSectionCollectionThenEmptyMustBeKept() { var normalizer = new IniNormalizer(new IniNormalizationOptions { IncludeEmptySections = true }); var source = SectionsWithEmptyContent; var destination = new List <IniSection>(); normalizer.NormalizeInto(source, destination); Assert.Equal(source.Length, destination.Count); Assert.True(destination.Any(e => e.IsEmpty)); }