public void GetAllDataObjectStartedWithInputTest() { var repository = new TicketMachineRepository(); string text = "Beng"; var expectedResult = new List <DataResult> { new DataResult() { Name = "Benguela", NextCharacter = 'u' }, new DataResult() { Name = "Bengbu", NextCharacter = 'b' }, new DataResult() { Name = "Bengkulu", NextCharacter = 'k' }, new DataResult() { Name = "Bengaluru", NextCharacter = 'a' }, new DataResult() { Name = "Benghazi", NextCharacter = 'h' } }; List <DataResult> result = repository.GetAllDataObjectStartedWithInput(text, _filepath); //CollectionAssert.AreEquivalent(expectedResult, result); Assert.AreEqual(expectedResult.FirstOrDefault().NextCharacter, result.FirstOrDefault().NextCharacter); }
public void GetAllDataStartedWithInputTest() { var repository = new TicketMachineRepository(); var dataList = repository.GetAllData(_filepath); List <string> expectedData = new List <string> { "Benguela", "Bengbu", "Bengkulu", "Bengaluru", "Benghazi" }; List <string> citiesList = repository.GetAllDataStartedWithInput("Beng", dataList); CollectionAssert.AreEqual(expectedData, citiesList); }
public void GetNextCharacterTestSameLength() { var repository = new TicketMachineRepository(); var dataList = repository.GetAllData(_filepath); string text = "Ans"; string searchText = "Ans"; int length = searchText.Length; char expectedResult = (char)0; char result = repository.GetNextCharacter(length, text); Assert.AreEqual(expectedResult, result); }