Пример #1
0
        public void IsCloseTo_ReturnsTrue_GivenSimilarStringsThreshold0_5()
        {
            //Arrange
            string first     = "Some string!";
            string second    = "Tome tring!";
            double threshold = 0.50;

            bool expected = true;

            //Act
            bool actual = EditDistance.IsCloseTo(first, second, threshold);

            //Assert
            Assert.AreEqual(expected, actual);
        }
Пример #2
0
        public void IsCloseTo_ReturnsFalse_GivenNonidenticalStringsThreshold1()
        {
            //Arrange
            string first     = "Some string!";
            string second    = "Some string";
            double threshold = 1.00;

            bool expected = false;

            //Act
            bool actual = EditDistance.IsCloseTo(first, second, threshold);

            //Assert
            Assert.AreEqual(expected, actual);
        }
Пример #3
0
        public void IsCloseTo_ReturnsFalse_GivenInsimilarStringsThreshold0_5()
        {
            //Arrange
            string first     = "Some string!";
            string second    = "Elephant Mongoose!";
            double threshold = 0.50;

            bool expected = false;

            //Act
            bool actual = EditDistance.IsCloseTo(first, second, threshold);

            //Assert
            if (expected != actual)
            {
                int distance = EditDistance.GetEditDistance(first, second);
                throw new Exception($"Edit distance was {distance}");
            }
            Assert.AreEqual(expected, actual);
        }