public void GivenANormalizerWithDefaultOptionsWhenTryedToNormalizeSectionCollectionThenDuplicatedMustFaild() { var normalizer = new IniNormalizer(); var source = SectionsWithDuplicatedCaseInsensitiveNames; var destination = new List <IniSection>(); Assert.False(normalizer.TryNormalizeInto(source, destination)); Assert.Equal(0, destination.Count); }
public void GivenANormalizerWithDefaultOptionsWhenTryedToNormalizeSectionCollectionThenEmptyMustBeRemoved() { var normalizer = new IniNormalizer(); var source = SectionsWithEmptyContent; var destination = new List <IniSection>(); Assert.True(normalizer.TryNormalizeInto(source, destination)); Assert.NotEmpty(destination); Assert.False(destination.Any(e => e.IsEmpty)); }
public void GivenANormalizerMergingSectionsWhenTryedToNormalizeSectionCollectionThenDuplicatedWillPass() { var normalizer = new IniNormalizer(new IniNormalizationOptions { MergeOnDuplicatedSections = true }); var source = SectionsWithDuplicatedCaseInsensitiveNames; var destination = new List <IniSection>(); Assert.True(normalizer.TryNormalizeInto(source, destination)); Assert.Equal(1, destination.Count); }
public void GivenANormalizerIgnoringExceptionsWhenTryedToNormalizeSectionCollectionThenDuplicatedWillPass() { var normalizer = new IniNormalizer(new IniNormalizationOptions { ThrowExceptions = false }); var source = SectionsWithDuplicatedCaseInsensitiveNames; var destination = new List <IniSection>(); Assert.False(normalizer.TryNormalizeInto(source, destination)); Assert.Equal(0, destination.Count); }
public void GivenANormalizerCaseSensitiveWhenTryedToNormalizeSectionCollectionThenCaseSensitiveKeysWillPass() { var normalizer = new IniNormalizer(new IniNormalizationOptions { IsCaseSensitive = true }); var source = SectionsWithDuplicatedCaseInsensitiveNames; var destination = new List <IniSection>(); Assert.True(normalizer.TryNormalizeInto(source, destination)); Assert.Equal(source.Length, destination.Count); }
public void GivenANormalizerIgnoringExceptionsWhenTryedToNormalizePropertyCollectionThenDuplicatedWillPass() { var normalizer = new IniNormalizer(new IniNormalizationOptions { ThrowExceptions = false }); var source = PropertiesWithDuplicatedCaseInsensitiveKeys; var destination = new List <IniProperty>(); Assert.True(normalizer.TryNormalizeInto(source, destination)); Assert.Equal(source.Length / 2, destination.Count); }
public void GivenANormalizerIncludingEmptyPropertiesWhenTryedToNormalizeSectionCollectionThenEmptyMustBeKept() { var normalizer = new IniNormalizer(new IniNormalizationOptions { IncludeEmptySections = true }); var source = SectionsWithEmptyContent; var destination = new List <IniSection>(); Assert.True(normalizer.TryNormalizeInto(source, destination)); Assert.Equal(source.Length, destination.Count); Assert.True(destination.Any(e => e.IsEmpty)); }