private bool CompareCityNamesByBytes(byte[] data, CitiesIndex preCityIndex, CitiesIndex curCityIndex, int i) { var isNotSorter = false; for (int j = 0; j < 20; j++) { if (data[preCityIndex.LocationInfoIndex + j] > data[curCityIndex.LocationInfoIndex + j]) { isNotSorter = true; TestContext.WriteLine($"Item Id index = {i - 1} CityName = {preCityIndex.Location.City} "); TestContext.WriteLine($"Item Id index = {i} CityName = {curCityIndex.Location.City} "); break; } } return(isNotSorter); }
public async Task GetLocationByCity_Test() { var clientMoq = new Moq.Mock <IInMemoryGeoDataBase>(); var citiesIndex = new CitiesIndex(DataBase, 0); var citiesIndex2 = new CitiesIndex(DataBase, 1); var cityToSearch = citiesIndex.Location.City; clientMoq.Setup(p => p.Scan <CitiesIndex>(cityToSearch)).Returns(Task.FromResult(new List <CitiesIndex>() { citiesIndex })); var query = new GeoDataBaseQuery(clientMoq.Object); var res = await query.GetLocationsByCity(cityToSearch); CompareLocationToLocationModel(citiesIndex.Location, res[0]); }