Exemple #1
0
        public void GetComparer_InvariantCultureIgnoreCase()
        {
            //Act
            var actual = CharComparer.GetComparer(StringComparison.InvariantCultureIgnoreCase);

            //Assert
            actual.Should().Be(CharComparer.InvariantCultureIgnoreCase);
        }
Exemple #2
0
        public void GetComparer_OrdinalIgnoreCase()
        {
            //Act
            var actual = CharComparer.GetComparer(StringComparison.OrdinalIgnoreCase);

            //Assert
            actual.Should().Be(CharComparer.OrdinalIgnoreCase);
        }
Exemple #3
0
        public void Compare_CurrentCultureIgnoreCase_FirstLessThanSecond()
        {
            //Act - Cannot actually detect comparer type so use heuristics
            var target = CharComparer.GetComparer(StringComparison.CurrentCultureIgnoreCase);
            var actual = target.Compare(SmallLetterI, SmallDotlessLetterI);

            //Assert
            actual.Should().Be(-1);
        }
Exemple #4
0
        public void Compare_CurrentCultureIgnoreCase_MixedCase()
        {
            //Act - Cannot actually detect comparer type so use heuristics
            var target = CharComparer.GetComparer(StringComparison.CurrentCultureIgnoreCase);
            var actual = target.Compare(CapitalLetterI, SmallLetterI);

            //Assert
            actual.Should().Be(0);
        }
Exemple #5
0
        public void Compare_CurrentCultureIgnoreCase_SameCase()
        {
            //Act
            var target = CharComparer.GetComparer(StringComparison.CurrentCultureIgnoreCase);
            var actual = target.Compare(CapitalLetterI, CapitalLetterI);

            //Assert
            actual.Should().Be(0);
        }
Exemple #6
0
        public void GetComparer_CurrentCultureIgnoreCase()
        {
            //Act - Cannot actually detect comparer type so use heuristics
            var target = CharComparer.GetComparer(StringComparison.CurrentCultureIgnoreCase);
            var actual = target.Compare('A', 'a');

            //Assert
            actual.Should().Be(0);
        }
Exemple #7
0
        public void Compare_OrdinalIgnoreCase_FirstGreaterThanSecond()
        {
            //Act - Cannot actually detect comparer type so use heuristics
            var target = CharComparer.GetComparer(StringComparison.OrdinalIgnoreCase);
            var actual = target.Compare(SmallDotlessLetterI, CapitalLetterI);

            //Assert
            actual.Should().Be(1);
        }
Exemple #8
0
        public void Compare_Ordinal_MixedCase()
        {
            //Act - Cannot actually detect comparer type so use heuristics
            var target = CharComparer.GetComparer(StringComparison.Ordinal);
            var actual = target.Compare(CapitalLetterI, SmallLetterI);

            //Assert
            actual.Should().NotBe(0);
        }
Exemple #9
0
        public void Compare_Ordinal_SameCase()
        {
            //Act
            var target = CharComparer.GetComparer(StringComparison.Ordinal);
            var actual = target.Compare(SmallLetterI, SmallLetterI);

            //Assert
            actual.Should().Be(0);
        }
Exemple #10
0
        public void Compare_InvariantCultureIgnoreCase_SameCase()
        {
            //Act
            var target = CharComparer.GetComparer(StringComparison.InvariantCultureIgnoreCase);
            var actual = target.Compare(SmallDotlessLetterI, SmallDotlessLetterI);

            //Assert
            actual.Should().Be(0);
        }
Exemple #11
0
        public void GetComparer_BadComparison()
        {
            Action action = () => CharComparer.GetComparer((StringComparison)1000);

            action.ShouldThrowArgumentOutOfRangeException();
        }