public void If_Valid_Request_Returns_Correct_Response6() { var request = new ProximityCalculatorRequest { KeyWords = new List <string>() { "the", "great" }, TextWords = new List <string>() { "hello", "the", "great", "once", "the", "great", "abc", "tttttt", "fffff", "ggggg", "great", "tyson", "tyson", "the", "great", "great", "the", "aaa", "vbgjj", "the", "dasdas", "asdasd", "asdas", "asdasdsa", "as9878978", "asdsad", "the", "kajshdkasd", "dksadaj", "great", "jsdkjsak", "asdhaskj", "ashkdjashd", "the" }, Range = 11 }; Assert.AreEqual(20, new ProximitySearchCalculator().FindNumberofMatches(request)); }
public void If_Keywords_Repeated_Than_Throws_Exception() { var request = new ProximityCalculatorRequest { KeyWords = new List <string>() { "abc", "abc", "xyz" }, TextWords = new List <string>() { "abc", "test", "def", "lmn" }, Range = 4 }; var exception = Assert.ThrowsException <ArgumentException>(() => new ProximitySearchCalculator().FindNumberofMatches(request)); Assert.AreEqual("Keywords cannot be repeated", exception.Message); }
public void If_Range_Less_Than_KeyWord_Length_Throws_Exception() { var request = new ProximityCalculatorRequest { KeyWords = new List <string>() { "abc", "test", "xyz" }, TextWords = new List <string>() { "abc", "test", "def", "lmn" }, Range = 2 }; var exception = Assert.ThrowsException <ArgumentException>(() => new ProximitySearchCalculator().FindNumberofMatches(request)); Assert.AreEqual($"The range must be atleast {request.KeyWords.Count()}", exception.Message); }
public void If_Valid_Request_Returns_Correct_Response2() { var request = new ProximityCalculatorRequest { KeyWords = new List <string>() { "the", "canal" }, TextWords = new List <string>() { "the", "man", "the", "plan", "the", "canal", "panama", }, Range = 6 }; Assert.AreEqual(3, new ProximitySearchCalculator().FindNumberofMatches(request)); }