示例#1
0
        public void CompareWithYield_NotMatchingStringswithSingleChar_ReturnsNothing()
        {
            //Arrange
            var      expected = new List <int>();
            ICompare comparer = new YieldComparer();
            //Act
            var actual = comparer.Compare("Polly put the kettle on, polly put the kettle on, polly put the kettle on we'll all have tea", "Polx");

            //Assert

            Assert.IsTrue(expected.SequenceEqual(actual));
        }
示例#2
0
        public void CompareWithYield_TwoCharCaseSensitiveStrings_ReturnsMatchingPositions()
        {
            //Arrange
            var expected = new List <int> {
                3, 28, 53, 78, 82
            };
            ICompare comparer = new YieldComparer();
            //Act
            var actual = comparer.Compare("Polly put the kettle on, polly put the kettle on, polly put the kettle on we'll all have tea", "Ll");

            //Assert

            Assert.IsTrue(expected.SequenceEqual(actual));
        }
示例#3
0
        public void CompareWithYield_Strings_ReturnsMatchingPositions()
        {
            //Arrange
            var expected = new List <int> {
                1, 26, 51
            };
            ICompare comparer = new YieldComparer();
            //Act
            var actual = comparer.Compare("Polly put the kettle on, polly put the kettle on, polly put the kettle on we'll all have tea", "polly");

            //Assert

            //CollectionAssert.AreEqual(expected, actual);
            Assert.IsTrue(expected.SequenceEqual(actual));
        }