Exemple #1
0
        public void GetPathnameOfCurrencyImageWithNullTest()
        {
            TillMoney tillMoney = null;
            var       expected  = "";

            var actual = DisplayCurrency.GetPathameOfCurrencyImage(tillMoney);

            Assert.AreEqual(expected, actual);
        }
        private string FormatMoneyImage(TillMoney denom)
        {
            var result = "";

            if (denom.Val == 0)
            {
                return(result);
            }
            result = DisplayCurrency.GetPathameOfCurrencyImage(denom);
            return(result);
        }
Exemple #3
0
        public void GetNumberOfCurrencyImagesWithNegativeNumberTest()
        {
            var tillMoney = new TillMoney
            {
                Val = -1
            };
            var expected = 0;

            var actual = DisplayCurrency.GetNumberOfCurrencyImages(tillMoney);

            Assert.AreEqual(expected, actual);
        }
Exemple #4
0
        public void GetPathnameOfCurrencyImageWithTenTest()
        {
            var denom     = new CurrencyTen();
            var tillMoney = new TillMoney
            {
                Name = denom.Name,
            };
            var expected = "~/images/Ten.png";

            var actual = DisplayCurrency.GetPathameOfCurrencyImage(tillMoney);

            Assert.AreEqual(expected, actual);
        }
Exemple #5
0
        public void GetNumbeOfCurrencyImagesWithValFromZeroToTenThousandTest()
        {
            for (int i = 0; i < 10001; i++)
            {
                var tillMoney = new TillMoney
                {
                    Val = i
                };
                var expected = i;

                var actual = DisplayCurrency.GetNumberOfCurrencyImages(tillMoney);

                Assert.AreEqual(expected, actual);
            }
        }
Exemple #6
0
        public void GetPathnameOfCurrencyImageWithTwentyAndValsFromZeroToTenThousandTest()
        {
            var denom = new CurrencyTwenty();

            for (int i = 0; i < 10001; i++)
            {
                var tillMoney = new TillMoney
                {
                    Name       = denom.Name,
                    Val        = i,
                    PluralName = denom.PluralName
                };
                var expected = i <= 4 ? "~/images/Twenty.png" : "~/images/Twenties.png";

                var actual = DisplayCurrency.GetPathameOfCurrencyImage(tillMoney);

                Assert.AreEqual(expected, actual);
            }
        }