public void Calling_ConvertTimeService_WithMultipleToIds_And_WithISO_Should_ReturnCorrectConvertedTime()
        {
            // Arrange
            var toId = new List<LocationId> ();
            toId.Add (toUsId);
            toId.Add (toArticId);

            // Act
            var service = new ConvertTimeService (Config.AccessKey, Config.SecretKey);
            var result = service.ConvertTime (fromId, DateTime.Now.ToString ("s", CultureInfo.InvariantCulture), toId);
            var anchorage = result.Locations.FirstOrDefault (x => x.Id == "18");
            var oslo = result.Locations.FirstOrDefault (x => x.Id == "187");
            var troll = result.Locations.FirstOrDefault (x => x.Id == "4365");

            // Assert
            Assert.AreEqual (toUsState, anchorage.Geography.State);
            Assert.AreEqual (toUsCity, anchorage.Geography.Name);

            Assert.AreEqual (toArticCountry, troll.Geography.Country.Name);
            Assert.AreEqual (toArticCity + " Station", troll.Geography.Name);

            Assert.AreEqual (fromCity, oslo.Geography.Name);
            Assert.AreEqual (fromCountry, oslo.Geography.Country.Name);

            HasCorrectLocation (UsTimestamp, anchorage);
            HasCorrectLocation (ArticTimestamp, troll);
            HasCorrectUtc (result.Utc.DateTime);
        }
        public void Calling_ConvertTimeService_WithMultipleToIds_And_WithDateTime_Should_ReturnCorrectConvertedTime()
        {
            // Arrange
            var toId = new List <LocationId> ();

            toId.Add(toUsId);
            toId.Add(toArticId);

            // Act
            var service   = new ConvertTimeService(Config.AccessKey, Config.SecretKey);
            var result    = service.ConvertTime(fromId, DateTime.Now, toId);
            var anchorage = result.Locations.FirstOrDefault(x => x.Id == "18");
            var oslo      = result.Locations.FirstOrDefault(x => x.Id == "187");
            var troll     = result.Locations.FirstOrDefault(x => x.Id == "4365");

            // Assert
            Assert.AreEqual(toUsState, anchorage.Geography.State);
            Assert.AreEqual(toUsCity, anchorage.Geography.Name);

            Assert.AreEqual(troll.Geography.Country.Name, toArticCountry);
            Assert.AreEqual(troll.Geography.Name, toArticCity + " Station");

            Assert.AreEqual(oslo.Geography.Name, fromCity);
            Assert.AreEqual(oslo.Geography.Country.Name, fromCountry);

            HasCorrectUtc(result.Utc.DateTime);
        }
        public void Calling_ConvertTimeService_WithRadius_Should_ReturnCorrectLocation()
        {
            // Arrange
            var toId = new List <LocationId> ();

            toId.Add(toUsId);


            // Act
            var service = new ConvertTimeService(Config.AccessKey, Config.SecretKey);

            service.Radius = 50;
            var result    = service.ConvertTime(fromCoords, DateTime.Now.ToString("s", CultureInfo.InvariantCulture), toId);
            var anchorage = result.Locations.FirstOrDefault(x => x.Id == "18");
            var oslo      = result.Locations.FirstOrDefault(x => x.Id == "187");

            // Assert
            Assert.AreEqual(toUsState, anchorage.Geography.State);
            Assert.AreEqual(toUsCity, anchorage.Geography.Name);

            Assert.AreEqual(fromCity, oslo.Geography.Name);
            Assert.AreEqual(fromCountry, oslo.Geography.Country.Name);

            Assert.IsTrue(result.Locations.All(x => x.Time.Timezone != null));
        }
        public void Calling_ConvertTimeService_WithNoId_And_WithDateTime_Should_ReturnCorrectConvertedTime()
        {
            // Arrange

            // Act
            var service = new ConvertTimeService(Config.AccessKey, Config.SecretKey);
            var result  = service.ConvertTime(fromId, DateTime.Now);
            var oslo    = result.Locations.FirstOrDefault(x => x.Id == "187");

            // Assert
            Assert.AreEqual(fromCity, oslo.Geography.Name);
            Assert.AreEqual(fromCountry, oslo.Geography.Country.Name);

            HasCorrectUtc(result.Utc.DateTime);
        }
        public void Calling_ConvertTimeService_WithOneToId_And_WithISO_Should_ReturnCorrectConvertedTime()
        {
            // Arrange
            var toId = new List <LocationId> ();

            toId.Add(toUsId);

            // Act
            var service   = new ConvertTimeService(Config.AccessKey, Config.SecretKey);
            var result    = service.ConvertTime(fromId, DateTime.Now.ToString("s", CultureInfo.InvariantCulture), toId);
            var anchorage = result.Locations.FirstOrDefault(x => x.Id == "18");
            var oslo      = result.Locations.FirstOrDefault(x => x.Id == "187");

            // Assert
            Assert.AreEqual(toUsState, anchorage.Geography.State);
            Assert.AreEqual(toUsCity, anchorage.Geography.Name);

            Assert.AreEqual(fromCity, oslo.Geography.Name);
            Assert.AreEqual(fromCountry, oslo.Geography.Country.Name);

            HasCorrectUtc(result.Utc.DateTime);
        }
        public void Calling_ConvertTimeService_WithoutTimeChanges_Should_NotReturnTimeChanges()
        {
            // Arrange
            var toId = new List <LocationId> ();

            toId.Add(toUsId);

            // Act
            var service = new ConvertTimeService(Config.AccessKey, Config.SecretKey);

            service.IncludeTimeChanges = false;
            var result    = service.ConvertTime(fromId, DateTime.Now.ToString("s", CultureInfo.InvariantCulture), toId);
            var anchorage = result.Locations.FirstOrDefault(x => x.Id == "18");
            var oslo      = result.Locations.FirstOrDefault(x => x.Id == "187");

            // Assert
            Assert.AreEqual(toUsState, anchorage.Geography.State);
            Assert.AreEqual(toUsCity, anchorage.Geography.Name);

            Assert.AreEqual(fromCity, oslo.Geography.Name);
            Assert.AreEqual(fromCountry, oslo.Geography.Country.Name);

            Assert.IsTrue(result.Locations.All(x => x.TimeChanges.Count == 0));
        }
        public void Calling_ConvertTimeService_WithTimezone_Should_ReturnTZInformation()
        {
            // Arrange
            var toId = new List<LocationId> ();
            toId.Add (toUsId);

            // Act
            var service = new ConvertTimeService (Config.AccessKey, Config.SecretKey);
            service.IncludeTimezoneInformation = true; // Default
            var result = service.ConvertTime (fromId, DateTime.Now.ToString ("s", CultureInfo.InvariantCulture), toId);
            var anchorage = result.Locations.FirstOrDefault (x => x.Id == "18");
            var oslo = result.Locations.FirstOrDefault (x => x.Id == "187");

            // Assert
            Assert.AreEqual (toUsState, anchorage.Geography.State);
            Assert.AreEqual (toUsCity, anchorage.Geography.Name);

            Assert.AreEqual (fromCity, oslo.Geography.Name);
            Assert.AreEqual (fromCountry, oslo.Geography.Country.Name);

            Assert.IsTrue (result.Locations.All (x => x.Time.Timezone != null));
        }
        public void Calling_ConvertTimeService_WithOneToId_And_WithDateTime_Should_ReturnCorrectConvertedTime()
        {
            // Arrange
            var toId = new List<LocationId> ();
            toId.Add (toUsId);

            // Act
            var service = new ConvertTimeService (Config.AccessKey, Config.SecretKey);
            var result = service.ConvertTime (fromId, DateTime.Now, toId);
            var anchorage = result.Locations.FirstOrDefault (x => x.Id == "18");
            var oslo = result.Locations.FirstOrDefault (x => x.Id == "187");

            // Assert
            Assert.AreEqual (toUsState, anchorage.Geography.State);
            Assert.AreEqual (toUsCity, anchorage.Geography.Name);

            Assert.AreEqual (oslo.Geography.Name, fromCity);
            Assert.AreEqual (oslo.Geography.Country.Name, fromCountry);

            HasCorrectUtc (result.Utc.DateTime);
            HasCorrectLocation (UsTimestamp, anchorage);
        }
        public void Calling_ConvertTimeService_WithNoId_And_WithISO_Should_ReturnCorrectConvertedTime()
        {
            // Arrange

            // Act
            var service = new ConvertTimeService (Config.AccessKey, Config.SecretKey);
            var result = service.ConvertTime (fromId, DateTime.Now.ToString ("s", CultureInfo.InvariantCulture));
            var oslo = result.Locations.FirstOrDefault (x => x.Id == "187");

            // Assert
            Assert.AreEqual (fromCity, oslo.Geography.Name);
            Assert.AreEqual (fromCountry, oslo.Geography.Country.Name);

            HasCorrectUtc (result.Utc.DateTime);
        }