ToString() публичный Метод

public ToString ( ) : string
Результат string
Пример #1
0
        public void TestToString()
        {
            var x = new DateRange(new DateTime(1800, 11, 12), new DateTime(1900, 11, 12, 23, 18, 17));

            Console.WriteLine(x.ToString());

            Aver.AreEqual("[11/12/1800 12:00 AM - 11/12/1900 11:18 PM]", x.ToString("MM/dd/yyyy hh:mm tt", System.Globalization.CultureInfo.InvariantCulture));
        }
Пример #2
0
        public void ToStringTest()
        {
            var fromDate = new DateTime(2017, 2, 1);
            var toDate   = new DateTime(2017, 2, 10);
            var range    = new DateRange(fromDate, toDate);

            // Case1
            Assert.AreEqual(@"2017/02/01 0:00:00~2017/02/10 0:00:00", range.ToString());
            // Case2
            range.DisplayFormat = @"{0:yyyy/MM/dd} to {1:yyyy/MM/dd}";
            Assert.AreEqual(@"2017/02/01 to 2017/02/10", range.ToString());
        }
Пример #3
0
        public void FromStringWithDurationSucceeds()
        {
            var start = new DateTimeOffset(2014, 5, 6, 0, 0, 0, 0, TimeSpan.FromHours(1));

            var years   = 2;
            var months  = 3;
            var days    = 17;
            var hours   = 0;
            var minutes = 0;
            var seconds = 0;

            var end = start.AddYears(years).AddMonths(months).AddDays(days).AddHours(hours).AddMinutes(minutes).AddSeconds(seconds);
            var iso8601DatePeriodUtc = string.Concat(start.ToUniversalTime().ToString("yyyy-MM-ddzzz"), "/", end.ToUniversalTime().ToString("yyyy-MM-ddzzz"));;

            var iso8601DatePeriod = string.Concat(start.ToString("yyyy-MM-ddTHH:mm:sszzz"), "/", string.Format("P{0}Y{1}M{2}DT{3}H{4}M{5}S", years, months, days, hours, minutes, seconds));

            var sut = new DateRange(iso8601DatePeriod);

            Assert.IsNotNull(sut);

            Assert.AreEqual(start, sut.Start);
            Assert.AreEqual(end, sut.End);
            Assert.AreEqual(end - start, sut.TimeSpan);

            var result = sut.ToString();

            Assert.AreEqual(iso8601DatePeriodUtc, result);
        }
Пример #4
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            DateRange dateRange = (DateRange)value;

            if (dateRange == null)
            {
                return("");
            }
            return(dateRange.ToString());
        }
Пример #5
0
        public void ToString_HasCorrectFormat()
        {
            TimeSpan length = RandomDuration(2, MaxDays);
            DateTime start  = RandomDate(DateTime.MinValue, DateTime.MaxValue - length);
            DateTime end    = start + length;
            int      step   = Random.Next(1, length.Days / 2);

            DateRange dateRange = new DateRange(start, end, step);

            Assert.AreEqual($"{start:d} - {end:d} [{length.TotalDays + 1} days]", dateRange.ToString());
        }
Пример #6
0
        public void ToString_IsNotBlank()
        {
            TimeSpan length = RandomDuration(1, MaxDays);
            DateTime start  = RandomDate(DateTime.MinValue, DateTime.MaxValue - length);
            DateTime end    = start + length;
            int      step   = Random.Next(1, length.Days / 2);

            DateRange dateRange = new DateRange(start, end, step);

            Assert.AreNotEqual("", dateRange.ToString(), "String representation of range must not be an empty string");
        }
Пример #7
0
        public void ToString_IsValid()
        {
            var start    = new DateTime(2011, 10, 26, 1, 2, 3);
            var end      = new DateTime(2011, 10, 26, 10, 11, 12);
            var expected = String.Format("{0} - {1}", start.ToShortDateString(), end.ToShortDateString());

            //Act
            var target = new DateRange(start, end);
            var actual = target.ToString();

            //Assert
            actual.Should().Be(expected);
        }
    static void Main(string[] args)
    {
        int      interval      = 10;
        DateTime isInRangeDate = DateTime.UtcNow;

        for (int i = 1930; i < 2020;)
        {
            DateRange range = new DateRange(1, 1, i, interval);
            Console.WriteLine(string.Format("{0}: Is in range - {1}", range.ToString(), range.IsInsidePeriod(isInRangeDate)));
            i = range.EndDate.Year;
        }
        Console.ReadLine();
    }
Пример #9
0
        public void ToString_DoesNotDependOnTimeComponents()
        {
            TimeSpan length = RandomDuration(1, MaxDays);
            DateTime start  = RandomDate(DateTime.MinValue, DateTime.MaxValue - length);
            DateTime end    = start + length;
            int      step   = Random.Next(1, length.Days / 2);

            DateRange dateRange         = new DateRange(start, end, step);
            DateRange dateRangeWithTime = new DateRange(start + RandomTimeOffset(), end + RandomTimeOffset(), step);

            Assert.AreEqual(
                dateRange.ToString(),
                dateRangeWithTime.ToString(),
                "String representation of range must not depend on the (ignored) time components");
        }
Пример #10
0
        public void ToStringCorrect()
        {
            // For the test ensure that the date format is in Australian format
            var savedCulture = Thread.CurrentThread.CurrentCulture;
            var testCulture  = new CultureInfo("en-AU");

            testCulture.DateTimeFormat.ShortDatePattern = "d/MM/yyyy";
            Thread.CurrentThread.CurrentCulture         = testCulture;

            var dateRange = new DateRange(new Date(2000, 01, 01), new Date(2000, 01, 31));
            var result    = dateRange.ToString();

            result.Should().Be("1/01/2000 - 31/01/2000");

            Thread.CurrentThread.CurrentCulture = savedCulture;
        }
Пример #11
0
        public override Tickets Tickets(DateRange dateRange)
        {
            Config config = Config.FromFile("Jira.json");

            using (var client = new WebClient {
                Credentials = config.Credential()
            })
            {
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                string credentials = config.CredentialBase64();
                client.Headers[HttpRequestHeader.Authorization] = $"Basic {credentials}";
                string feedUrl = config.FeedUrl(dateRange);
#if DEBUG
                Console.WriteLine(dateRange.ToString());
                Console.WriteLine(feedUrl);
                Console.WriteLine(config.ToString());
#endif
                string response = client.DownloadString(feedUrl);
#if DEBUG
                Console.WriteLine(response);
#endif
                XDocument  xDocument = XDocument.Parse(response);
                XElement   feed      = ClearNamespaces(xDocument.Root);
                XElement[] entries   = feed.Descendants("entry").ToArray();
                IEnumerable <Tuple <DateTime, string> > tickets = from entry in entries
                                                                  let updated = DateTime.Parse(entry.Element("updated")?.Value)
                                                                                let target                         = entry.Element("target") ?? entry.Element("object")
                                                                                                         let title = target?.Element("title")
                                                                                                                     let summary                       = target?.Element("summary")
                                                                                                                                              let type = target?.Element("object-type")
                                                                                                                                                         where type != null && type.Value.Contains("issue")
                                                                                                                                                         select new Tuple <DateTime, string>(updated, title?.Value + " " + summary?.Value);
                IDictionary <DateTime, string> result = tickets.GroupBy(t => t.Item1.Date, t => t.Item2)
                                                        .OrderByDescending(t => t.Key)
                                                        .Where(t => dateRange.Contains(t.Key))
                                                        .ToDictionary(g => g.Key, g => string.Join(Environment.NewLine, g.Distinct().ToArray()));
                var fr = new Tickets();
                foreach (KeyValuePair <DateTime, string> record in result)
                {
                    fr.Add(record.Key, record.Value);
                }
                return(fr);
            }
        }
Пример #12
0
        public void DateRange_Test()
        {
            var minDate = DateTime.Parse("2019-01-01");
            var maxDate = DateTime.Parse("2019-12-31");
            var inDate  = DateTime.Parse("2019-05-30");
            var outDate = DateTime.Parse("2018-03-05");

            DateRange range = new DateRange(minDate, maxDate);

            Assert.Equal(minDate, range.MinValue);
            Assert.Equal(maxDate, range.MaxValue);
            Assert.True(range.Contains(inDate));
            Assert.False(range.Contains(outDate));
            Assert.Equal("2019-01-01 00:00:00-2019-12-31 00:00:00", range.ToString("yyyy-MM-dd HH:mm:ss"));

            var range2 = new DateRange();

            Assert.Equal("", range2.ToString());
        }
 internal static object ListResponseBody <T>(
     this ControllerBase controller,
     PaginatedList <T> paginatedList, DateRange dateRange)
 {
     return(new
     {
         Data = paginatedList,
         Meta = new
         {
             paginatedList.Page,
             paginatedList.PerPage,
             paginatedList.Total,
             paginatedList.TotalPages,
             paginatedList.HasNext,
             paginatedList.HasPrevious,
             DateRange = dateRange.ToString()
         }
     });
 }
Пример #14
0
        public void FromStringSucceeds()
        {
            var start = new DateTimeOffset(2014, 5, 6, 0, 0, 0, 0, TimeSpan.FromHours(1));
            var end   = new DateTimeOffset(2015, 5, 6, 0, 0, 0, 0, TimeSpan.FromHours(1));

            var iso8601DatePeriod    = string.Concat(start.ToString("yyyy-MM-ddTHH:mm:sszzz"), "/", end.ToString("yyyy-MM-ddTHH:mm:sszzz"));
            var iso8601DatePeriodUtc = string.Concat(start.ToUniversalTime().ToString("yyyy-MM-ddzzz"), "/", end.ToUniversalTime().ToString("yyyy-MM-ddzzz"));;

            var sut = new DateRange(iso8601DatePeriod);

            Assert.IsNotNull(sut);

            Assert.AreEqual(start, sut.Start);
            Assert.AreEqual(end, sut.End);
            Assert.AreEqual(end - start, sut.TimeSpan);

            var result = sut.ToString();

            Assert.AreEqual(iso8601DatePeriodUtc, result);
        }
Пример #15
0
        public void ToString_For_Range_That_Is_Not_Bounded_At_The_End_Returns_Greater_Than_Start()
        {
            var sut = new DateRange(new DateTime(2018, 1, 1), null);

            sut.ToString(null, CultureInfo.InvariantCulture).Should().Be("≥ 01/01/2018");
        }
Пример #16
0
        public void ToString_For_Range_That_Is_Not_Bounded_At_The_Start_Returns_Less_Than_End()
        {
            var sut = new DateRange(null, new DateTime(2018, 12, 31));

            sut.ToString(null, CultureInfo.InvariantCulture).Should().Be("≤ 12/31/2018");
        }
Пример #17
0
        public void ToString_For_Unbound_Range_Returns_Always()
        {
            var sut = new DateRange(null, null);

            sut.ToString(null, CultureInfo.InvariantCulture).Should().Be("Always");
        }
Пример #18
0
        public void ToString_IsNotBlank()
        {
            TimeSpan length = RandomDuration(1, MaxDays);
            DateTime start = RandomDate(DateTime.MinValue, DateTime.MaxValue - length);
            DateTime end = start + length;
            int step = Random.Next(1, length.Days / 2);

            DateRange dateRange = new DateRange(start, end, step);

            Assert.AreNotEqual("", dateRange.ToString(), "String representation of range must not be an empty string");
        }
Пример #19
0
        public void ToString_DoesNotDependOnTimeComponents()
        {
            TimeSpan length = RandomDuration(1, MaxDays);
            DateTime start = RandomDate(DateTime.MinValue, DateTime.MaxValue - length);
            DateTime end = start + length;
            int step = Random.Next(1, length.Days / 2);

            DateRange dateRange = new DateRange(start, end, step);
            DateRange dateRangeWithTime = new DateRange(start + RandomTimeOffset(), end + RandomTimeOffset(), step);

            Assert.AreEqual(
                dateRange.ToString(),
                dateRangeWithTime.ToString(),
                "String representation of range must not depend on the (ignored) time components");
        }
Пример #20
0
        public void Execute(IJobExecutionContext context)
        {
            JobDataMap      dataMap         = context.JobDetail.JobDataMap;
            var             rockContext     = new RockContext();
            var             jobService      = new ServiceJobService(rockContext);
            GroupService    groupService    = new GroupService(rockContext);
            CategoryService categoryService = new CategoryService(rockContext);
            MetricService   metricService   = new MetricService(rockContext);

            var       metricCategories = MetricCategoriesFieldAttribute.GetValueAsGuidPairs(dataMap.GetString("Metrics"));
            DateRange dateRange        = SlidingDateRangePicker.CalculateDateRangeFromDelimitedValues(dataMap.GetString("DateRange"));

            var systemEmail = dataMap.GetString("Email").AsGuidOrNull();

            if (!systemEmail.HasValue)
            {
                throw new Exception("System Email is required!");
            }

            // get job type id
            int jobId = Convert.ToInt16(context.JobDetail.Description);
            var job   = jobService.Get(jobId);

            DateTime _midnightToday  = RockDateTime.Today.AddDays(1);
            var      currentDateTime = RockDateTime.Now;
            int      recipients      = 0;

            Group notificationGroup         = groupService.Get(dataMap.GetString("NotificationGroup").AsGuid());
            List <MetricCount> metricCounts = CampusCache.All().Select(c => new MetricCount()
            {
                Campus = c, TotalEntered = 0, TotalMetrics = 0
            }).ToList();
            List <Metric> metrics = new List <Metric>();


            // If we have some reasonable data, go ahead and run the job
            if (notificationGroup != null && metricCategories.Count > 0 && dateRange.Start.HasValue && dateRange.End.HasValue)
            {
                foreach (MetricCategoryPair metricCategoryPair in metricCategories)
                {
                    Metric metric = metricService.Get(metricCategoryPair.MetricGuid);
                    metrics.Add(metric);
                    // Split this by campus partition
                    if (metric.MetricPartitions.Any(mp => mp.EntityType.Name.Contains("Campus")))
                    {
                        foreach (CampusCache campus in CampusCache.All())
                        {
                            // Check to see if we also have a schedule partition
                            if (metric.MetricPartitions.Any(mp => mp.EntityType.Name.Contains("Schedule")))
                            {
                                var services = GetServices(campus, dataMap, dateRange);
                                metricCounts.Where(mc => mc.Campus == campus).FirstOrDefault().TotalMetrics += services.Count;
                                foreach (var service in services)
                                {
                                    var hasValues = metric.MetricValues.Where(mv =>
                                                                              mv.MetricValuePartitions.Any(mvp => mvp.MetricPartition.EntityType.Name.Contains("Campus") && mvp.EntityId == campus.Id) &&
                                                                              mv.MetricValuePartitions.Any(mvp => mvp.MetricPartition.EntityType.Name.Contains("Schedule") && mvp.EntityId == service.Id) &&
                                                                              mv.MetricValueDateTime >= dateRange.Start.Value &&
                                                                              mv.MetricValueDateTime <= dateRange.End.Value).Any();
                                    if (hasValues)
                                    {
                                        metricCounts.Where(mc => mc.Campus == campus).FirstOrDefault().TotalEntered++;
                                    }
                                }
                            }
                            else
                            {
                                // Add totals for metrics and, if values are entered, metrics entered.
                                metricCounts.Where(mc => mc.Campus == campus).FirstOrDefault().TotalMetrics++;
                                var hasValues = metric.MetricValues.Where(mv => mv.MetricValuePartitions.Any(mvp => mvp.MetricPartition.EntityType.Name.Contains("Campus") && mvp.EntityId == campus.Id) && mv.MetricValueDateTime >= dateRange.Start.Value && mv.MetricValueDateTime <= dateRange.End.Value).Any();
                                if (hasValues)
                                {
                                    metricCounts.Where(mc => mc.Campus == campus).FirstOrDefault().TotalEntered++;
                                }
                            }
                        }
                    }
                }

                // Create the merge fields
                var mergeFields = Rock.Lava.LavaHelper.GetCommonMergeFields(null);
                mergeFields.Add("MetricCounts", metricCounts);
                mergeFields.Add("Metrics", metrics);
                mergeFields.Add("DateRange", dateRange.ToString());
                mergeFields.Add("LastRunDate", job.LastSuccessfulRunDateTime);

                // Setup the email and send it out!
                RockEmailMessage message = new RockEmailMessage(systemEmail.Value);
                message.AdditionalMergeFields = mergeFields;
                foreach (GroupMember member in notificationGroup.Members)
                {
                    message.AddRecipient(RockEmailMessageRecipient.CreateAnonymous(member.Person.Email, mergeFields));
                    recipients++;
                }
                message.SendSeperatelyToEachRecipient = true;
                message.Send();
            }

            context.Result = string.Format("Sent " + recipients + " metric entry digest emails.");
        }
            public async Task <Result> Handle(Query request, CancellationToken cancellationToken)
            {
                var budgetCategoryIdsQuery = _accessControlService.GetAccessibleBudgetCategoryIds(request.BudgetId, request.BudgetCategoryType);

                if (request.BudgetCategoryIds != null && request.BudgetCategoryIds.Any())
                {
                    budgetCategoryIdsQuery = budgetCategoryIdsQuery.Where(x => request.BudgetCategoryIds.Any(s => s == x));
                }

                var budgetCurrency = _readDb.Budgets.First(x => x.BudgetId == request.BudgetId).Currency;

                var budgetCategoryIds = budgetCategoryIdsQuery.ToList();
                var budgetCategories  = _readDb.BudgetCategories.Where(x => budgetCategoryIds.Contains(x.BudgetCategoryId)).ToList();

                var query = _readDb.Transactions.Where(x => budgetCategoryIds.Contains(x.BudgetCategoryId));

                query = query.Where(x => x.TransactionDate >= request.TransactionDateStart.Date && x.TransactionDate <= request.TransactionDateEnd.Date);


                var transactions = await query.ToListAsync(cancellationToken);

                if (!transactions.Any())
                {
                    return(new Result());
                }

                var timelinePeriod = new DateRange(request.TransactionDateStart, request.TransactionDateEnd);

                var periods = request.GroupingStep switch
                {
                    eGroupingStep.Day => timelinePeriod.Start.EachDayTo(timelinePeriod.End),
                    eGroupingStep.Year => timelinePeriod.Start.EachYearTo(timelinePeriod.End),
                    eGroupingStep.Month => timelinePeriod.Start.EachMonthTo(timelinePeriod.End),
                    eGroupingStep.Quarter => timelinePeriod.Start.EachQuarterTo(timelinePeriod.End),
                    eGroupingStep.Week => timelinePeriod.Start.EachWeekTo(timelinePeriod.End, CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek),
                    _ => throw new ArgumentOutOfRangeException()
                };

                var dateRanges = transactions.GroupBy(x => periods.FirstOrDefault(s => s.Contains(x.TransactionDate)))
                                 .Select(periodGroup =>
                {
                    var period = periodGroup.Key;

                    var categoryDataPoints = budgetCategories.Select(category =>
                    {
                        var categoryId     = category.BudgetCategoryId;
                        var categoryAmount = periodGroup.Where(s => s.BudgetCategoryId == categoryId)
                                             .Select(s => s.Amount + s.SubTransactions.Select(t => t.Amount).Aggregate(new MoneyAmount(budgetCurrency.CurrencyCode, 0), (a, b) => a + b))
                                             .Aggregate(new MoneyAmount(budgetCurrency.CurrencyCode, 0), (a, b) => a + b);

                        return(new BudgetCategoryDataPointDto()
                        {
                            DateRange = period,
                            BudgetCategoryId = categoryId,
                            Key = period.ToString(),
                            AmountTotal = categoryAmount
                        });
                    })
                                             .ToList();

                    var totalAmount = categoryDataPoints.Select(x => x.AmountTotal)
                                      .Aggregate(new MoneyAmount(budgetCurrency.CurrencyCode, 0), (a, b) => a + b);

                    return(new DateRangeData()
                    {
                        DateRange = period,
                        Key = period.ToString(),
                        BudgetCategories = categoryDataPoints,
                        Total = new DataPointDto()
                        {
                            DateRange = period,
                            Key = period.ToString(),
                            AmountTotal = totalAmount
                        }
                    });
                })
                                 .OrderByDescending(x => x.DateRange.Start)
                                 .ToList();

                if (dateRanges.Count > 1)
                {
                    for (var i = 0; i < dateRanges.Count - 1; i++)
                    {
                        var current  = dateRanges[i];
                        var previous = dateRanges[i + 1];

                        foreach (var budgetCategoryDataPoint in current.BudgetCategories)
                        {
                            var previousBudgetCategoryDataPoint = previous.BudgetCategories.FirstOrDefault(x => x.BudgetCategoryId == budgetCategoryDataPoint.BudgetCategoryId);
                            if (previousBudgetCategoryDataPoint == null)
                            {
                                continue;
                                ;
                            }

                            budgetCategoryDataPoint.AmountTotalChange = previousBudgetCategoryDataPoint.AmountTotal.Amount > 0
                                                                            ? (budgetCategoryDataPoint.AmountTotal.Amount - previousBudgetCategoryDataPoint.AmountTotal.Amount) / previousBudgetCategoryDataPoint.AmountTotal.Amount
                                                                            : (decimal?)null;

                            budgetCategoryDataPoint.AmountPerDayChange = previousBudgetCategoryDataPoint.AmountPerDay.Amount > 0
                                                                             ? (budgetCategoryDataPoint.AmountPerDay.Amount - previousBudgetCategoryDataPoint.AmountPerDay.Amount) / previousBudgetCategoryDataPoint.AmountPerDay.Amount
                                                                             : (decimal?)null;

                            budgetCategoryDataPoint.AmountPerWeekChange = previousBudgetCategoryDataPoint.AmountPerWeek.Amount > 0
                                                                              ? (budgetCategoryDataPoint.AmountPerWeek.Amount - previousBudgetCategoryDataPoint.AmountPerWeek.Amount) / previousBudgetCategoryDataPoint.AmountPerWeek.Amount
                                                                              : (decimal?)null;

                            budgetCategoryDataPoint.AmountPerMonthChange = previousBudgetCategoryDataPoint.AmountPerMonth.Amount > 0
                                                                               ? (budgetCategoryDataPoint.AmountPerMonth.Amount - previousBudgetCategoryDataPoint.AmountPerMonth.Amount) / previousBudgetCategoryDataPoint.AmountPerMonth.Amount
                                                                               : (decimal?)null;
                        }

                        current.Total.AmountTotalChange = previous.Total.AmountTotal.Amount > 0
                                                              ? (current.Total.AmountTotal.Amount - previous.Total.AmountTotal.Amount) / previous.Total.AmountTotal.Amount
                                                              : (decimal?)null;
                        current.Total.AmountPerDayChange = previous.Total.AmountTotal.Amount > 0
                                                               ? (current.Total.AmountPerDay.Amount - previous.Total.AmountPerDay.Amount) / previous.Total.AmountPerDay.Amount
                                                               : (decimal?)null;
                        current.Total.AmountPerWeekChange = previous.Total.AmountTotal.Amount > 0
                                                                ? (current.Total.AmountPerWeek.Amount - previous.Total.AmountPerWeek.Amount) / previous.Total.AmountPerWeek.Amount
                                                                : (decimal?)null;
                        current.Total.AmountPerMonthChange = previous.Total.AmountTotal.Amount > 0
                                                                 ? (current.Total.AmountPerMonth.Amount - previous.Total.AmountPerMonth.Amount) / previous.Total.AmountPerMonth.Amount
                                                                 : (decimal?)null;
                    }
                }

                var budgetCategoryTotals = dateRanges.SelectMany(x => x.BudgetCategories)
                                           .GroupBy(x => x.BudgetCategoryId)
                                           .Select(x => new BudgetCategoryDataPointDto()
                {
                    Key              = timelinePeriod.ToString(),
                    DateRange        = timelinePeriod,
                    BudgetCategoryId = x.Key,
                    AmountTotal      = x.Select(s => s.AmountTotal)
                                       .Aggregate(new MoneyAmount(budgetCurrency.CurrencyCode, 0), (a, b) => a + b)
                })
                                           .ToList();
                var total = new DataPointDto()
                {
                    DateRange   = timelinePeriod,
                    Key         = timelinePeriod.ToString(),
                    AmountTotal = budgetCategoryTotals.Select(x => x.AmountTotal)
                                  .Aggregate(new MoneyAmount(budgetCurrency.CurrencyCode, 0), (a, b) => a + b)
                };

                return(new Result()
                {
                    Data = new ResponseDto()
                    {
                        DateRanges = dateRanges,
                        BudgetCategoryTotals = budgetCategoryTotals,
                        Total = total
                    }
                });
            }
        }
Пример #22
0
        public void ToString_For_Empty_Range_Returns_Never()
        {
            var sut = new DateRange();

            sut.ToString(null, CultureInfo.InvariantCulture).Should().Be("Never");
        }
Пример #23
0
        public void ToString_HasCorrectFormat()
        {
            TimeSpan length = RandomDuration(2, MaxDays);
            DateTime start = RandomDate(DateTime.MinValue, DateTime.MaxValue - length);
            DateTime end = start + length;
            int step = Random.Next(1, length.Days / 2);

            DateRange dateRange = new DateRange(start, end, step);
            Assert.AreEqual($"{start:d} - {end:d} [{length.TotalDays + 1} days]", dateRange.ToString());
        }
Пример #24
0
 protected string DateRangeDescription()
 {
     //will need to modify this
     return(DateRange.ToString());
 }