コード例 #1
0
        public void DicesCoefficientNoMatch()
        {
            //  Arrange
            var str1 = "Achany Estate";
            var str2 = "Aikengall";

            var algorithm = new DiceCoefficient();

            //  Act
            var result = Math.Round(algorithm.Match(str1, str2), 3);

            //  Assert
            Assert.AreEqual(0.000, result, "Expected an No match 0.000 (0%)");
        }
コード例 #2
0
        public void DicesCoefficientSimilarityMatch()
        {
            //  Arrange
            var str1 = "Hadyard Hill";
            var str2 = "Hadyard Hill, Barr";

            var algorithm = new DiceCoefficient();

            //  Act
            var result = Math.Round(algorithm.Match(str1, str2),3);

            //  Assert
            Assert.AreEqual(0.818, result, "Expected an similarity match of 0.8 (81.8%)");
        }
コード例 #3
0
        public void DicesCoefficientforExactMatch()
        {
            //  Arrange
            var str1 = "Cathkin Braes";
            var str2 = "Cathkin Braes";

            var algorithm = new DiceCoefficient();

            //  Act
            var result = Math.Round(algorithm.Match(str1, str2), 3);

            //  Assert
            Assert.AreEqual(1,result, "Expected an exact match, should return 1");
        }