Exemplo n.º 1
0
        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));
        }
Exemplo n.º 2
0
 public bool Add(Brewery inBrewery, Location inLocation)
 {
     // check for existing brewery in same location
     if (breweryLocations.Contains(inLocation))
     {
         return false;
     }
     else
     {
         // add brewery
         breweries.Add(inBrewery);
         breweryLocations.Add(inLocation);
         return true;
     }
 }