示例#1
0
        public void ShouldGetCorrectAmountDue()
        {
            Order order = new Order();

            order.Add(new BriarheartBurger());
            RegisterUtility registerUtility = new RegisterUtility(order);

            Assert.Equal("$7.08", registerUtility.AmountDue);
        }
示例#2
0
        public void ChangingCustomerTwosPropertyShouldInvokeChange()
        {
            RegisterUtility registerUtility = new RegisterUtility(new Order());

            Assert.PropertyChanged(registerUtility, "AmountDue", () =>
            {
                registerUtility.CustomerTwos = 1;
            });
            Assert.PropertyChanged(registerUtility, "CustomerTwos", () =>
            {
                registerUtility.CustomerTwos = 0;
            });
        }
示例#3
0
        public void ShouldGetCorrectChangePennies()
        {
            Order order = new Order();

            order.Add(new BriarheartBurger());
            RegisterUtility registerUtility = new RegisterUtility(order);

            Assert.Equal(0, registerUtility.ChangePennies);
            registerUtility.CustomerPennies = 708;
            Assert.Equal("$0", registerUtility.ChangeOwed);
            Assert.Equal(0, registerUtility.ChangePennies);
            registerUtility.CustomerPennies = 709;
            Assert.Equal("$0.01", registerUtility.ChangeOwed);
            Assert.Equal(1, registerUtility.ChangePennies);
        }
示例#4
0
        public void ShouldGetCorrectChangeNickels()
        {
            Order order = new Order();

            order.Add(new BriarheartBurger());
            RegisterUtility registerUtility = new RegisterUtility(order);

            Assert.Equal(0, registerUtility.ChangeNickels);
            registerUtility.CustomerNickels = 140;
            Assert.Equal("$0.00", registerUtility.ChangeOwed);
            Assert.Equal(0, registerUtility.ChangeNickels);
            registerUtility.CustomerNickels = 143;
            Assert.Equal("$0.07", registerUtility.ChangeOwed);
            Assert.Equal(1, registerUtility.ChangeNickels);
        }
示例#5
0
        public void ShouldGetCorrectChangeQuarters()
        {
            Order order = new Order();

            order.Add(new BriarheartBurger());
            RegisterUtility registerUtility = new RegisterUtility(order);

            Assert.Equal(0, registerUtility.ChangeQuarters);
            registerUtility.CustomerQuarters = 28;
            Assert.Equal("$0.00", registerUtility.ChangeOwed);
            Assert.Equal(0, registerUtility.ChangeQuarters);
            registerUtility.CustomerQuarters = 30;
            Assert.Equal("$0.42", registerUtility.ChangeOwed);
            Assert.Equal(1, registerUtility.ChangeQuarters);
        }
示例#6
0
        public void ShouldGetCorrectChangeHalfDollars()
        {
            Order order = new Order();

            order.Add(new BriarheartBurger());
            RegisterUtility registerUtility = new RegisterUtility(order);

            Assert.Equal(0, registerUtility.ChangeHalfDollars);
            registerUtility.CustomerHalfDollars = 14;
            Assert.Equal("$0.00", registerUtility.ChangeOwed);
            Assert.Equal(0, registerUtility.ChangeHalfDollars);
            registerUtility.CustomerHalfDollars = 16;
            Assert.Equal("$0.92", registerUtility.ChangeOwed);
            Assert.Equal(1, registerUtility.ChangeHalfDollars);
        }
示例#7
0
        public void ShouldGetCorrectChangeTwos()
        {
            Order order = new Order();

            order.Add(new BriarheartBurger());
            RegisterUtility registerUtility = new RegisterUtility(order);

            Assert.Equal(0, registerUtility.ChangeTwos);
            registerUtility.CustomerTwos = 3;
            Assert.Equal("$0.00", registerUtility.ChangeOwed);
            Assert.Equal(0, registerUtility.ChangeTwos);
            registerUtility.CustomerTwos = 5;
            Assert.Equal("$2.92", registerUtility.ChangeOwed);
            Assert.Equal(1, registerUtility.ChangeTwos);
        }
示例#8
0
        public void ShouldGetCorrectChangeTwenties()
        {
            Order order = new Order();

            order.Add(new BriarheartBurger());
            RegisterUtility registerUtility = new RegisterUtility(order);

            Assert.Equal(0, registerUtility.ChangeTwenties);
            registerUtility.CustomerTwenties = 1;
            Assert.Equal("$12.92", registerUtility.ChangeOwed);
            Assert.Equal(0, registerUtility.ChangeTwenties);
            registerUtility.CustomerTwenties = 2;
            Assert.Equal("$32.92", registerUtility.ChangeOwed);
            Assert.Equal(1, registerUtility.ChangeTwenties);
        }