示例#1
0
        public void Coin001AddJarTest()
        {
            Coin001 coin001 = new Coin001();
            Jar     jar     = new Jar();

            //add the 1-cent coin to the jar
            coin001.AddToJar(jar);

            //assert jar.Coin001Counter is 1 and jar.CurrentAmount is $0.01
            Assert.AreEqual(1, jar.Coin001Counter);
            Assert.AreEqual(0.01m, jar.CurrentAmount);
        }
        public void FillUpwith1CentCoinTest()
        {
            Jar     jar     = new Jar();
            Coin001 coin001 = new Coin001();

            //fill up with 1-cent coins
            while (coin001.AddToJar(jar))
            {
                ;
            }

            jar.PrintJar();
        }
示例#3
0
        public void ResetJarTest()
        {
            Jar     jar     = new Jar();
            Coin001 coin001 = new Coin001();

            coin001.AddToJar(jar);

            jar.ResetJar();

            // After calling jar.ResetJar() all properties of jar should be 0.
            Assert.AreEqual(0.0m, jar.CurrentAmount);
            Assert.AreEqual(0.0m, jar.CurrentVolume);
            Assert.AreEqual(0, jar.Coin001Counter);
            Assert.AreEqual(0, jar.Coin005Counter);
            Assert.AreEqual(0, jar.Coin010Counter);
            Assert.AreEqual(0, jar.Coin025Counter);
            Assert.AreEqual(0, jar.Coin050Counter);
            Assert.AreEqual(0, jar.Coin100Counter);
        }