コード例 #1
0
        public void CreateReturnsBasketLogger()
        {
            var clock  = new ManualClock(DateTime.Parse("2019-09-21"));
            var sut    = new BasketFactory(clock, this.writer, this.inventory);
            var actual = sut.Create(new UserId("john"));

            Assert.IsType <BasketLogger>(actual);
        }
コード例 #2
0
        public void CreateReturnsWithCurrentDate(string aDate)
        {
            var    clock  = new ManualClock(DateTime.Parse(aDate));
            var    sut    = new BasketFactory(clock, this.writer, this.inventory);
            UserId userId = new UserId("john");
            var    actual = sut.Create(userId);

            Assert.Equal(DateTime.Parse(aDate), actual.CreationDate);
            Assert.Same(userId, actual.UserId);
        }
コード例 #3
0
        static void Main(string[] args)
        {
            IBasket basket = basketFactory.Create();

            PopulateBasket(basket);

            int price = basket.GetPrice();

            if (price > 10)
            {
                Item firstItemInBasket = basket.Items.First();
                basket.Remove(firstItemInBasket);
            }
        }