Ejemplo n.º 1
0
        public void should_handle_null_shopping_carts()
        {
            var calculator = new NetValueCalculator();
            var value      = calculator.GetNetValue(null);

            value.Should().BeApproximately(0, 0.005m);
        }
Ejemplo n.º 2
0
        public void zero_items_gives_zero_value()
        {
            var shoppingCart = new List <Tuple <decimal, int> >
            {
                new Tuple <decimal, int>(100, 0)
            };
            var calculator = new NetValueCalculator();
            var value      = calculator.GetNetValue(shoppingCart);

            value.Should().BeApproximately(0, 0.005m);
        }
Ejemplo n.º 3
0
        public void applies_10_percent_discount()
        {
            var shoppingCart = new List <Tuple <decimal, int> >
            {
                new Tuple <decimal, int>(200.01m, 1)
            };
            var calculator = new NetValueCalculator();
            var value      = calculator.GetNetValue(shoppingCart);

            value.Should().BeApproximately(180.01m, 0.005m);
        }
Ejemplo n.º 4
0
        public void should_sum_all_items_in_the_shopping_cart()
        {
            var shoppingCart = new List <Tuple <decimal, int> >
            {
                new Tuple <decimal, int>(10, 1),
                new Tuple <decimal, int>(10, 1)
            };

            var calculator = new NetValueCalculator();
            var value      = calculator.GetNetValue(shoppingCart);

            value.Should().BeApproximately(20, 0.005m);
        }