コード例 #1
0
ファイル: UnitTest1.cs プロジェクト: hoohoodumplings/BrewGame
        public void TestAddBrewery()
        {
            Company testCompany = new Company("testco", 1000);
            Brewery testBrewery = new Brewery();
            Location testLocation1 = new Location("testloc1", new int[] {1,1});
            Location testLocation2 = new Location("testloc2", new int[] {2,2});

            // Successfully add a brewery
            Assert.IsTrue(testCompany.Add(testBrewery, testLocation1));

            // Can't add to the same location
            Assert.IsFalse(testCompany.Add(testBrewery, testLocation1));

            // Still only 1
            Assert.AreEqual(1, testCompany.breweries.Count);

            // Can add to a new location
            Assert.IsTrue(testCompany.Add(testBrewery, testLocation2));
        }
コード例 #2
0
ファイル: UnitTest1.cs プロジェクト: hoohoodumplings/BrewGame
        public void TestAddRecipe()
        {
            Company testCompany = new Company("testco", 1000);
            Recipe testRecipe = new Recipe();

            // Starts at 0
            Assert.AreEqual(0, testCompany.recipes.Count);

            // Add 1
            Assert.IsTrue(testCompany.Add(testRecipe));
            Assert.AreEqual(1, testCompany.recipes.Count);

            // Add another
            Assert.IsTrue(testCompany.Add(testRecipe));
            Assert.AreEqual(2, testCompany.recipes.Count);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: hoohoodumplings/BrewGame
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to BrewGame.");

            // Start new game
            locations.Add(new Location("Testville, USA", new int[] { 5, 5 }));

            Console.WriteLine("\nEnter your company name.");
            company = new Company(Console.ReadLine(), 1200);

            // Start main loop
            MainLoop();
        }