public async Task ShouldHideStreetBecauseOfStreetType() { var street = new AutoQuest.Street { Name = "Глушкова", Type = "проспект", Lat = GeoPointTests.VDNHLocation.Lat, Long = GeoPointTests.VDNHLocation.Long }; var streetVm = new StreetViewModel(street); var mock = new TestFilter { CurrentLocation = GeoPointTests.HouseLocation, PossibleTypes = new[] { "улица" } }; streetVm.UpdateStates(mock); var isVisibleWithoutCorrectType = streetVm.IsVisible; mock.PossibleTypes = new[] { "улица", "проспект" }; streetVm.UpdateStates(mock); Assert.IsFalse(isVisibleWithoutCorrectType, "streetVm.IsVisible"); Assert.IsTrue(streetVm.IsVisible, "streetVm.IsVisible"); }
public async Task ShouldDistanceBeRepresentedInMeters() { var street = new AutoQuest.Street { Name = "Глушкова", Lat = GeoPointTests.VDNHLocation.Lat, Long = GeoPointTests.VDNHLocation.Long }; var streetVm = new StreetViewModel(street); var mock = new TestFilter { CurrentLocation = GeoPointTests.HouseLocation }; streetVm.UpdateStates(mock); Assert.IsTrue(streetVm.IsVisible, "streetVm.IsVisible"); Assert.AreEqual($"{GeoPointTests.DistanceByYandex} м.", streetVm.DistanceRepr); }
public async Task ShouldStreetBeInvisibleBecauseOfMaxDistance() { var street = new AutoQuest.Street { Name = "Глушкова", Lat = GeoPointTests.VDNHLocation.Lat, Long = GeoPointTests.VDNHLocation.Long }; var streetVm = new StreetViewModel(street); var mock = new TestFilter { CurrentLocation = GeoPointTests.HouseLocation, MaxDistance = 0.8 }; streetVm.UpdateStates(mock); Assert.IsFalse(streetVm.IsVisible, "streetVm.IsVisible"); }
public async Task ShouldNotFindStreetMatchInTheMiddle() { var street = new AutoQuest.Street { Name = "Глушкова", Type = "проспект", Lat = GeoPointTests.VDNHLocation.Lat, Long = GeoPointTests.VDNHLocation.Long }; var streetVm = new StreetViewModel(street); var mock = new TestFilter { CurrentLocation = GeoPointTests.HouseLocation, PossibleTypes = new List <string>() { "проспект" }, SearchQuery = new Regex("ш..о", RegexOptions.IgnoreCase) }; streetVm.UpdateStates(mock); Assert.IsFalse(streetVm.IsVisible, "streetVm.IsVisible"); }