public GeoData(EnterpriseResponse res)
 {
     this.Country     = res.Country;
     this.Subdivision = res.MostSpecificSubdivision;
     this.City        = res.City;
     this.Postal      = res.Postal;
     this.Location    = res.Location;
 }
Example #2
0
        public async Task GetByIdAsyncWhenNoEnterpriseFoundReturnsEnterpriseNotFoundResponse()
        {
            // Arrange
            var mockEnterpriseRepository = GetDefaultIEnterpriseRepositoryInstance();
            var mockUnitOfWork           = GetDefaultIUnitOfWorkInstance();
            var enterpriseId             = 1;

            mockEnterpriseRepository.Setup(r => r.FindById(enterpriseId))
            .Returns(Task.FromResult <Enterprise>(null));

            var service = new EnterpriseService(mockEnterpriseRepository.Object, mockUnitOfWork.Object);

            // Act
            EnterpriseResponse result = await service.GetByIdAsync(enterpriseId);

            var message = result.Message;

            // Assert
            message.Should().Be("Enterprise not found");
        }
 /// <summary>
 ///     Tries to lookup a <see cref="EnterpriseResponse" /> for the specified IP address.
 /// </summary>
 /// <param name="ipAddress">The IP address.</param>
 /// <param name="response">The <see cref="EnterpriseResponse" />.</param>
 /// <returns>A <see cref="bool" /> describing whether the IP address was found.</returns>
 public bool TryEnterprise(string ipAddress, out EnterpriseResponse response)
 {
     response = Execute <EnterpriseResponse>(ipAddress, "Enterprise", false);
     return(response != null);
 }