public void BinarySearchByUncorrectIpAddressTest() { var ipString = "1.1.1.1.1"; var searchService = new SearchService(new ConverterService(), repository); Assert.Throws <IpAddressConvertToUIntException>(() => searchService.BinarySearchByIpAddress(ipString)); }
public void BinarySearchByIpAddressOutsideDbTest() { var ipString = IpAddressHelpers.IpUintToString(7); var searchService = new SearchService(new ConverterService(), repository); var result = searchService.BinarySearchByIpAddress(ipString); Assert.Equal(result.Length, 0); }
public void BinarySearchByCorrectIpAddressTest() { var ipString = IpAddressHelpers.IpUintToString(9); var searchService = new SearchService(new ConverterService(), repository); var result = searchService.BinarySearchByIpAddress(ipString); Assert.Equal(result.Length, 1); Assert.Equal(result[0].CityName, "cit_1"); }