コード例 #1
0
ファイル: UnitTest1.cs プロジェクト: hoohoodumplings/BrewGame
        public void TestAdd()
        {
            Brewery testBrewery = new Brewery("Casey");
            Ingredient testIngredient = new Ingredient("test", 1);
            Brew testBrew = new Brew("american lager");
            FermVessel testFermVessel = new FermVessel();

            // Empty test
            Assert.AreEqual(0, testBrewery.ingBag.Count);
            Assert.AreEqual(0, testBrewery.brewBag.Count);
            Assert.AreEqual(0, testBrewery.fvBag.Count);

            // Add ingredient
            testBrewery.Add(testIngredient, 20);
            Assert.AreEqual(1, testBrewery.ingBag.Count);
            Assert.AreEqual(20, testBrewery.ingQty[0]);

            testBrewery.Add(new Ingredient("test", 1), 20);
            Assert.AreEqual(1, testBrewery.ingBag.Count);
            Assert.AreEqual(40, testBrewery.ingQty[0]);

            testBrewery.Add(new Ingredient("water", 1), 20);
            Assert.AreEqual(2, testBrewery.ingBag.Count);
            Assert.AreEqual(40, testBrewery.ingQty[0]);
            Assert.AreEqual(20, testBrewery.ingQty[1]);

            // Add brew
            testBrewery.Add(testBrew, 20);
            Assert.AreEqual(1, testBrewery.brewBag.Count);
            Assert.AreEqual(20, testBrewery.brewQty[0]);

            testBrewery.Add(new Brew("american lager"), 20);
            Assert.AreEqual(1, testBrewery.brewBag.Count);
            Assert.AreEqual(40, testBrewery.brewQty[0]);

            Brew brew2 = new Brew("test", 1);
            testBrewery.Add(brew2, 20);
            Assert.AreEqual(2, testBrewery.brewBag.Count);
            Assert.AreEqual(40, testBrewery.brewQty[0]);
            Assert.AreEqual(20, testBrewery.brewQty[1]);

            // Add fermentation vessel
            testBrewery.Add(testFermVessel);
            Assert.AreEqual(1, testBrewery.fvBag.Count);

            testBrewery.Add(new FermVessel());
            Assert.AreEqual(2, testBrewery.fvBag.Count);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: hoohoodumplings/BrewGame
 // Add FermVessel to Brewery
 public bool Add(FermVessel addFermVessel)
 {
     fvBag.Add(addFermVessel);
     return(true);
 }
コード例 #3
0
ファイル: UnitTest1.cs プロジェクト: hoohoodumplings/BrewGame
        public void TestEmpty()
        {
            Recipe testRecipe = new Recipe();
            FermVessel testFermVessel = new FermVessel();
            int starting = testRecipe.time;

            testFermVessel.Add(testRecipe.output,
                testRecipe.brewQty, testRecipe.time);

            testFermVessel.Empty();

            Assert.IsTrue(testFermVessel.isEmpty());
        }
コード例 #4
0
ファイル: UnitTest1.cs プロジェクト: hoohoodumplings/BrewGame
        public void TestAge()
        {
            Recipe testRecipe = new Recipe();
            FermVessel testFermVessel = new FermVessel();
            int starting = testRecipe.time;

            testFermVessel.Add(testRecipe.output,
                testRecipe.brewQty, testRecipe.time);

            testFermVessel.Age(1);

            Assert.AreEqual(starting - 1, testFermVessel.timeRemaining);
        }
コード例 #5
0
ファイル: UnitTest1.cs プロジェクト: hoohoodumplings/BrewGame
        public void TestAdd()
        {
            Recipe testRecipe = new Recipe();
            FermVessel testFermVessel = new FermVessel();

            // Able to add recipe successfully?
            bool success = testFermVessel.Add(testRecipe.output,
                testRecipe.brewQty, testRecipe.time);
            Assert.IsTrue(success);

            Assert.AreEqual(testRecipe.output,
                testFermVessel.storedBrew);
        }
コード例 #6
0
ファイル: UnitTest1.cs プロジェクト: hoohoodumplings/BrewGame
        public void TestRemoveFermVessel()
        {
            Brewery testBrewery = new Brewery("Casey");
            FermVessel testFermVessel = new FermVessel();

            testBrewery.Add(testFermVessel);
            Assert.AreEqual(1, testBrewery.fvBag.Count);

            testBrewery.RemoveFermVessel(0);
            Assert.AreEqual(0, testBrewery.fvBag.Count);
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: hoohoodumplings/BrewGame
 // Add FermVessel to Brewery
 public bool Add(FermVessel addFermVessel)
 {
     fvBag.Add(addFermVessel);
     return true;
 }