Esempio n. 1
0
 public void CreateWithCurrentCulture()
 {
     using (CultureSaver.SetCultures(Cultures.DotTimeSeparator))
     {
         var pattern = InstantPattern.CreateWithCurrentCulture("HH:mm:ss");
         var text    = pattern.Format(Instant.FromUtc(2000, 1, 1, 12, 34, 56));
         Assert.AreEqual("12.34.56", text);
     }
 }
Esempio n. 2
0
        public void CanNotSellAnExpiredPie(
            string expiryDateString,
            string currentDateString,
            [Frozen(Matching.ImplementedInterfaces)] FakeClock fakeClock,
            [Frozen(Matching.ImplementedInterfaces)] ProductValidationService productValidationService,
            [Frozen(Matching.ImplementedInterfaces)] DiscountService discountService,
            Basket basket)
        {
            productValidationService.AddValidator(new ExpiredPieValidator(fakeClock));

            LocalDate expiryDate  = LocalDatePattern.CreateWithCurrentCulture("dd/MM/yyyy").Parse(expiryDateString).Value;
            Instant   currentDate = InstantPattern.CreateWithCurrentCulture("dd/MM/yyyy").Parse(currentDateString).Value;

            fakeClock.Reset(currentDate);

            Pie pie = new Pie(default(Price), expiryDate);

            AddResult result = basket.Add(pie);

            result.Success.Should().BeFalse();
        }