示例#1
0
    public void GetCurrent_HasNoGeoIpDAta_ReturnNull(ITracker tracker, CurrentInteraction interaction )
    {
      //Arrange
      interaction.HasGeoIpData.Returns(false);
      tracker.Interaction.Returns(interaction);
      var locationRepository = new LocationRepository();

      using (new TrackerSwitcher(tracker))
      {
        //Act
        var location = locationRepository.GetCurrent();
        //Assert      
        location.Should().BeNull();
      }
    }
示例#2
0
    public void GetCurrent_NullLongitude_ReturnNull(double? latitude, ITracker tracker, CurrentInteraction interaction, WhoIsInformation whoIsInformation)
    {
      //Arrange
      whoIsInformation.Latitude = latitude;
      whoIsInformation.Longitude = null;
      interaction.HasGeoIpData.Returns(true);
      interaction.GeoData.Returns(new ContactLocation(() => whoIsInformation));
      tracker.Interaction.Returns(interaction);

      var locationRepository = new LocationRepository();

      using (new TrackerSwitcher(tracker))
      {
        //Act
        var location = locationRepository.GetCurrent();
        //Assert      
        location.Should().BeNull();
      }
    }
示例#3
0
    public void GetCurrent_Call_ReturnCityAndCountry(string city, string country, ITracker tracker, CurrentInteraction interaction, WhoIsInformation whoIsInformation)
    {
      //Arrange
      whoIsInformation.City = city;
      whoIsInformation.Country = country;
      interaction.HasGeoIpData.Returns(true);
      interaction.GeoData.Returns(new ContactLocation(() => whoIsInformation));
      tracker.Interaction.Returns(interaction);

      var locationRepository = new LocationRepository();

      using (new TrackerSwitcher(tracker))
      {
        //Act
        var location = locationRepository.GetCurrent();
        //Assert      
        location.Should().NotBeNull();
        location.City.Should().Be(city);
        location.Country.Should().Be(country);
      }
    }