Beispiel #1
0
        public void CultureDateTime_adjusts_kind_and_time_to_utc_if_tz_specified_and_utc_flag_is_false()
        {
            double offset;
            var    time = DekiScriptLibrary.CultureDateTimeParse("12:00pm -03:00", CultureInfo.InvariantCulture, false, out offset);

            Assert.AreEqual(DateTimeKind.Utc, time.Kind);
            Assert.AreEqual(15, time.Hour);
            Assert.AreEqual(-3d, offset);
        }
Beispiel #2
0
        public void CultureDateTime_with_utc_flagless_signature_adjust_time_to_utc()
        {
            double offset;
            var    time = DekiScriptLibrary.CultureDateTimeParse("12:00pm -03:00", CultureInfo.InvariantCulture, out offset);

            Assert.AreEqual(DateTimeKind.Utc, time.Kind);
            Assert.AreEqual(15, time.Hour);
            Assert.AreEqual(-3d, offset);
        }
Beispiel #3
0
        public void CultureDateTime_does_not_adjust_kind_if_no_tz_specified_and_utc_flag_is_false()
        {
            double offset;
            var    time = DekiScriptLibrary.CultureDateTimeParse("12:00pm", CultureInfo.InvariantCulture, false, out offset);

            Assert.AreEqual(DateTimeKind.Unspecified, time.Kind);
            Assert.AreEqual(12, time.Hour);
            Assert.AreEqual(0, offset);
        }
Beispiel #4
0
        public void CultureDateTime_with_utc_flagless_signature_assumes_utc_if_no_tz_specified()
        {
            double offset;
            var    time = DekiScriptLibrary.CultureDateTimeParse("12:00pm", CultureInfo.InvariantCulture, out offset);

            Assert.AreEqual(DateTimeKind.Utc, time.Kind);
            Assert.AreEqual(12, time.Hour);
            Assert.AreEqual(0d, offset);
        }
Beispiel #5
0
        public ArrayList Issues(
            [DekiExtParam("query expression (default: all issues)", true)] string query,
            [DekiExtParam("number of items to skip (default: 0)", true)] int?offset,
            [DekiExtParam("maximum number of items to return (default: 100)", true)] int?limit,
            [DekiExtParam("get only issues updated after specified date.", true)] string since
            )
        {
            Login();
            var request = _server.At("rest", "project", "issues");

            // check if a query was provided
            if (!string.IsNullOrEmpty(query))
            {
                request = request.With("filter", query);
            }

            // check if a limit and offset were provided
            if (offset.HasValue)
            {
                request = request.With("after", offset.Value);
            }
            request = request.With("max", limit ?? 100);

            // check if a date limit was provide
            if (!string.IsNullOrEmpty(since))
            {
                DreamContext context = DreamContext.CurrentOrNull;
                CultureInfo  culture = (context == null) ? CultureInfo.CurrentCulture : context.Culture;
                double       dummy;
                var          date = DekiScriptLibrary.CultureDateTimeParse(since, culture, out dummy);
                request = request.With("updatedAfter", date.ToEpoch());
            }
            var doc = request.Get().ToDocument();

            var result = new ArrayList();

            foreach (var issue in doc["issue"])
            {
                result.Add(ConvertIssue(issue));
            }
            return(result);
        }