public void Constructed_area_url_is_correct(
            string area)
        {
            var expectedUrl = $"https://api.electricitymap.org/v3/" +
                              $"{area}";

            var requestUrl = RequestUrlHelpers
                             .ConstructRequest(area);

            expectedUrl
            .ToUri()
            .Should().Be(requestUrl);
        }
        public void Constructed_url_with_updated_since_data_returns_exception_without_zone_or_coor()
        {
            var updatedSinceRequest = new UpdatedSinceRequest
            {
                Since     = DateTime.Now.AddDays(-5),
                Start     = DateTime.Now.AddDays(-2),
                End       = DateTime.Now.AddDays(-1),
                Limit     = 100,
                Threshold = "P1D",
            };

            Assert.Throws <ArgumentNullException>(()
                                                  => RequestUrlHelpers.ConstructRequest(updatedSinceRequest));
        }
        public void Constructed_url_is_correct(
            string area,
            string action,
            string zone)
        {
            var expectedUrl = $"https://api.electricitymap.org/v3/" +
                              $"{area}{action}" +
                              $"?zone={zone}";

            var requestUrl = RequestUrlHelpers
                             .ConstructRequest(area, action, zone);

            expectedUrl
            .ToUri()
            .Should().Be(requestUrl);
        }
        public void Constructed_url_with_latitude_and_longitude_is_correct(
            string area,
            string action,
            double latitude,
            double longitude)
        {
            var expectedUrl = $"https://api.electricitymap.org/v3/" +
                              $"{area}{action}" +
                              $"?lat={latitude}" +
                              $"&lon={longitude}";

            var requestUrl = RequestUrlHelpers
                             .ConstructRequest(area, action, latitude, longitude);

            expectedUrl
            .ToUri()
            .Should().Be(requestUrl);
        }
        public void Constructed_url_with_updated_since_data_is_correct(
            UpdatedSinceRequest updatedSinceRequest)
        {
            if (updatedSinceRequest is null)
            {
                throw new ArgumentNullException(nameof(updatedSinceRequest));
            }

            var expectedUrl = $"https://api.electricitymap.org/v3/updated-since/" +
                              $"?zone={updatedSinceRequest.Zone}" +
                              $"&since={updatedSinceRequest.Since:o}" +
                              $"&start={updatedSinceRequest.Start:o}" +
                              $"&end={updatedSinceRequest.End:o}" +
                              $"&limit={updatedSinceRequest.Limit}" +
                              $"&threshold={updatedSinceRequest.Threshold}";

            var requestUrl = RequestUrlHelpers
                             .ConstructRequest(updatedSinceRequest);

            expectedUrl
            .ToUri()
            .Should().Be(requestUrl);
        }