示例#1
0
 //TODO: Use IoC
 private static void SetupData()
 {
     _coffeeShop = new CoffeeShop(
         new CoffeeShopReportGenerator(),
         new CoffeeStrategyFactory(),
         new CoffeeShopState());
 }
示例#2
0
        public void GivenCoffeeShop_WhenCallingGetSummary_ThenSummaryIsReturned()
        {
            _itemUnderTest = GivenCoffeeShopWithCustomers();

            var result = _itemUnderTest.GetSummary();

            Assert.IsNotEmpty(result);
            Mock.Get(_coffeeShopReportGenerator).Verify(c => c.GenerateSummaryReport(_coffeeShopState), Times.Once);
        }
        public void GivenEmptyCoffeeShop_WhenCallingGetSummary_ThenSummaryStringShouldBeReturned()
        {
            _itemUnderTest = GivenEmptyCoffeeShop();

            var result = _itemUnderTest.GetSummary();

            Assert.AreEqual(
                "Coffee Shop Summary" + Environment.NewLine + Environment.NewLine +
                "Total customers: 0" + Environment.NewLine +
                "    General sales: 0" + Environment.NewLine +
                "    Loyalty member sales: 0" + Environment.NewLine +
                "    Discount sales: 0" + Environment.NewLine +
                "    Employee Complimentary: 0" + Environment.NewLine + Environment.NewLine +
                "Total revenue from drinks: 0" + Environment.NewLine +
                "Total costs from drinks: 0" + Environment.NewLine +
                "Coffee Shop losing money of: 0" + Environment.NewLine + Environment.NewLine +
                "Total loyalty points given away: 0" + Environment.NewLine +
                "Total loyalty points redeemed: 0" + Environment.NewLine + Environment.NewLine +
                "Beans used: 0" + Environment.NewLine +
                "Beans remaining: 1000" + Environment.NewLine + Environment.NewLine +
                "Coffee Shop will not open tomorrow",
                result);
        }