コード例 #1
0
        private decimal ScanAllAndReturnTotal(string items)
        {
            ITillController till = IoC.Container.GetService <ITillController>();

            foreach (char item in items.ToCharArray())
            {
                till.Scan(item.ToString());
            }
            return(till.Total());
        }
コード例 #2
0
        public void WhenGivenIncrementalValuesEnsureTheValueIsCorrectThroughout()
        {
            ITillController till = IoC.Container.GetService <ITillController>();

            Assert.Equal(0, till.Total());
            till.Scan("A"); Assert.Equal(0.50M, till.Total());
            till.Scan("B"); Assert.Equal(0.80M, till.Total());
            till.Scan("A"); Assert.Equal(1.30M, till.Total());
            till.Scan("A"); Assert.Equal(1.60M, till.Total());
            till.Scan("B"); Assert.Equal(1.75M, till.Total());
        }